every-own

Like [].every but for objects


Keywords
javascript, iteration, iterate, utility, for-own, object, every, own, opensource
License
CC0-1.0
Install
npm install every-own@1.0.0

Documentation

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 iterate
  • callback receives (value, key, object)
  • scope is the this context used to .call callback

@return boolean

  • Breaks from the loop and returns false if any callback 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"