open-index/open-npm huggingface dataset:
npm package: @kingjs/descriptor
Description: Exports all `@kingjs/descriptor.*` functionality in one package.
Author: Chris King
Latest version: 1.0.16

# @[kingjs](https://www.npmjs.com/package/kingjs)/descriptor
Exports all `@kingjs/descriptor.*` functionality in one package.
## Usage
```js
var descriptor = require('@kingjs/descriptor');
```
## Interfaces
A `descriptor` is an object or array literal or [`Dictionary`][dictionary] with only enumerable properties.
```ts
declare interface Descriptor {
  [index: string | number]: any
}
```
## Namespaces
- [`family`][family]
- [`nested`][nested]
- [`object`][object]

## Packages
These packages all take a descriptor as `this` and will clone on write if they need to change a property value.

- [`filter`][filter]
- [`inherit`][inherit]
- [`keys`][keys]
- [`merge`][merge]
- [`nested`][nested]
- [`normalize`][normalize]
- [`reduce`][reduce]
- [`remove`][remove]
- [`scorch`][scorch]
- [`update`][update]
- [`write`][write]


## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor)

  [dictionary]: https://www.npmjs.com/package/@kingjs/dictionary

  [family]: https://www.npmjs.com/package/@kingjs/descriptor.family
  [nested]: https://www.npmjs.com/package/@kingjs/descriptor.nested
  [object]: https://www.npmjs.com/package/@kingjs/descriptor.object
  
  [filter]: https://www.npmjs.com/package/@kingjs/descriptor.filter
  [inherit]: https://www.npmjs.com/package/@kingjs/descriptor.inherit
  [merge]: https://www.npmjs.com/package/@kingjs/descriptor.merge
  [normalize]: https://www.npmjs.com/package/@kingjs/descriptor.normalize
  [reduce]: https://www.npmjs.com/package/@kingjs/descriptor.reduce
  [remove]: https://www.npmjs.com/package/@kingjs/descriptor.remove
  [scorch]: https://www.npmjs.com/package/@kingjs/descriptor.scorch
  [update]: https://www.npmjs.com/package/@kingjs/descriptor.update
  [write]: https://www.npmjs.com/package/@kingjs/descriptor.write
npm package: @kingjs/descriptor.clear
Description: Returns a descriptor with a named property removed.
Author: Chris King
Latest version: 1.0.2
Deprecated: see @kingjs/descriptor.remove

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).clear
Returns a descriptor with a named property removed.
## Usage
Remove the property 'x' like this:
```js
var clear = require('@kingjs/descriptor.clear');

var descriptor = { x:0 };
clear.call(descriptor, 'x');
```
result:
```js
{ }
```
## API
```ts
declare function clear(
  this: Descriptor,
  name: string
): Descriptor
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `this`: The descriptor from which property 'name' will be removed.
- `name`: The name of the property to be removed.
### Returns
Returns a descriptor with property `name` removed. A copy is returned if the descriptor has an inherited property `name` or the descriptor is frozen.  
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.clear
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/clear)


  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.clone
Description: Returns a mutable clone of a descriptor.
Author: Chris King
Latest version: 1.0.1
Deprecated: see @kingjs/descriptor.object.clone

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).clone
Returns a mutable clone of a descriptor.
## Usage
```js
var clone = require('@kingjs/descriptor.clone');
var target = { x:0 };
clone.call(target);
```
result:
```js
{ x:0 }
```
## API
```ts
declare function clone(
  this: Descriptor
): any
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `this`: The descriptor to clone.
### Returns
Returns a mutable clone of the descriptor.
## Remarks
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.clone
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/clone)


  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.create
Description: Creates a descriptor.
Author: Chris King
Latest version: 1.0.8

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).create
Returns a descriptor given a primitive value.
## Usage
```js
var create = require('@kingjs/descriptor.create');

var people = {
  alice: { name: 'Alice', age: 21 },
  bob: 'Bob'
}

for (var name in people)
  people[name] = create(people[name], 'name');

people;
```
result:
```js
{
  alice: { name: 'Alice', age: 21 },
  bob: { name: 'Bob' }
}
```
## API
```ts
declare function create(
  value,
  action: string | (value) => Descriptor
): Descriptor
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `value`: The value to create into a descriptor.
- `action`: The name of the property to hold `value` or a function that accepts `value` and returns a descriptor. 
### Returns
Returns `value` if already a descriptor, else a normalized descriptor for value.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.create
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/create)

  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.family.transform
Description: Returns a new descriptor family whose descriptors have been transformed by a callback.
Author: Chris King
Latest version: 1.0.8

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[family](https://www.npmjs.com/package/@kingjs/family).map
## Usage
```js
var map = require('@kingjs/descriptor.family.map');
```
result:
```js
```
## API
```ts
```
### Interfaces
### Parameters
### Returns
## Remarks
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.family.map
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/family/map)
npm package: @kingjs/descriptor.filter
Description: Filters and renames properties.
Author: Chris King
Latest version: 1.0.6

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).filter
Filters and renames properties.
## Usage
Create a new descriptor and the copy values in properties `$alpha`, `$bravo`, and `$delta` from an existing descriptor into properties with names `alpha`, `bravo`, and `delta` like this:
```js
var filter = require('@kingjs/descriptor.filter');

