Skip to content

Instantly share code, notes, and snippets.

@bitfishxyz
Created January 19, 2020 01:16
Show Gist options
  • Save bitfishxyz/1024d08dddcac9e9b7edc1abee4b4228 to your computer and use it in GitHub Desktop.
Save bitfishxyz/1024d08dddcac9e9b7edc1abee4b4228 to your computer and use it in GitHub Desktop.
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