Like [].every
but for objects.
npm install every-own
const everyOwn = require("every-own")
object
is the object to iteratecallback
receives(value, key, object)
scope
is thethis
context used to.call
callback
- Breaks from the loop and returns
false
if anycallback
iteration result returns falsey - Else returns
true
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"