filter.call({
  $alpha: 0,
  $bravo: 1,
  $delta: 2,
  value: 3
}, {
  $alpha: 'alpha',
  $bravo: 'bravo',
  $delta: 'delta'
});
```
result:
```js
{
  alpha: 0,
  bravo: 1,
  delta: 2
}
```
The same result can also be achieved procedurally like this:
```js
var filter = require('@kingjs/descriptor.filter');

filter.call({
  $alpha: 0,
  $bravo: 1,
  $delta: 2,
  value: 3
}, function(name) {
  if (name == 'value')
    return undefined;
  
  return name.substr(1);
});
```
result:
```js
{
  alpha: 0,
  bravo: 1,
  delta: 2
}
```
## API
```ts
declare function filter(
  this: Descriptor,
  source: Descriptor,
  map: { 
    [index: string]: string | number, 
    [index: number]: string | number 
  } | { 
    (name: string): string | number
  },
  thisArgs?
): Descriptor
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `this`: The descriptor whose renamed properties will be copied to a new descriptor.
- `map`: Either 
  - A descriptor containing a mapping of property names on `this` to names on the new descriptor. Properties on `this` not included in `map` will not be copied.
  - A callback which maps names on `this` to names on the new descriptor. If the callback returns `undefined` then the property value is not copied.
- `thisArg`: The `this` argument to pass to `map` should `map` be a function.
### Returns
A new descriptor with a copy of a subset of properties from `this` but with different property names according to `map` or `null` if no properties were copied.
## Remarks
No check is made to ensure mapped names are unique. Behavior is undefined when if duplicate names are provided.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.filter
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/filter)


  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.freeze
Description: Freezes a descriptor.
Author: Chris King
Latest version: 1.0.1
Deprecated: see @kingjs/descriptor.object.freeze

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).freeze
Freezes a descriptor.
## Usage
See [`write`][write].
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
### Returns
## Remarks
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.freeze
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/freeze)

  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
  [write]: https://www.npmjs.com/package/@kingjs/descriptor.write
npm package: @kingjs/descriptor.inherit
Description: Copy properties from set of objects which are not present on this.
Author: Chris King
Latest version: 1.0.5

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).inherit
Copy properties from set of objects which are not present on this.
## Usage
Assign default student teacher properties for Alice like this:
```js
var inherit = require('@kingjs/descriptor.inherit');

var student = { name: '', ssn: '000-00-0000', credits: 0 };
var teacher = { name: '', ssn: '000-00-0000', pay: 0 };
var alice = { name: 'Alice' };

inherit.call(alice, student, teacher);
```
result:
```js
{
  name: 'Alice',
  ssn: '00-000-0000',
  credits: 0,
  pay: 0,
}
```
## API
```ts
declare function inherit(
  this: any,
  bases: any[]
): any
```
### Parameters
- `this`: Object onto which inherited properties are copied.
- `bases`: An array of objects whose properties will be copied to `this`.
### Returns
Returns `this` after copying properties from `bases`.
## Remarks
Throws if inherited properties that share the same name do not also have the same value.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.inherit
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/inherit)

  [xxx]: https://www.npmjs.com/package/@kingjs/descriptor/inherit
npm package: @kingjs/descriptor.is-frozen
Description: Test if a descriptor is frozen.
Author: Chris King
Latest version: 1.0.1
Deprecated: see @kingjs/descriptor.object.is-frozen

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).is-frozen
Test if a descriptor is frozen.
## Usage
See [`write`][write].
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
### Returns
## Remarks
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.is-frozen
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/is-frozen)

  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
  [write]: https://www.npmjs.com/package/@kingjs/descriptor.write
