Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

v-at

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v-at

Find nested keys in json objects with null / undefined checks.

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
9
-10%
Maintainers
1
Weekly downloads
 
Created
Source

at

Access nested keys in json objects without worrying about undefined / null errors

Install

npm install v-at

Example

var at = require('v-at');

var object = {
  a: 10,
  b: "hello",
  c: [
    {y: 10}, {y: 20}, {y: 30}
  ],
  d: {
    e: 10,
    f: 20
  }
};

var y = at(object, 'c.0.y'); // 10

var f = at(object, 'd.f'); // 20

var undef = at(object, 'z.u.v'); //undefined

Keywords

json

FAQs

Package last updated on 15 Nov 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