ES6 shims that use native implementation if available
npm install @natlibfi/es6-shimsA collection of ES6 shims that use native implementations if available.
If you are looking for ES6 polyfills check out es6-polyfills.
- Array
- Array.prototype.find
- Array.prototype.findIndex
Clone the sources and install the package (In the source directory) on command line using npm:
``sh`
npm install
Run the following NPM script to lint, test and check coverage of the code:
`javascript
npm run check
`
Individual shims can be found inside the containing object's directory, e.g. lib/shims/array/
`javascript
define(['es6-shims/lib/shims/array'], function(shim_array) {
// index === 1
var index = shim_array.find([1, 2, 3], function(element) {
return element === 2;
});
});
`
`javascript
// index === 1
var index = es6_shim_array.find([1, 2, 3], function(element) {
return element === 2;
});
});
`
`javascript
var shim_array = require('es6-shims/lib/shims/array');
// index === 1
var index = shim_array.find([1, 2, 3], function(element) {
return element === 2;
});
``
Copyright (c) 2016-2017 University Of Helsinki (The National Library Of Finland)
This project's source code is licensed under the terms of GNU Lesser General Public License Version 3 or any later version.