@cto.af/textdecoder
Version:
Quick wrapper that finds TextDecoder or polyfills a bad implementation
21 lines (13 loc) • 696 B
Markdown
I needed this in two different projects, so I pulled it out. All of the
existing TextDecoder polyfills try to do too much for what I needed. The goal
here is to NOT require any Unicode tables, keeping this as small as possible.
This just finds the best TextDecoder instance it can, and mocks in a dirty one
for old or broken environments.
```js
const TextDecoder = require('@cto.af/textdecoder')
```
See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder)
[](https://github.com/hildjj/ctoaf-textdecoder/actions/workflows/node.js.yml)