Install
npm install jsonselect;
Usage
select(obj, options)
Options:
only
: string|array - List of whitespace delimited paths (returned object will only contain those paths)except
: string|array - List of whitespace delimited paths (returned object will not contain those paths)
Options can also be a string. See examples.
Paths can be (almost) any JSONPath.
Examples
var select = ; var a = ;// equivalent tovar a2 = ; var b = ; // everything except password// equivalent tovar b2 = ;
Using with Mongoose
Coming soon!
TODO
- better parser for normalized paths
- properly delete array element using splice/concat