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

pathval

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

pathval

Object value retrieval given a string path

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is pathval?

The pathval npm package is a utility for working with object paths. It allows you to get and set values on an object using a string path, which is useful for accessing deeply nested properties.

What are pathval's main functionalities?

Get value from object

This feature allows you to retrieve a value from a nested object using a string path.

{"const pathval = require('pathval');
const obj = { a: { b: { c: 'd' } } };
const value = pathval.get(obj, 'a.b.c');
console.log(value); // Output: 'd'"}

Set value on object

This feature allows you to set a value on a nested object using a string path, creating any necessary sub-objects along the path.

{"const pathval = require('pathval');
const obj = {};
pathval.set(obj, 'a.b.c', 'd');
console.log(obj); // Output: { a: { b: { c: 'd' } } }"}

Other packages similar to pathval

Keywords

FAQs

Package last updated on 21 Jul 2023

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