You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

lodash.get

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.get

The lodash method `_.get` exported as a module.


Version published
Weekly downloads
13M
increased by1.8%
Maintainers
3
Install size
26.9 kB
Created
Weekly downloads
 

Package description

What is lodash.get?

The lodash.get package is a method from the Lodash library that allows for safe access to nested object properties. It helps in avoiding errors when querying for deeply nested properties in an object that may or may not exist.

What are lodash.get's main functionalities?

Accessing Nested Object Properties

Safely access nested object properties using a string path.

const object = { 'a': [{ 'b': { 'c': 3 } }] };
const value = _.get(object, 'a[0].b.c');
console.log(value); // => 3

Default Values

Provide a default value if the resolved value is undefined.

const object = { 'a': [{ 'b': { 'c': 3 } }] };
const value = _.get(object, 'a[0].b.d', 'default');
console.log(value); // => 'default'

Accessing Properties with Dynamic Paths

Use an array to specify the path for properties, allowing for dynamic path construction.

const object = { 'a': [{ 'b': { 'c': 3 } }] };
const path = ['a', '0', 'b', 'c'];
const value = _.get(object, path);
console.log(value); // => 3

Other packages similar to lodash.get

Readme

Source

lodash.get v4.4.2

The lodash method _.get exported as a Node.js module.

Installation

Using npm:

$ {sudo -H} npm i -g npm
$ npm i --save lodash.get

In Node.js:

var get = require('lodash.get');

See the documentation or package source for more details.

Keywords

FAQs

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc