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) 742 B
// ES5 15.4.4.16 // http://es5.github.com/#x15.4.4.16 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every if (!Array.prototype.every) { var toObject = require('./_toObject'); Array.prototype.every = function every(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 false; } } return true; }; }