Package Exports
- object-visit
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 (object-visit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
object-visit 
Call the given method on each value in the given object.
Install
Install with npm
$ npm i object-visit --save
Usage
var visit = require('object-visit');
var ctx = {
data: {},
set: function (key, value) {
if (typeof key === 'object') {
visit(ctx, 'set', key);
} else {
ctx.data[key] = value;
}
}
};
ctx.set('a', 'a');
ctx.set('b', 'b');
ctx.set('c', 'c');
ctx.set({d: {e: 'f'}});
console.log(ctx.data);
//=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }};
Related projects
- collection-visit: Visit a method over the items in an object, or map visit over the objects… more | homepage
- map-visit: Map
visit
over an array of objects. | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 29, 2015.