@kingjs/descriptor.nested.scorch

1.0.8 • Public • Published

@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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.8
    0
    • latest

Version History

Package Sidebar

Install

npm i @kingjs/descriptor.nested.scorch

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

3.35 kB

Total Files

4

Last publish

Collaborators

  • kingces95