What Does It Do?
This package is an on-going project to bring robust and deep features to array functionality with JavaScript. This package does not change any prototypes of any original object but merely extends them to this package.
Current Array Features
new array //This will generate a new Array-includes-polyfill and copy all data from a given Array.new array // This will generate a new Array-includes-polyfill and copy all data from a given Object.array.includes ; //returns true or false based on result of toplevel string search.array.lookup //returns specific object or new ES5 array of objects that match.array.trash //Will permanently delete specified object from the array.
How To Use
npm install array-includes-polyfill --save
var array = ;var arr = ; /** Includes polyfill **/arr;console;console; /** Custom lookup polyfill */var obj1 = id:'_$1QA2WS3ED' user:'john doe' details:dob:'01/01/99';var obj2 = id:'_$1QA2WS3EF' user:'john doe' details:dob:'01/02/99';var obj3 = id:'_$1QA2WS3EG' user:'john doe' details:dob:'01/01/99'; var obj4 = id:'_$1QA2WS3EH' user:'jane doe' details:dob:'01/02/99';var obj5 = id:'_$1QA2WS3EI' user:'jack doe' details:dob:'01/05/99';var obj6 = id:'_$1QA2WS3EJ' user:'july doe' details:dob:'01/06/99'; arr; arrdetailsoccupation="programmer";console;//arr > obj1 - will now include the occupation property with the programmer value arrdetailsoccupation="programmer";console; //arr > obj2 - will now include the occupation property with the programmer value arr;console; //<-- Deletes user july doe from the array permanently. var destination = arr; //<-- Will return a regular JavaScript Array to destinationarr; //<-- Will copy contents of arr to destination and return a regular JavaScript Array var arr = id:123 id:321 id:213;arrclear;console; //<-- should equal an empty an Array like object;
TESTS
You can run the tests using the Atom code editor and the Wallaby plugin. Here is the path to the tests.
node_modules > tests
If you do not have Wallaby (the license is expensive!): Run at localhost:8080 server and open console for test results
npm install -g http-serverhttp-server
EXAMPLE.JS
Paste this example into your console via Chrome to see the results of the array polyfills/features.
node_modules > array-includes-polyfill > example.js