Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vladholubiev/missing-deep-keys
:thought_balloon: Tells you what keys from first object are missing in second
https://github.com/vladholubiev/missing-deep-keys
npm-package
Last synced: 2 months ago
JSON representation
:thought_balloon: Tells you what keys from first object are missing in second
- Host: GitHub
- URL: https://github.com/vladholubiev/missing-deep-keys
- Owner: vladholubiev
- Created: 2016-06-26T00:18:24.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-19T15:28:34.000Z (over 4 years ago)
- Last Synced: 2024-04-22T15:09:51.320Z (2 months ago)
- Topics: npm-package
- Language: JavaScript
- Homepage: https://www.npmjs.com/missing-deep-keys
- Size: 41 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Lists
- awesome-micro-npm-packages - missing-deep-keys - Returns an array of keys from first object that are missing in second. (Modules / Object)
README
# Missing Deep Keys
> Tells you what keys from one object are missing in another
[![npm](https://img.shields.io/npm/v/missing-deep-keys.svg?maxAge=2592000)](https://www.npmjs.com/package/missing-deep-keys)
[![Build Status](https://travis-ci.org/vladgolubev/missing-deep-keys.svg?branch=master)](https://travis-ci.org/vladgolubev/missing-deep-keys)
[![Coverage Status](https://coveralls.io/repos/github/vladgolubev/missing-deep-keys/badge.svg?branch=master)](https://coveralls.io/github/vladgolubev/missing-deep-keys?branch=master)
[![David](https://img.shields.io/david/vladgolubev/missing-deep-keys.svg?maxAge=2592000)](https://github.com/vladgolubev/missing-deep-keys)
[![Known Vulnerabilities](https://snyk.io/test/npm/missing-deep-keys/badge.svg)](https://snyk.io/test/npm/missing-deep-keys)
[![npm](https://img.shields.io/npm/dm/missing-deep-keys.svg?maxAge=2592000)](https://github.com/vladgolubev/missing-deep-keys)## Install
Ensure you have [Node.js](https://nodejs.org) version 4 or higher installed. Then run the following:
```
$ npm install missing-deep-keys --save
```## Usage
```javascript
const missingDeepKeys = require('missing-deep-keys');const o1 = {a: {b: 2}}; // Base object
const o2 = {c: 1}; // Comparison objectconst result = missingDeepKeys(o1, o2);
// Prints keys present in o1 but missing in o2
console.log(result); // => ['a.b']// Additionally include a parent object if its children are missing
const result2 = missingDeepKeys(o1, o2, true);
console.log(result2); // => ['a', 'a.b']
```## API
### missingDeepKeys(o1, o2, [showIntermediate])
Returns an array of keys present in o1 but missing in o2
| o1, o2 | showIntermediate |
| -------------- | ------------------ |
| Object (`{}`) | Boolean (`false`) |## Tests
```
$ npm run test
```## Where is this library used?
If you are using this library in one of your projects, add it in this list. :sparkles:* *Be the first one!*
## License
MIT © [Vlad Holubiev](https://github.com/vladgolubev)