@gik/tools-populator
v0.0.5
Published
Allows you to populate an object in a single pass. Part of our [tools suite](https://github.com/gikmx/tools).
Downloads
8
Readme
@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. 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"] };
Types
Members
PupulatorParamError
static typedef of
Types
The provided key cannot be used to populate the current property.
PopulatorKeyError
static typedef of
Types
The provided key cannot be used because is not a valid type.