Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

deep-setter

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Issues
File Explorer

Advanced tools

deep-setter

sets a value deep in an object

    1.0.1latest

Version published
Maintainers
1
Yearly downloads
70,172
increased by162.17%

Weekly downloads

Readme

Source

deep-setter

sets a value deep in an object

npm version dependencies Build Status Pledge To Arupex!

#Install

npm install deep-setter --save

#Usage

var setter = require('deep-setter'); //setter is a function that takes (originObject, deepValueAnnotation, value)

If You:

setter({}, 'an.[@1].arbitrary.[@0].address', 'value')

Result:

{ an : [, { arbitrary : [ { address : 'value'} ] } ] } );

If You:

setter({}, 'an.1.arbitrary.0.address', 'value')

Result:

{ an : { 1 : { arbitrary : { 0 : { address : 'value'} } } } } );

If You:

setter({}, 'an.arbitrary.address', { test : 'value'})

Result:

{ an : { arbitrary : { address : { test : 'value' }} } } );

Keywords

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc