1 | # airbnb-js-shims <sup>[![Version Badge][2]][1]</sup>
|
2 |
|
3 | JS language shims used by Airbnb.
|
4 |
|
5 | Just require/import `airbnb-js-shims`, and the environment will be shimmed.
|
6 |
|
7 | ```js
|
8 | import 'airbnb-js-shims';
|
9 | ```
|
10 |
|
11 | ## Included shims
|
12 |
|
13 | - [es5-shim](https://www.npmjs.com/package/es5-shim)
|
14 | - [es5-sham](https://www.npmjs.com/package/es5-shim)
|
15 | - [es6-shim](https://www.npmjs.com/package/es6-shim)
|
16 | - [Function.prototype.name](https://www.npmjs.com/package/function.prototype.name)
|
17 | - [Array.prototype.includes](https://www.npmjs.com/package/array-includes) (ES7/ES2016)
|
18 | - [Object.entries](https://www.npmjs.com/package/object.entries) (ES8/ES2017)
|
19 | - [Object.values](https://www.npmjs.com/package/object.values) (ES8/ES2017)
|
20 | - [String.prototype.padStart](https://www.npmjs.com/package/string.prototype.padstart) (ES8/ES2017)
|
21 | - [String.prototype.padEnd](https://www.npmjs.com/package/string.prototype.padend) (ES8/ES2017)
|
22 | - [Promise.prototype.finally](https://npmjs.com/package/promise.prototype.finally) (Stage 4, ES2018)
|
23 | - [Array.prototype.flat](https://npmjs.com/package/array.prototype.flat) (Stage 3, ES2019 candidate)
|
24 | - (DEPRECATED: renamed to "flat") [Array.prototype.flatten](https://npmjs.com/package/array.prototype.flatten) (Stage 3, ES2019 candidate)
|
25 | - [Array.prototype.flatMap](https://npmjs.com/package/array.prototype.flatmap) (Stage 3, ES2019 candidate)
|
26 | - [Symbol.prototype.description](https://npmjs.com/package/symbol.prototype.description) (Stage 3, ES2019 candidate)
|
27 | - [String.prototype.matchAll](https://npmjs.com/package/string.prototype.matchall) (Stage 3, ES2019 candidate)
|
28 | - [Object.fromEntries](https://npmjs.com/package/object.fromentries) (Stage 3, ES2019 candidate)
|
29 |
|
30 | ## Targeting versions
|
31 |
|
32 | If you do not need to support older browsers, you can pick a subset of ES versions to target. For example, if you don't support pre-ES5 browsers, you can start your shims with ES2015 by requiring/importing the specific target file. This will shim the environment for that version and upward.
|
33 |
|
34 | ```js
|
35 | import 'airbnb-js-shims/target/es2015';
|
36 | ```
|
37 |
|
38 | ### Included targets
|
39 |
|
40 | - `airbnb-js-shims/target/es5` (default)
|
41 | - `airbnb-js-shims/target/es2015`
|
42 | - `airbnb-js-shims/target/es2016`
|
43 | - `airbnb-js-shims/target/es2017`
|
44 | - `airbnb-js-shims/target/es2018`
|
45 | - `airbnb-js-shims/target/es2019`
|
46 |
|
47 | [1]: https://npmjs.org/package/airbnb-js-shims
|
48 | [2]: http://versionbadg.es/airbnb/js-shims.svg
|