(input: BufferSource)
| 67 | } |
| 68 | |
| 69 | public decode(input: BufferSource): string { |
| 70 | const buffer = ArrayBuffer.isView(input) ? input.buffer : input; |
| 71 | if (Object_prototype_toString.call(buffer) !== ArrayBufferString) { |
| 72 | throw Error("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); |
| 73 | } |
| 74 | const inputAs8 = new Uint8Array(buffer); |
| 75 | let resultingString = ''; |
| 76 | for (let index = 0, len = inputAs8.length | 0; index < len; index = (index + 32768) | 0) { |
| 77 | resultingString += String.fromCharCode.apply(0, inputAs8.slice(index, (index + 32768) | 0)); |
| 78 | } |
| 79 | |
| 80 | return resultingString.replace(/[\xc0-\xff][\x80-\xbf]*/g, decoderReplacer); |
| 81 | } |
| 82 | |
| 83 | public toString() { |
| 84 | return '[object TextDecoder]'; |
no test coverage detected