Returns existence of key or value in an object
$ npm install key-value-exists
const keyValueExists = require('key-value-exists');
keyValueExists({foo: true, bar: {baz: {foobaz: true}}, foobar: {barbaz: true}}, 'foo');
//=> true
keyValueExists({foo: true, bar: {baz: {foobaz: true}}, foobar: {barbaz: true}}, 'zoo');
//=> false
keyValueExists({foo: true, bar: {baz: {foobaz: true}}, foobar: {barbaz: true}}, 'foobaz', {deep: true});
//=> true
keyValueExists({foo: true, bar: {baz: {foobaz: true}}, foobar: {barbaz: true}}, {foobaz: true}, {deep: true});
//=> true
keyValueExists({foo: true, bar: {baz: {foobaz: true}}, foobar: {barbaz: true}}, {foobaz: false}, {deep: true});
//=> false
Type: object
Source object to traverse
Type: any
Value to be searched
Type: object
Type: boolean
Default: false
Recurse nested objects and objects in arrays