(source, endings)
| 107 | } |
| 108 | |
| 109 | function getSource(source, endings) { |
| 110 | if (isBlob(source)) |
| 111 | return [source.size, source[kHandle]]; |
| 112 | |
| 113 | if (isAnyArrayBuffer(source)) { |
| 114 | source = new Uint8Array(source); |
| 115 | } else if (!isArrayBufferView(source)) { |
| 116 | if (endings === 'native') |
| 117 | source = RegExpPrototypeSymbolReplace(/\n|\r\n/g, source, EOL); |
| 118 | source = enc.encode(source); |
| 119 | } |
| 120 | |
| 121 | // We copy into a new Uint8Array because the underlying |
| 122 | // BackingStores are going to be detached and owned by |
| 123 | // the Blob. |
| 124 | const { buffer, byteOffset, byteLength } = source; |
| 125 | const slice = buffer.slice(byteOffset, byteOffset + byteLength); |
| 126 | return [byteLength, new Uint8Array(slice)]; |
| 127 | } |
| 128 | |
| 129 | const sourcesConverter = createSequenceConverter((source, opts = kEmptyObject) => { |
| 130 | if (isBlob(source) || isAnyArrayBuffer(source) || isArrayBufferView(source)) { |
no test coverage detected
searching dependent graphs…