Created
September 3, 2013 00:50
-
-
Save evanleck/6418548 to your computer and use it in GitHub Desktop.
Array.prototype.some shim for non-compliant browsers. Converted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make sure we have some | |
unless Array::some | |
Array::some = (fun) -> #, thisp | |
"use strict" | |
throw new TypeError() unless this? | |
thisp = undefined | |
i = undefined | |
t = Object(this) | |
len = t.length >>> 0 | |
throw new TypeError() if typeof fun isnt "function" | |
thisp = arguments_[1] | |
i = 0 | |
while i < len | |
return true if i of t and fun.call(thisp, t[i], i, t) | |
i++ | |
false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment