1.0.0 • Published 8 years ago
some-own v1.0.0
some-own
Like [].some but for objects.
npm install some-ownconst someOwn = require("some-own")API
someOwn(object, callback, scope: undefined)
@param
objectis the object to iteratecallbackreceives(value, key, object)scopeis thethiscontext used to.callcallback
@return boolean
- Breaks from the loop and returns
trueif anycallbackiteration result returns truthy - Else returns
false
Usage
const someOwn = require("some-own")someOwn({x: 5, y: 0}, value => value < 0) // false
someOwn({x: -5, y: 0}, value => value < 0) // true
someOwn({x: 5, y: 0}, (value, key) => key.length === 1) // truelet array = []
someOwn({x: 5, y: 0}, value => array.push(value)) // true
array.length // 1let array = []
someOwn({x: 5, y: 0}, value => array.push(value) > 10) // false
array.length // 21.0.0
8 years ago