Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jojoee/object.intersect
:tada: Return intersect object that have same key from a number of objects
https://github.com/jojoee/object.intersect
array-manipulations fast intersect intersection key object property
Last synced: about 2 months ago
JSON representation
:tada: Return intersect object that have same key from a number of objects
- Host: GitHub
- URL: https://github.com/jojoee/object.intersect
- Owner: jojoee
- License: mit
- Created: 2018-01-08T14:21:59.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-17T23:39:50.000Z (over 5 years ago)
- Last Synced: 2024-05-01T14:24:27.628Z (8 months ago)
- Topics: array-manipulations, fast, intersect, intersection, key, object, property
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/object.intersect
- Size: 11.7 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# object.intersect
[![Travis](https://img.shields.io/travis/jojoee/object.intersect.svg)](https://travis-ci.org/jojoee/object.intersect)
[![Dependency Status](https://david-dm.org/jojoee/object.intersect.svg)](https://david-dm.org/jojoee/object.intersect)
[![Codecov](https://img.shields.io/codecov/c/github/jojoee/object.intersect.svg)](https://codecov.io/github/jojoee/object.intersect)
[![Version - npm](https://img.shields.io/npm/v/object.intersect.svg)](https://www.npmjs.com/package/object.intersect)
[![License - npm](https://img.shields.io/npm/l/object.intersect.svg)](http://opensource.org/licenses/MIT)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) [![Greenkeeper badge](https://badges.greenkeeper.io/jojoee/object.intersect.svg)](https://greenkeeper.io/)Fast object.intersect key / PHP `array_intersect_key` with no dependencies
## Installation
```
// npm
npm install object.intersect
const intersect = require('object.intersect')
```## Example usage
```javascript
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
- [PHP: array_intersect_key - Manual](http://php.net/manual/en/function.array-intersect-key.php)