deephas
v1.0.7
Published
get, set or test for a value in a javascript object
Downloads
4,508
Readme
deepHas
test for existence of nested object key and optionally return that key
##Installation npm install deephas
or just drop deepHas.js into your project.
##Usage
dh = require("deepHas");\n
var obj = {"some": {"nested": {"property":""your value here"}}};
dh.has(obj, 'some.nested.property')
Returns true or false if 'some.nested.property' exists or not.
dh.get(obj, 'some.nested.property')
Returns the value or undefined if it does not exist.
dh.set(obj, 'some.nested.newproperty', "your value here")
Adds a new property or object.