some-own

1.0.0 • Public • Published

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

@return boolean

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

Package Sidebar

Install

npm i some-own

Weekly Downloads

0

Version

1.0.0

License

CC0-1.0

Last publish

Collaborators

  • ryanve