has-id
v1.1.0
Published
Helper to check if an object has as an id
Downloads
7
Readme
has-id
Utility for finding or filtering in array.
Install
$ npm install --save has-id
Usage
import hasId from "has-id"
const collection = [{ id: 123 }, { id: 321 }, { id: 213 }]
const someId = 123
const result = collection.find(hasId(someId))
// same as
const result2 = collection.find(item => item.id === someId)