New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

optional-value

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

optional-value

Get optional value from deep nested object, array

latest
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

optional-value

optional-value finds out a value from nested object or array.

Install

# yarn
$ yarn add optional-value
# npm
$ npm install optional-value

Usage

import o from 'optional-value'

const someObject = {
  foo: {
    bar: 'hoge'
  }
}
const value = o(someObject, 'foo.bar')
// => hoge
const noneValue = o(someObject, 'foo.boo')
// => null
const obj = o(someObject, 'foo')
// => {bar: 'hoge'}

FAQs

Package last updated on 24 Nov 2017

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