Skip to content

azer/set-object-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

set-object-path

Set given (deep) object path

See also: get-object-path, change-object

Install

$ npm install azer/set-object-path

Usage

var set = require('set-object-path')
var data = {
  title: 'My Products',
  products: {
    eggs: [{ kind: 'white', amount: 300 }, { kind: 'brown', amount: 200 }]
  }
}

set(data, 'products.eggs[0].amount', 200)
data.products.eggs[0].amount
// => 200

About

Set given (deep) object path

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published