npm package: @kingjs/descriptor.keys
Description: Returns an array of own and inherited enumerable property names. ## Usage ```js var keys = require('@kingjs/descriptor.keys');
Author: Chris King
Latest version: 1.0.0
Deprecated: see @kingjs/descriptor.object.keys

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).keys
Returns an array of own and inherited enumerable property names.
## Usage
```js
var keys = require('@kingjs/descriptor.keys');

var base = { inherited: null };
var derived = Object.create(base);
derived.own = null;

var result = keys.call(derived);
result.sort();
result;
```
result:
```js
[ 'inherited', 'own' ]
```
## API
```ts
declare function keys(
  this: Descriptor
): any
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `this`: The descriptor whose own and inherited property names will be returned.
### Returns
Returns an array containing the own and inherited enumerable property names of `this`.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.keys
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/keys)

  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.map
Description: Maps descriptor property values.
Author: Chris King
Latest version: 1.0.9

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).map
Maps descriptor property values.
## Usage
Map a properties using a variety of declarations like this:
```js
var map = require('@kingjs/descriptor.map');
var write = require('@kingjs/descriptor.write');

var result = map.call({
  inflateMe: function $(arg, key, path) { return arg; },
  squareMe: 3,
  scorchMe: { foo: undefined },
  writeMe: 'Hello World'  
}, {
  inflate: { inflateMe: null },
  thunks: { squareMe: (value, arg, key) => value * value },
  scorch: { },
  callback: (descriptor, arg) =>
    write.call(descriptor, 'writeMe', descriptor.writeMe + '!')
}, 'myArg');
```
result:
```js
{
  inflateMe: 'myArg',
  squareMe: 9,
  scorchMe: { },
  writeMe: 'Hello World!'
}
```
## API
```ts
declare function map(
  this: Descriptor,
  action: (value, arg, key) => Descriptor | {
    inflate?: DescriptorTree | (arg, key, path) => Descriptor,
    thunks?: DescriptorTree | (value, arg, key) => Descriptor,
    scorch?: DescriptorTree,
    callback?: (descriptor, arg) => Descriptor
  },
  arg: any
): Descriptor
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `this`: The `Descriptor` whose property values will be mapped.
- `action`: The callback which maps property values.
### Returns
A descriptor with mapped property values.
### Remarks
Inflate will only invoke functions named `$`.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.map
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/map)

  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.map-names
Description: Creates a descriptor with a copy of a subset of properties from an existing descriptor with different names.
Author: Chris King
Latest version: 1.0.6
Deprecated: see @kingjs/descriptor.filter

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).map-names
Creates a descriptor with a copy of a subset of properties from an existing descriptor with property names.
## Usage
Create a new descriptor and the copy values in properties `$alpha`, `$bravo`, and `$delta` from an existing descriptor into properties with names `alpha`, `bravo`, and `delta` like this:
```js
var mapNames = require('@kingjs/descriptor.map-names');

mapNames.call({
  $alpha: 0,
  $bravo: 1,
  $delta: 2,
  value: 3
}, {
  $alpha: 'alpha',
  $bravo: 'bravo',
  $delta: 'delta'
});
```
result:
```js
{
  alpha: 0,
  bravo: 1,
  delta: 2
}
```
The same result can also be achieved procedurally like this:
```js
var mapNames = require('@kingjs/descriptor.map-names');

mapNames.call({
  $alpha: 0,
  $bravo: 1,
  $delta: 2,
  value: 3
}, function(name) {
  if (name == 'value')
    return undefined;
  
  return name.substr(1);
});
```
result:
```js
{
  alpha: 0,
  bravo: 1,
  delta: 2
}
```
## API
```ts
declare function mapNames(
  this: Descriptor,
  source: Descriptor,
  map: { 
    [index: string]: string | number, 
    [index: number]: string | number 
  } | { 
    (name: string): string | number
  }
): Descriptor
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `this`: The descriptor whose renamed properties will be copied to a new descriptor.
- `map`: Either 
  - A descriptor containing a mapping of property names on `this` to names on the new descriptor. Properties on `this` not included in `map` will not be copied.
  - A callback which maps names on `this` to names on the new descriptor. If the callback returns `undefined` then the property value is not copied.
### Returns
A new descriptor with a copy of a subset of properties from `this` but with different property names according to `map` or `null` if no properties were copied.
## Remarks
No check is made to ensure mapped names are unique. Behavior is undefined when if duplicate names are provided.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.map-names
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/map-names)


  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.merge
Description: Merges descriptor property values into `this` from `delta` using a callback to resolve conflicts.
Author: Chris King
Latest version: 1.0.10

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).merge
Merges descriptor property values into `this` from `delta` using a callback to resolve conflicts.
## Usage
Copy properties from `source` to `target` overwriting any existing values like this:
```js
var merge = require('@kingjs/descriptor.merge');

var target = { 
  a: 0,
  b: 1, 
};

var source = { 
  b: 2,
  c: 3
};

function resolve(right, left) { 
  return right; 
}

merge.call(target, source, resolve); 

