JSPM

deep-setter

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 75
  • Score
    100M100P100Q68690F
  • License UNLICENSED

sets a value deep in an object

Package Exports

  • deep-setter
  • deep-setter/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deep-setter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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' }} } } );