UNPKG

sugar

Version:

A Javascript utility library for working with native objects.

25 lines (20 loc) 662 B
'use strict'; var Sugar = require('sugar-core'), assertCallable = require('../../common/internal/assertCallable'); Sugar.Array.defineInstancePolyfill({ 'some': function(fn) { // Force compiler to respect argument length. var argLen = arguments.length, context = arguments[1]; var length = this.length, index = 0; assertCallable(fn); while(index < length) { if (index in this && fn.call(context, this[index], index, this)) { return true; } index++; } return false; } }); // This package does not export anything as it is mapping a // polyfill to Array.prototype which cannot be called statically.