0.0.5 • Published 8 years ago

@gik/tools-populator v0.0.5

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

@gik/tools-populator 0.0.5

Allows you to populate an object in a single pass. Part of our tools suite.

Contributors
Supported platforms
  • darwin
  • linux

Table of contents

  • populator Allows properties in an object to inherit values from sibling properties.
  • Types

populator

Allows properties in an object to inherit values from sibling properties. This specially useful when creating JSON configuration files.

Parameters
Returns

Object - An object copy with references replaced.

Example
const subject = {
    a: { b: { c: 'world' } },
    d: "hello ${a.b.c}${e}",
    e: "!!!",
    f: ["${e}", "${a.b.c}"]
};
const result = Populator(subject);
// result:
// { a: { b: { c: 'world' } }, d: "hello world!!!", e: "!!!", f: ["!!!", "world"] };

▲ Top


Types

Members

▲ Top


PupulatorParamError

static typedef of Types

The provided key cannot be used to populate the current property.

▲ Top


PopulatorKeyError

static typedef of Types

The provided key cannot be used because is not a valid type.

▲ Top