Find all instances of a specified key within a given object
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.jshintrc
.npmignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

Deep has Build Status

Find all instances of a specified key within a given object.

usage

With code such as:

var has = require('deep-has');

var obj = {
    foo: {
        bar: '123'
    },
    bar: false
};

var x = has(obj, 'bar');

x would be:

[
    { 'bar': false },
    { 'foo.bar': '123' }
]

The tests also provide further insight.