Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object-get

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-get

Access nested property values at any depth with a simple expression.

  • 2.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
230K
increased by51.49%
Maintainers
2
Weekly downloads
 
Created
Source

view on npm npm module downloads Build Status Dependency Status js-standard-style

object-get

Access nested property values at any depth with a simple expression.

Example

const objectGet = require('object-get')

const colour = objectGet(mammal, 'fur.appearance.colour')

Helps avoid long logical expressions like:

const colour = mammal && mammal.fur && mammal.fur.appearance && mammal.fur.appearance.colour

objectGet(object, expression) ⇒ *

Returns the value at the given property.

Kind: Exported function

ParamTypeDescription
objectobjectthe input object
expressionstringthe property accessor expression

Example

> objectGet({ animal: 'cow' }, 'animal')
'cow'

> objectGet({ animal: { mood: 'lazy' } }, 'animal')
{ mood: 'lazy' }

> objectGet({ animal: { mood: 'lazy' } }, 'animal.mood')
'lazy'

> objectGet({ animal: { mood: 'lazy' } }, 'animal.email')
undefined

© 2015-16 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.

FAQs

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

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