JS language shims used by Airbnb.
Just require/import airbnb-js-shims
, and the environment will be shimmed.
import 'airbnb-js-shims';
- es5-shim
- es5-sham
- es6-shim
- Function.prototype.name
- Array.prototype.includes (ES7/ES2016)
- Object.entries (ES8/ES2017)
- Object.values (ES8/ES2017)
- String.prototype.padStart (ES8/ES2017)
- String.prototype.padEnd (ES8/ES2017)
- Promise.prototype.finally (ES2018)
- Array.prototype.flat (ES2019)
- Array.prototype.flatMap (ES2019)
- Symbol.prototype.description (ES2019)
- Object.fromEntries (ES2019)
- String.prototype.matchAll (ES2019)
- globalThis (Stage 3)
- Promise.allSettled (Stage 3)
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.
import 'airbnb-js-shims/target/es2015';
airbnb-js-shims/target/es5
(default)airbnb-js-shims/target/es2015
airbnb-js-shims/target/es2016
airbnb-js-shims/target/es2017
airbnb-js-shims/target/es2018
airbnb-js-shims/target/es2019
airbnb-js-shims/target/es2020