| 134 | } |
| 135 | |
| 136 | class TextEncoder { |
| 137 | get [Symbol.toStringTag]() { |
| 138 | return 'TextEncoder'; |
| 139 | } |
| 140 | |
| 141 | get encoding() { |
| 142 | return 'utf-8'; |
| 143 | } |
| 144 | |
| 145 | encode(input = '') { |
| 146 | const Encoding = import.meta.importSync('_encodingNative'); |
| 147 | // The TextEncoder specification only allows for UTF-8 encoding. |
| 148 | return Encoding.encode(`${input}`, 'utf-8'); |
| 149 | } |
| 150 | |
| 151 | encodeInto(input = '', output = new Uint8Array()) { |
| 152 | const Encoding = import.meta.importSync('_encodingNative'); |
| 153 | // The TextEncoder specification only allows for UTF-8 encoding. |
| 154 | return Encoding.encodeInto(`${input}`, output); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | Object.defineProperty(globalThis, 'TextEncoder', { |
| 159 | configurable: false, |
nothing calls this directly
no outgoing calls
no test coverage detected