clearkeys

0.1.0 • Public • Published

clearkeys

clear keys for object and its child nodes

Install

for node

$ npm install clearkeys --save

for browser

$ cortex install clearkeys --save

Usage

var origin = {
  "a": 1,
  "b": [],
  "c": [],
  "d": {}
};
origin.c.push({"b":origin,"d":2});
origin.c.push({"b":origin,"d":3});
origin.d.b = origin;
origin.d.e = 4;
var obj = clearkeys(origin, ["a","b"]);
// now obj will be {"c":[{"d":2},{"d":3}],"d":{"e":4}}

Todo

  • able to custom filters, for example, to clear keys whose value is a function.

Readme

Keywords

Package Sidebar

Install

npm i clearkeys

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • spud