Populate a JSON object, save it, change it, send it, validate it, and more
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
package.json
readme.md

readme.md

People

Manage an Object's population.

Installation

npm install people

Usage

var People = require('people');

var target = {};

People.set(target, 'foo/bar/baz', 'boom');

target is now:

{
    foo: {
        bar: {
            baz: 'boom'
        }
    }
}

To get:

People.get(target, 'foo/bar/baz');

Returns boom.

Path format

Default is to use / as a path separator.

If you'd like to use another separator, use separate:

People.separate('.');

People.get(target, 'foo/bar/baz');
// not found

People.get(target, 'foo.bar.baz');
// 'boom'