UNPKG

array-find-es6

Version:

ES6 Array.find ponyfill. Return the first array element which satisfies a testing function.

2 lines (1 loc) 407 B
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):n.arrayFindEs6=e()}(this,function(){return function(n,e,t){if("function"==typeof Array.prototype.find)return n.find(e,t);t=t||this;var o=n.length;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(var f=0;f<o;f++)if(e.call(t,n[f],f,n))return n[f]}});