Updating NPM dependencies

This commit is contained in:
Drew Heavner
2020-11-11 13:30:52 +00:00
committed by GitHub
parent 7a6fb66c63
commit bd487ef324
9068 changed files with 1400893 additions and 587661 deletions

View File

@@ -1,41 +1,48 @@
[![Build](https://api.travis-ci.org/samthor/fast-text-encoding.svg?branch=master)](https://travis-ci.org/samthor/fast-text-encoding)
This is a fast polyfill for [`TextEncoder`][1] and [`TextDecoder`][2], which let you encode and decode JavaScript strings into UTF-8 bytes.
It is fast partially as it does not support any encodings aside UTF-8 (and note that natively, only `TextDecoder` supports alternative encodings anyway).
See [some benchmarks](https://github.com/samthor/fast-text-encoding/tree/master/bench).
[1]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder
[2]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder
# Usage
Include the minified inside a `script` tag or as an ES6 Module for its side-effects.
It will create `TextEncoder` and `TextDecoder` if the symbols are missing on `window`.
Install as "fast-text-encoding" via your favourite package manager.
You only need this polyfill if you're supporting older browsers like IE, legacy Edge, ancient Chrome and Firefox, or Node before v11.
## Browser
Include the minified code inside a `script` tag or as an ES6 Module for its side effects.
It will create `TextEncoder` and `TextDecoder` if the symbols are missing on `window` or `global.`
```html
<script src="node_modules/fast-text-encoding/text.min.js"></script>
<script type="module">
import './node_modules/fast-text-encoding/text.min.js';
// confidently do something with TextEncoder \o/
import 'fast-text-encoding'; // or perhaps this
// confidently do something with TextEncoder or TextDecoder \o/
</script>
```
**Note**: Always include `text.min.js`, as it's compiled to ES5 for older environments.
⚠️ You'll probably want to depend on `text.min.js`, as it's compiled to ES5 for older environments.
## Node
Install via NPM or Yarn (name "fast-text-encoding"), and then import purely for side effects:
You only need this polyfill in Node before v11.
However, you can use `Buffer` to provide the same functionality (but not conforming to any spec) in versions even older than that.
```js
// don't need to save this anywhere, just require before use
require('fast-text-encoding');
require('fast-text-encoding'); // just require me before use
const buffer = new TextEncoder().encode('Turn me into UTF-8!');
// buffer is now a Uint8Array of [84, 117, 114, 110, ...]
```
# Supports
Built for IE11, Edge and Node environments.
Not required for Chrome, Firefox etc, which have native implementations.
In Node v5.1 and above, this polyfill uses `Buffer` to implement `TextDecoder`.
# Release
@@ -48,4 +55,4 @@ Compile code with [Closure Compiler](https://closure-compiler.appspot.com/home).
// ==/ClosureCompiler==
// code here
```
```