2.5.0 • Published 5 years ago
has-key-deep v2.5.0
hasKeyDeep
Deep-search objects for keys. Keys can be searched by providing an array of keys, or using a dot-notiation.
Examples
Complete application
hasKeyDeep({ a: { b: { c: 1 } } }, 'a.b.c') => true
hasKeyDeep({ a: { b: { c: 1 } } }, ['a', 'b', 'c']) => true
hasKeyDeep({ a: { b: { c: 1 } } }, 'a.b.c.d') => true
hasKeyDeep({ a: { b: { c: 1 } } }, 'a.c') => false
hasKeyDeep({}, 'a') => false
Partial application
var hasABC = hasKeyDeep('a.b.c');
hasAbc({a: { b: { c: 1 } } }) => true
hasAbc({a: 1 }) => false