Skip to content

17zuoye/nested-keys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nested-keys

Build Status

CRUD nested keys on JavaScript object.

Example

var NestedKeys = require('nested-keys');

var obj = {
    "key_string" : "val_string",
    "key_array"  : ["value_array_first"],
    "key_object_1" : {
        "foo" : "bar",
        "key_object_2" : {
            "foo" : "bar",
        }
    }
};


// get.API
NestedKeys.get(obj, ["key_string"]) // "val_string"
NestedKeys.get(obj, ["key_object_1", "foo"]) // "bar"
NestedKeys.get(obj, ["key_array", 0]) // "value_array_first", so does Array index.

// del.API
NestedKeys.del(obj, "key_string") // true
NestedKeys.del(obj, "not_exist") // false


// set.API
// exists.API
// Just as you expected.

See more in test cases.

INSTALL

npm install nested-keys -g --verbose

License

MIT. David Chen @ 17zuoye.

About

CRUD nested keys on JavaScript object.

Resources

License

Stars

Watchers

Forks

Packages

No packages published