vladgolubev / missing-deep-keys

:thought_balloon: Tells you what keys from first object are missing in second

Home Page:https://www.npmjs.com/missing-deep-keys

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing Deep Keys

Tells you what keys from one object are missing in another

npm Build Status Coverage Status David Known Vulnerabilities npm

Install

Ensure you have Node.js version 4 or higher installed. Then run the following:

$ npm install missing-deep-keys --save

Usage

const missingDeepKeys = require('missing-deep-keys');

const o1 = {a: {b: 2}}; // Base object
const o2 = {c: 1}; // Comparison object

const 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.

  • Be the first one!

License

MIT © Vlad Holubiev

About

:thought_balloon: Tells you what keys from first object are missing in second

https://www.npmjs.com/missing-deep-keys


Languages

Language:JavaScript 100.0%