JSPM

nested-keys

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 326
  • Score
    100M100P100Q122288F
  • License MIT

CRUD nested keys on JavaScript object.

Package Exports

  • nested-keys

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 (nested-keys) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nest_keys

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.