target;
```
result:
```js
{
  a: 0,
  b: 2,
  c: 3
}
```
## API
```ts
declare function merge(
  this: Descriptor, 
  delta?: Descriptor, 
  resolve?: (this, left, right, name: string) => any,
  thisArg?
): any
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `this`: An object into which properties are merged.
- `delta`: An object whose properties are merged into `this`.
- `resolve`: Invoked when merging into an existing value. Returns the merged value. If not supplied, then the existing value is taken.
  - `left`: The existing value.
  - `right`: The new value.
  - `name`: The name of the conflicting property.
- `thisArg`: The `this` argument to pass to `callback`.write and returned instead of `this`.
### Returns
Returns `this` after merging properties from `delta`. 
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.merge
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/merge)

  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.merge-wildcards
Description: If a descriptor contains a property named `'*'`, then replace it with new properties with the same value but whose names are found on another descriptor but not on itself.
Author: Chris King
Latest version: 1.0.8
Deprecated: no replacement

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).merge-wildcards
If a descriptor contains a property named `'*'`, then replace it with new properties with the same value but whose names are found on another descriptor but not on itself.
## Usage
Promote Alice by two levels and everyone else by one like this:
```js
var mergeWildcards = require('@kingjs/descriptor.merge-wildcards');

var people = {
  alice: { level: 0 },
  bob: { level: 1 },
  chris: { level: 2 }
}

var promotions = {
  alice: 2,
  '*': 1
}

var specificPromotions = mergeWildcards.call(
  promotions, people
);

for (var name in specificPromotions)
  people[name].level += specificPromotions[name];
```
result:
```js
{
  alice: { level: 2 },
  bob: { level: 2 },
  chris: { level: 3 }
}
```
## API
```ts
declare function mergeWildcards(
  this: Descriptor,
  other: Descriptor
): Descriptor
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
### Parameters
- `this`: The descriptor whose wildcard property `*` is expanded.
- `other`: The descriptor whose names not present on `this` become the property names of the wildcard expansion.
### Returns
Returns `this` with it's wildcard property `*` replaced with copies whose names are found on `other` but not on `this`.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.merge-wildcards
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/merge-wildcards)

  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
npm package: @kingjs/descriptor.named
Description: Exports all `@kingjs/descriptor.named.*` functionality in one package.
Author: Chris King
Latest version: 1.0.0

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).named
Exports all `@kingjs/descriptor.named.*` functionality in one package.
## Usage
```js
var named = require('@kingjs/descriptor.named');
```
## Interfaces
```ts
declare interface DescriptorNamed {
  [index: string]: Descriptor
}
```
## API
- [`create`][create]
- [`load`][load]
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.named
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor)

  [create]: https://www.npmjs.com/package/@kingjs/descriptor.named.create
  [load]: https://www.npmjs.com/package/@kingjs/descriptor.named.load
npm package: @kingjs/descriptor.named.create
Description: Returns a new descriptor family whose descriptors have been transformed by a callback.
Author: Chris King
Latest version: 1.0.7

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[family](https://www.npmjs.com/package/@kingjs/family).map
## Usage
```js
var map = require('@kingjs/descriptor.family.map');
```
result:
```js
```
## API
```ts
```
### Interfaces
### Parameters
### Returns
## Remarks
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.family.map
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/family/map)
npm package: @kingjs/descriptor.named.load
Description: For each descriptor, replaces properties containing descriptor names the actual descriptor then maps the descriptor.
Author: Chris King
Latest version: 1.0.7

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[named](https://www.npmjs.com/package/@kingjs/descriptor.named).load
For each descriptor, replaces properties containing descriptor names the actual descriptor then maps the descriptor.
## Usage
```js
var load = require('@kingjs/descriptor.named.load');
var write = require('@kingjs/descriptor.write');

var globalId = 0;

var descriptors = load.call({ 
  baz: { baseFunc: 'bar' },
  foo: { baseFunc: null },
  bar: { baseFunc: 'foo' },
}, o => {
  var id = globalId++;
  o = write.call(o, 'id', id);
  o = write.call(o, 'func', function() {
    var result = this.id;
    if (this.baseFunc)
      result += ' -> ' + this.baseFunc();
    return result;
  });
  return o;
}, {
  baseFunc: o => o.func
});

