every-own
v1.0.0
Published
Like [].every but for objects
Downloads
3
Maintainers
Readme
every-own
Like [].every
but for objects.
npm install every-own
const everyOwn = require("every-own")
API
everyOwn(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
false
if anycallback
iteration result returns falsey - Else returns
true
Usage
const everyOwn = require("every-own")
everyOwn({}, value => value > 0) // true
everyOwn({x: 3, y: 3}, value => value > 0) // true
everyOwn({x: -3, y: 3}, value => value > 0) // false
everyOwn({x: 3, y: 3}, (value, key) => key.length === 1) // true
let array = []
everyOwn({x: 3, y: 3}, value => array.push(value)) // true
array.length // 2
array.join("") // "33"