A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/sharpred/deepHas below:

sharpred/deepHas: test for existence of nested object key and optionally return that key

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4