{
  foo: descriptors.foo.func(),
  bar: descriptors.bar.func(),
  baz: descriptors.baz.func(),
}
```
result:
```js
{
  foo: '0',
  bar: '1 -> 0',
  baz: '2 -> 1 -> 0'
}
```
## API
```ts
declare function load(
  this: DescriptorNamed,
  callback?: (this, value: Descriptor, name: string) => Descriptor,
  refs?: DescriptorNamed | (this, name: string) => DescriptorNested,
  thisArg?: any
): DescriptorNamed
```
### Interfaces
- `Descriptor`: see [@kingjs/descriptor][descriptor]
- `DescriptorNamed`: see [@kingjs/descriptor.named][descriptor-named]
- `DescriptorNested`: see [@kingjs/descriptor.nested][descriptor-nested]
### Parameters
- `this`: The named of descriptors with properties to load.
- `callback`: Maps a descriptor after all `refs` have been resolved.
- `refs`: Paths to the properties to load.
  - `descriptor`: Optional selector of a property value in load descriptor.
- `thisArg`: Passed as `this` argument to `callback`.
### Returns
Returns a `DescriptorNamed` whose members have had their references to other members load.
## Remarks
Graph of references must form a poset. 
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.named.load
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/named/load)

  [descriptor]: https://www.npmjs.com/package/@kingjs/descriptor
  [descriptor-named]: https://www.npmjs.com/package/@kingjs/descriptor.named
  [descriptor-nested]: https://www.npmjs.com/package/@kingjs/descriptor.nested
npm package: @kingjs/descriptor.nested
Description: Exports all `@kingjs/descriptor.nested.*` functionality in one package.
Author: Chris King
Latest version: 1.0.8

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).nested
Exports all `@kingjs/descriptor.nested.*` functionality in one package.
## Usage
```js
var nested = require('@kingjs/descriptor.nested');
```
## Interfaces
```ts
declare interface NestedDescriptor {
  [index: string | number]: NestedDescriptor
} | any
```
## Remarks
A `NestedDescriptor` can be though of like 
- a tree composed of nodes and leafs or 
- a collection of paths composed of directories and files.
 
APIs take at least two descriptors. The first, a tree, is the data to be selected, mutated, or merged according to the second, a set of paths, which acts as metatdata to distinguish nodes from leafs in the tree as well as drive the operation.
## Namespace
- [`array`][array]
## API
- [`forEach`][for-each]
- [`freeze`][freeze]
- [`merge`][merge]
- [`reduce`][reduce]
- [`scorch`][scorch]
- [`toArray`][to-array]
- [`toPaths`][to-paths]
- [`update`][update]
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested)

  [array]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array
  [for-each]: https://www.npmjs.com/package/@kingjs/descriptor.nested.for-each
  [freeze]: https://www.npmjs.com/package/@kingjs/descriptor.nested.freeze
  [merge]: https://www.npmjs.com/package/@kingjs/descriptor.nested.merge
  [reduce]: https://www.npmjs.com/package/@kingjs/descriptor.nested.reduce
  [scorch]: https://www.npmjs.com/package/@kingjs/descriptor.nested.scorch
  [to-array]: https://www.npmjs.com/package/@kingjs/descriptor.nested.to-array
  [to-paths]: https://www.npmjs.com/package/@kingjs/descriptor.nested.to-paths
  [update]: https://www.npmjs.com/package/@kingjs/descriptor.nested.update
npm package: @kingjs/descriptor.nested.array
Description: Exports all `@kingjs/descriptor.nested.array.*` functionality in one package.
Author: Chris King
Latest version: 1.0.9

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/kingjs).[nested](https://www.npmjs.com/package/@kingjs/descriptor/nested).array
Exports all `@kingjs/descriptor.nested.array.*` functionality in one package.
## Usage
```js
var nested = require('@kingjs/descriptor.nested.array');
```
## API
- [`forEach`][for-each]
- [`freeze`][freeze]
- [`merge`][merge]
- [`reduce`][reduce]
- [`scorch`][scorch]
- [`toArray`][to-array]
- [`toPaths`][to-paths]
- [`update`][update]
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.array
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/array)

  [for-each]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array.for-each
  [freeze]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array.freeze
  [merge]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array.merge
  [reduce]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array.reduce
  [scorch]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array.scorch
  [to-array]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array.to-array
  [to-paths]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array.to-paths
  [update]: https://www.npmjs.com/package/@kingjs/descriptor.nested.array.update
npm package: @kingjs/descriptor.nested.array.for-each
Description: Invokes a callback on each value of a array tree.
Author: Chris King
Latest version: 1.0.4

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).[array](https://www.npmjs.com/package/@kingjs/descriptor.nested.array).for-each
Invokes a callback on each value of a array tree.
## Usage
Replace the name of the person followed with the object representing the person being followed like this:
```js
var forEach = require('@kingjs/descriptor.nested.array.for-each');

var tree = [['bob'], 'chris', 'alice'];

