1.0.8 • Published 7 years ago
@kingjs/descriptor.nested.scorch v1.0.8
@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
): voidInterfaces
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.freezeLicense
MIT