Skip to content

sethvincent/observify-keypath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

observify-keypath

get/set observify values using dot-notation keypaths

Install

npm install --save observify-keypath

Example

var keypath = require('observify-keypath');

var data = observify({
  nested: {
    obj: {
      arr: [{ cool: 'pizza' }]
    }
  }
});

// get a value
var value = keypath.get(data, 'nested.obj.arr.0.cool');

// set a value
keypath.set(data, 'nested.obj.arr.0.cool', 'awesome');

Usage

var keypath = require('observify-keypath');

Methods

keypath.get(data, keypath);

data is the observify object.

keypath is the path of keys specified using dot notation.

keypath.set(data, keypath, value);

data is that observify object.

keypath is the path of keys specified using dot notation.

value is what you will set the value to.

License

MIT

About

get/set observify values using dot-notation keypaths

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published