var result = { };
forEach(
  tree,
  x => result[x] = true
)
```
result:
```js
[
  bob: true,
  chris: true,
  alice: true
]
```
## API
```ts
declare function forEach(
  tree: NestedDescriptor,
  callback: (value) => any,
  thisArg?
)
```
### Interfaces
- `NestedArray`: see [@kingjs/descriptor/nested/array][nested-array-descriptor]
- `NestedDescriptor`: see [@kingjs/descriptor][nested-descriptor]
### Parameters
- `tree`: The array tree whose values are going to be updated.
- `callback`: Used to update values of `tree`:
  - `value`: The current value.
- `thisArg`: The `this` argument to pass to `callback`.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.array.for-each
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/array/for-each)

[nested-array-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested/array  
[nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.array.freeze
Description: Freezes an array tree and it's values.
Author: Chris King
Latest version: 1.0.7

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).[array](https://www.npmjs.com/package/@kingjs/descriptor.nested.array).to-array
Freezes an array tree and it's values.
## Usage
Freeze a array tree of descriptors like this:
```js
'use strict';

var freeze = require('@kingjs/descriptor.nested.array.freeze');

var values = [
  {},
  [{}],
  0
]

freeze(values);
```
result:
```js
[
  {},
  [{}],
  0
]
```
## API
```ts
declare function freeze(
  tree: NestedDescriptor,
): void
```
### Interfaces
- `NestedArray`: see [@kingjs/descriptor/nested/array][nested-array-descriptor]
- `NestedDescriptor`: see [@kingjs/descriptor/nested][nested-descriptor]
### Parameters
- `tree`: The array tree whose nodes and values will be frozen.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.array.freeze
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/freeze)

[nested-array-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested/array  
[nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.array.reduce
Description: Accumulates the values of an array tree using a callback.
Author: Chris King
Latest version: 1.0.7

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).[array](https://www.npmjs.com/package/@kingjs/descriptor.nested.array).reduce
Accumulates the values of an array tree using a callback.
## Usage
Return values of an array tree:
```js
var reduce = require('@kingjs/descriptor.nested.array.reduce');

var result = reduce([
  'a', [
    'b', [
      'c'
    ], 'd'
  ], 'e'
], (a, o) => {
  a.push(o); 
  return a 
}, [ ]);
```
result:
```js
[ 'a', 'b', 'c', 'd', 'e' ]
```
## API
```ts
declare function reduce(
  tree: NestedArrays,
  callback: (accumulator, value) => any,
  initialValue?,
  thisArg?
): any
```
### Interfaces
- `NestedArray`: see [@kingjs/descriptor/nested/array][nested-array-descriptor]
### Parameters
- `tree`: An array tree whose leaf values are accumulated.
- `callback`: A callback invoked on each value accumulated. Return the newly accumulated value.
  - `accumulator`: The accumulated value so far. Will be `null` by default.
  - `value`: The leaf being currently accumulated.
- `initialValue`: Value to use as the first argument of the callback. If no initial value is supplied, the first value visited will be used.
- `thisArg`: The `this` argument to pass to `callback`.
### Returns
Returns the accumulated value or `null` if no values were accumulated.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.array.reduce
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/array/reduce)

[nested-array-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested/array
npm package: @kingjs/descriptor.nested.array.scorch
Description: Clears an array tree of indices with `undefined` value.
Author: Chris King
Latest version: 1.0.3

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).[array](https://www.npmjs.com/package/@kingjs/descriptor.nested.array).scorch
Clears an array tree of `undefined` values.
## Usage
Scorch an array tree of values like this:
```js
'use strict';

var values = [
  undefined,
  ['tiger'],
  [undefined]
]

scorch(values);

values;
```
result:
```js
[ [ 'tiger'] [ ] ]
```
## API
```ts
declare function scorch(
  tree: NestedDescriptor
): void
```
### Interfaces
- `NestedArray`: see [@kingjs/descriptor/nested/array][nested-array-descriptor]
### Parameters
- `tree`: The array tree whose nodes will be purged of properties with undefined values.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.array.freeze
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/array/freeze)

[nested-array-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested/array  
[nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.array.to-array
Description: Returns an array of values of an array tree.
Author: Chris King
Latest version: 1.0.5

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).[array](https://www.npmjs.com/package/@kingjs/descriptor.nested.array).to-array
Returns an array values found in an array tree.
## Usage
Return an array of pet names like this:
```js
var toArray = require('@kingjs/descriptor.nested.array.to-array');

toArray([
  'a', [
    'b', [
      'c'
    ], 'd'
  ], 'e'
]);
```
result:
```js
[ 'a', 'b', 'c', 'd', 'e' ]
```
## API
```ts
declare function toArray(
  tree: NestedArray,
): array
```
### Interfaces
- `NestedArray`: see [@kingjs/descriptor/nested/array][nested-array-descriptor]
### Parameters
- `tree`: An array tree.
### Returns
Returns an array of values or `null` if no values are found.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.array.to-array
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/array/to-array)

[nested-array-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested/array
npm package: @kingjs/descriptor.nested.array.to-paths
Description: Returns paths of an array tree.
Author: Chris King
Latest version: 1.0.5

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).[array](https://www.npmjs.com/package/@kingjs/descriptor.nested.array).to-paths
Returns paths constructed of nodes that satisfy a predicate.
## Usage
Return an array of pet names like this:
```js
var toPaths = require('@kingjs/descriptor.nested.array.to-paths');

  var pets = [
    ['tiger'],
    ['snuggles'], 
    ['spike'],
  ];
  
  var result = toPaths(
    pets, 
    null
  );
