Socket
Socket
Sign inDemoInstall

nested-property

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nested-property

Read, write or test a data structure's nested property via a string like 'my.nested.property'. It works through arrays and objects.'


Version published
Weekly downloads
112K
decreased by-3.55%
Maintainers
1
Weekly downloads
 
Created

What is nested-property?

The nested-property npm package allows you to easily get, set, and check properties within deeply nested objects. This can be particularly useful when dealing with complex data structures where accessing or modifying deeply nested properties would otherwise require verbose and error-prone code.

What are nested-property's main functionalities?

Get a nested property

This feature allows you to retrieve the value of a deeply nested property within an object using a dot-separated string path.

const nestedProperty = require('nested-property');
const obj = { a: { b: { c: 42 } } };
const value = nestedProperty.get(obj, 'a.b.c');
console.log(value); // 42

Set a nested property

This feature allows you to set the value of a deeply nested property within an object using a dot-separated string path.

const nestedProperty = require('nested-property');
const obj = { a: { b: { c: 42 } } };
nestedProperty.set(obj, 'a.b.c', 100);
console.log(obj.a.b.c); // 100

Check if a nested property exists

This feature allows you to check if a deeply nested property exists within an object using a dot-separated string path.

const nestedProperty = require('nested-property');
const obj = { a: { b: { c: 42 } } };
const exists = nestedProperty.has(obj, 'a.b.c');
console.log(exists); // true

Other packages similar to nested-property

Keywords

FAQs

Package last updated on 27 Sep 2020

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