DefaultValue

core/default_value~ DefaultValue

The default value wrapper class.

Constructor

new DefaultValue(value, description)

Source:
Parameters:
Name Type Description
value any The wrapped default value.
description string A description used to produce the comment string.

Methods

clone() → {DefaultValue}

Duplicate this wrapper, shallow-copying its wrapped arrays and objects.
Source:
Returns:
Type:
DefaultValue
A new wrapper.

flatten()

Unwrap nested wrappers, preferring the innermost non-empty description.
Source:

merge(source)

Merge a wrapper with the same value type, concatenating arrays and assigning object properties.
Source:
Parameters:
Name Type Description
source DefaultValue The wrapper to merge.

toCommented() → {any}

Annotate arrays and objects with comment markers, or return a primitive value unchanged.
Source:
Returns:
Type:
any
The annotated value.

toCommentedArray() → {Array}

Insert description markers before each wrapped array element.
Source:
Returns:
Type:
Array
A new array of comments and annotated values.

toCommentedObject() → {Object}

Insert description markers before each wrapped object property.
Source:
Returns:
Type:
Object
A new object of comments and annotated values.

toYaml() → {string}

Create YAML including the descriptions of nested values as comments.
Source:
Returns:
Type:
string
The formatted YAML string.