```
result:
```js
{
  '0': { '0': null },
  '1': { '0': null },
  '2': { '0': null },
}
```
## API
```ts
declare function toPaths(
  tree: NestedArray,
  value?: any
): NestedDescriptor
```
### Interfaces
- `NestedArray`: see [@kingjs/descriptor/nested/array][nested-array-descriptor]
- `NestedDescriptor`: see [@kingjs/descriptor/nested][nested-descriptor]
### Parameters
- `tree`: An array tree whose paths are returned.
- `value`: Optional leaf value.
### Returns
Returns paths of the array tree.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.array.to-paths
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/array/to-paths)

  [nested-array-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested/array
  [nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.array.update
Description: Updates the values of a array tree to values returned by a callback which takes the current value.
Author: Chris King
Latest version: 1.0.4

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).[array](https://www.npmjs.com/package/@kingjs/descriptor.nested.array).update
Updates the values of a array tree to values returned by a callback which takes the current value.
## Usage
Replace the name of the person followed with the object representing the person being followed like this:
```js
var update = require('@kingjs/descriptor.nested.array.update');

var people = {

  alice: {
    name: 'Alice',
  },
  bob: {
    name: 'Bob', 
  },
  chris: {
    name: 'Chris',
  }
};

var tree = ['bob', 'chris', 'alice'];

var result = update(
  tree,
  x => people[x]
)
```
result:
```js
[
  bob: {
    name: 'Bob', 
  },
  chris: {
    name: 'Chris',
  },
  alice: {
    name: 'Alice',
  }
]
```
## API
```ts
declare function update(
  tree: NestedDescriptor,
  callback: (value) => any,
  thisArg?
): NestedDescriptor
```
### Interfaces
- `NestedArray`: see [@kingjs/descriptor/nested/array][nested-array-descriptor]
- `NestedDescriptor`: see [@kingjs/descriptor][nested-descriptor]
### Parameters
- `tree`: The array tree whose values are going to be updated.
- `callback`: Used to update values of `tree`:
  - `value`: The current value.
- `thisArg`: The `this` argument to pass to `callback`.
### Returns
Returns `tree` with updated values updated.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.array.update
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/array/update)

[nested-array-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested/array  
[nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.for-each
Description: Invoke a callback for each path.
Author: Chris King
Latest version: 1.0.6

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).for-each
Invoke a callback for each path.
## Usage
Create a new descriptor with pet names for property names like this:
```js
'use strict';

var forEach = require('@kingjs/descriptor.nested.for-each');

var values = {
  alice: {
    pet: { name: 'tiger' }
  },
  bob: {
    pet: { name: 'snuggles' }
  },
  chris: {
    pet: { name: 'spike' }
  },
}

var result = { };
forEach(values, { 
  '*': { 
    pet: { 
      name: null 
    } 
  } 
}, o => result[o] = true);

result
```
result:
```js
{
  tiger: true,
  snuggles: true,
  spike: true
}
```
## API
```ts
declare function forEach(
  tree: NestedDescriptor,
  paths: NestedDescriptor,
  callback: (leaf, path) => any,
  thisArg?
): void
```
### Interfaces
- `NestedDescriptor`: see [@kingjs/descriptor/nested][nested-descriptor]
### Parameters
- `tree`: The tree whose nodes will be frozen.
- `paths`: The paths of the tree to pass to the `callback`.
- `callback`: Used to update `paths` of `tree`:
  - `leaf`: The leaf value.
  - `path`: The path value.
- `thisArg`: The `this` argument to pass to `callback`.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.for-each
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/for-each)

  [nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.freeze
Description: Freezes tree of marked objects.
Author: Chris King
Latest version: 1.0.8

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).freeze
Freezes paths of a tree.
## Usage
Freeze a tree of descriptors like this:
```js
'use strict';

var freeze = require('@kingjs/descriptor.nested.freeze');

var values = {
  alice: {
    pet: { name: 'tiger' }
  },
  bob: {
    pet: { name: 'snuggles' }
  },
  chris: {
    pet: { name: 'spike' }
  },
}

freeze(values, {
  '*': { pet: null }
});

