object.intersect

v0.0.3
Return intersect object that have same key from a number of objects
intersect intersection array_intersect_key object fast property key

object.intersect

Travis Dependency Status Codecov Version - npm License - npm semantic-release

Fast object.intersect key / PHP array_intersect_key with no dependencies

Installation

// npm
npm install object.intersect
const intersect = require('object.intersect')

Example usage

intersect() // {}
intersect({}) // {}
intersect(null) // {}
intersect(undefined) // {}

const obj1 = { a: 'a', b: 'b', c: 'c' }
const obj2 = { a: 'a', b: 'x', c: 'c' }
const obj3 = { a: 'a', c: 'c' } // subset of obj
intersect(obj1, obj2) // { a: 'a', b: 'b', c: 'c' }
intersect(obj1, obj3, obj2) // { a: 'a', c: 'c' }

Reference

npm i object.intersect

Metadata

  • MIT
  • Whatever
  • Nathachai Thongniran
  • released 1/9/2018

Downloads

Maintainers