@gik/tools-populator

0.0.5 • Public • Published

@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
subject Object The object you need to be populated.
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


Package Sidebar

Install

npm i @gik/tools-populator

Homepage

gik.mx

Weekly Downloads

0

Version

0.0.5

License

MIT

Last publish

Collaborators

  • etor