Socket
Socket
Sign inDemoInstall

segmented-property

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    segmented-property

A utility for immutably setting and getting properties on JavaScript objects as slash-delimited paths.


Version published
Weekly downloads
3.1K
decreased by-35.25%
Maintainers
1
Install size
29.7 kB
Created
Weekly downloads
 

Readme

Source

segmented-property

A utility for immutably setting and getting properties on JavaScript objects as slash-delimited paths.

npm install segmented-property

npm version

Usage

import {get, set} from 'segmented-property'

const obj1 = {foo: {bar: 1}}
const obj2 = set(obj1, 'foo/bar', 2)

console.log(get(obj1, 'foo/bar')) // 1
console.log(get(obj2, 'foo/bar')) // 2

API

get(source, [key])

Gets a value.

set(source, [key], value)

Sets a new value and returns a new object.

FAQs

Last updated on 27 Oct 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc