Socket
Book a DemoInstallSign in
Socket

nestcheck

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestcheck

A small utility to do a deep nest check on an object without throwing a TypeError

latest
Source
npmnpm
Version
0.3.5
Version published
Maintainers
1
Created
Source

NestCheck

npm install nestcheck --save

In code: var nest = require('nestcheck');

##Description

This module is used to run a deep nest check on objects without throwing a TypeError.

Two functions exist. has and get

has returns a boolean value based on if the nest exists.

git returns the nested value if it exists and if not returns undefined.

##has

nest.has(OBJECT, 'string.of.nest.search') //returns true or false.

##get

nest.get(OBJECT, 'string.of.nest.search') //returns nest value or undefined

##IMPORTANT

Do not include base object name in string search.

Ex.

var Obj = {
	nested: { exists: true}
}

RIGHT
--------------
nest.has(Obj, 'nested.exists') //returns true

WRONG
--------------
nest.has(Obj, 'Obj.nested') //will return false

Keywords

Object

FAQs

Package last updated on 02 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts