UNPKG

raptor-polyfill

Version:

Polyfills for various EcmaScript 5 and EcmaScript 6 methods distributed as CommonJS modules that can be require'd individually or as a whole.

24 lines (21 loc) 737 B
// ES5 15.4.4.17 // http://es5.github.com/#x15.4.4.17 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some if (!Array.prototype.some) { var toObject = require('./_toObject'); Array.prototype.some = function some(fun /*, thisp */) { var self = toObject(this), length = self.length >>> 0, thisp = arguments[1]; // If no callback function or if callback is not a callable function if (typeof fun !== "function") { throw new TypeError(); } for (var i = 0; i < length; i++) { if (i in self && fun.call(thisp, self[i], i, self)) { return true; } } return false; }; }