An ESnext spec-compliant Array.prototype.item
shim/polyfill/replacement that works as far down as ES3.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the proposed spec.
Because Array.prototype.item
depends on a receiver (the this
value), the main export takes the array to operate on as the first argument.
Getting started
npm install --save array.prototype.item
Usage/Examples
var item = ;var assert = ; var arr = 1 2 3; var results = ; assert;
var item = ;var assert = ;/* when Array#item is not present */delete Arrayprototypeitem;var shimmedFlatMap = item; var { return x 1; }; assert;assert;
var item = ;var assert = ;/* when Array#item is present */var shimmedIncludes = item; var { return x 1; }; assert;assert;
Tests
Simply clone the repo, npm install
, and run npm test