kingjs/descriptor.nested.scorch
@Clears a tree of descriptor properties with undefined
value.
Usage
Scorch a tree of descriptors like this:
'use strict';
var scorch = require('@kingjs/descriptor.nested.scorch');
var values = {
alice: {
pet: { name: 'tiger' }
},
bob: {
pet: { name: undefined }
},
}
scorch(values, {
'*': { pet: null }
});
values;
result:
{
alice: {
pet: { name: 'tiger' }
},
bob: {
pet: { }
},
}
API
declare function scorch(
tree: NestedDescriptor,
paths: NestedDescriptor
): void
Interfaces
-
NestedDescriptor
: see @kingjs/descriptor/nested
Parameters
-
tree
: The tree whose nodes will be purged of properties with undefined value. -
paths
: The paths of the tree to purged of properties with undefined value.
Install
With npm installed, run
$ npm install @kingjs/descriptor.nested.freeze
License
MIT