Created
January 19, 2020 01:16
-
-
Save bitfishxyz/1024d08dddcac9e9b7edc1abee4b4228 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const selfSome = function (fn, context) { | |
let arr = Array.prototype.slice.call(this) | |
if(!arr.length) return false | |
for (let i = 0; i < arr.length; i++) { | |
if(!arr.hasOwnProperty(i)) continue; | |
let res = fn.call(context,arr[i],i,this) | |
if(res)return true | |
} | |
return false | |
} | |
Array.prototype.selfSome = selfSome; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment