1.0.8 • Published 6 years ago

@kingjs/descriptor.nested.scorch v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

@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

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

Analytics