array-includes-polyfill
Version:
Exposing a richer set of Array features for JavaScript
35 lines (25 loc) • 793 B
JavaScript
var includes = require('./polyfills/includes');
var lookup = require('./polyfills/find-object');
var trash = require('./polyfills/trash');
var copy = require('./polyfills/copy');
var clear = require('./polyfills/clear');
var inherit = require('inherit-prototypes');
let dependencies = [includes, lookup, copy, clear, trash];
class ArrayIncludesPollyfills extends Array {
constructor(array){
super();
this.length = 0;
if(typeof array == 'array')
array.map((element)=>{
this.push(element);
});
if(typeof array == 'object'){
var keys = Object.keys(array);
keys.map((key)=>{
this.push(array[key]);
});
}
}
}
inherit(ArrayIncludesPollyfills, dependencies);
module.exports = ArrayIncludesPollyfills