some-own
v1.0.0
Published
Like [].some but for objects
Downloads
3
Maintainers
Readme
some-own
Like [].some
but for objects.
npm install some-own
const someOwn = require("some-own")
API
someOwn(object, callback, scope: undefined)
@param
object
is the object to iteratecallback
receives(value, key, object)
scope
is thethis
context used to.call
callback
@return boolean
- Breaks from the loop and returns
true
if anycallback
iteration 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) // true
let array = []
someOwn({x: 5, y: 0}, value => array.push(value)) // true
array.length // 1
let array = []
someOwn({x: 5, y: 0}, value => array.push(value) > 10) // false
array.length // 2