values;
```
result:
```js
{
  alice: {
    pet: { name: 'tiger' }
  },
  bob: {
    pet: { name: 'snuggles' }
  },
  chris: {
    pet: { name: 'spike' }
  },
}
```
## API
```ts
declare function freeze(
  tree: NestedDescriptor,
  paths: NestedDescriptor
): void
```
### Interfaces
- `NestedDescriptor`: see [@kingjs/descriptor/nested][nested-descriptor]
### Parameters
- `tree`: The tree whose nodes will be frozen.
- `paths`: The paths of the tree to freeze.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.freeze
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/freeze)

  [nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.reduce
Description: Accumulates the values of leafs at specific paths using a callback.
Author: Chris King
Latest version: 1.0.11

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).reduce
Accumulates the values of leafs at specific paths using a callback.
## Usage
Return an array of pet names like this:
```js
var reduce = require('@kingjs/descriptor.nested.reduce');

var people = {
  alice: { 
    pet: 'tiger' 
  },
  bob: { 
    pet: 'snuggles' 
  },
  chris: {
    pet: 'spike'
  }
}

var tree = {
  '*': { pet: null }
}

reduce(people, tree, (a, o) => {
  a.push(o);
  return a;
}, []);
```
result:
```js
[ 'tiger', 'snuggles', 'spike' ]
```
## API
```ts
declare function reduce(
  tree: NestedDescriptor,
  paths: NestedDescriptor,
  callback: (accumulator, value) => any,
  initialValue?,
  thisArg?
): any
```
### Interfaces
- `NestedDescriptor`: see [@kingjs/descriptor/nested][nested-descriptor]
### Parameters
- `tree`: A tree whose leaf values that correspond to a path in `paths` are accumulated.
- `paths`: Paths to search in `tree`. If the path is found, then it's value is accumulated. Any property named `'*'` found in `paths` is replicated with properties whose names correspond to properties of `tree` not already present as siblings of `'*'`.
- `callback`: A callback invoked on each value accumulated. Return the newly accumulated value.
  - `accumulator`: The accumulated value so far. Will be `null` by default.
  - `value`: The leaf being currently accumulated.
- `initialValue`: Value to use as the first argument of the callback. If no initial value is supplied, the first value visited will be used.
- `thisArg`: The `this` argument to pass to `callback`.
### Returns
Returns the accumulated value or `null` if no values were accumulated..
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.reduce
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/reduce)

  [nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.scorch
Description: Clears a tree of descriptor properties with `undefined` value.
Author: Chris King
Latest version: 1.0.8

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).scorch
Clears a tree of descriptor properties with `undefined` value.
## Usage
Scorch a tree of descriptors like this:
```js
'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:
```js
{
  alice: {
    pet: { name: 'tiger' }
  },
  bob: {
    pet: { }
  },
}
```
## API
```ts
declare function scorch(
  tree: NestedDescriptor,
  paths: NestedDescriptor
): void
```
### Interfaces
- `NestedDescriptor`: see [@kingjs/descriptor/nested][nested-descriptor]
### 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](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.freeze
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/freeze)

  [nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested
npm package: @kingjs/descriptor.nested.to-array
Description: Returns an array of leaf values that correspond to as set of paths.
Author: Chris King
Latest version: 1.0.9

# @[kingjs](https://www.npmjs.com/package/kingjs)/[descriptor](https://www.npmjs.com/package/@kingjs/descriptor).[nested](https://www.npmjs.com/package/@kingjs/descriptor.nested).to-array
Returns an array of leaf values that correspond to as set of paths.
## Usage
Return an array of pet names like this:
```js
var toArray = require('@kingjs/descriptor.nested.to-array');

var people = {
  alice: { 
    pet: 'tiger' 
  },
  bob: { 
    pet: 'snuggles' 
  },
  chris: {
    pet: 'spike'
  }
}

var tree = {
  '*': { pet: null }
}

toArray(people, tree);
```
result:
```js
[ 'tiger', 'snuggles', 'spike' ]
```
## API
```ts
declare function toArray(
  tree: NestedDescriptor,
  paths: NestedDescriptor
): array
```
### Interfaces
- `NestedDescriptor`: see [@kingjs/descriptor/nested][nested-descriptor]
### Parameters
- `tree`: A tree whose leaf values that correspond to a path in `paths` are returned in an array.
- `paths`: Paths to search in `tree`. If the path is found, then it's value is included in the result array. Any property named `'*'` found in `paths` is replicated with properties whose names correspond to properties of `tree` not already present as siblings of `'*'`.  
### Returns
Returns an array of values or `null` if no values are found.
## Install
With [npm](https://npmjs.org/) installed, run
```
$ npm install @kingjs/descriptor.nested.to-array
```
## License
MIT

![Analytics](https://analytics.kingjs.net/descriptor/nested/to-array)

  [nested-descriptor]: https://www.npmjs.com/package/@kingjs/descriptor/nested