New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

delve

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delve

Delve recursively into a value to retrieve a property; without erroring.

  • 0.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
252
decreased by-15.44%
Maintainers
1
Weekly downloads
 
Created
Source

delve

Delve recursively into a value to retrieve a property; without erroring.

browser support

Why

It sucks to have to do if ( obj && obj.prop && obj.prop.secondProp ) { ... }.

Example

delve

var delve = require('delve')

var o = { x: { y: { z: 'my val' } } }

delve(o, 'x.y')               //= { z: 'my val' }
delve(o, 'x.y.z')             //= 'my val'
delve(o, 'x.y.z.foo')         //= undefined
delve(undefined, 'x.y.z.foo') //= undefined
delve(null, 'x.y.z.foo')      //= undefined
delve('foo', 'length')        //= 3

delve.has

var delve = require('delve')

delve.has({ x: { y: undefined } }, 'x.y') //= true
delve.has('foo', 'length')                //= true
delve.has(null, 'foo')                    //= false
delve.has({ x: { } }, 'x.y')              //= false

For more examples, see tests/delve-test.js.

Install

npm

npm install delve

browser

Download src/delve.js, and include it as a script tag.

AMD/require.js

Download src/delve.js, and require it in:

require(['libs/delve'], function(delve){
  // ... assuming delve is in libs/delve, now it's ready to use
})

Keywords

FAQs

Package last updated on 23 Sep 2013

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc