Constructor
new DefaultValue(value, description)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
any
|
The wrapped default value. |
description |
string
|
A description of the contained value. Used to produce the comment string. |
Methods
clone() → {module:core/schema~DefaultValue}
Duplicate the current default value.
Wrapped value will be shallow copied.
- Source:
flatten()
Unwrap current {module:core/schema~DefaultValue} if its wrapped value is also a
{module:core/schema~DefaultValue}.
The description will also be replaced with wrapped value description, if exists.
- Source:
merge(source)
Merge current default value with another default value.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
source |
module:core/schema~DefaultValue
|
The input object to be merged with. Should have the same wrapped value type as current wrapped default value. |
toCommented() → {any}
Call module:core/schema~DefaultValue#toCommentedArray or
module:core/schema~DefaultValue#toCommentedObject based on the type of the wrapped value.
If neither applies, directly return the wrapped value.
- Source:
Returns:
- Type:
-
any
The commented object/array, or the original wrapped value.
toCommentedArray() → {Array}
Create a new array with comments inserted as new elements right before each child element.
If current wrapped value is an array and some of its elements are instances of
module:core/schema~DefaultValue, the element's description will be inserted as a new child
right before the element.
The element itself will also be converted into its commented version using the toCommented
method.
- Source:
Returns:
- Type:
-
Array
A new array with comments and the original elements in the commented form.
toCommentedObject() → {Object}
Create a new object with comments inserted as new properties right before every original properties.
Works similar to module:core/schema~DefaultValue#toCommentedArray.
- Source:
Returns:
- Type:
-
Object
A new object with comments and the original property values in the commented form.
toYaml() → {string}
Create the YAML string with all the comments from current default value.
- Source:
Returns:
- Type:
-
string
The formatted YAML string.