Open ccaroon opened 1 year ago
Not sure is this is a work-around or intended behavior, but if I create newValue
using the createNode
method everything works as expected:
const newValue = doc.createNode(
[
{
log_path: "fish",
index: "fry",
sourcetype: "never",
source: "more"
}
]
)
If setting a collection using a "raw" Object/Array is NOT suppose to work, then you have my apologies and can close this issue.
This currently counts as intended behaviour. The get/set methods were added mostly as sugar for the direct access modification of the node tree, which supports having plain JS values embedded in it. This means that the setIn()
doesn't apply doc.createNode()
on the value that's set, and that getIn()
doesn't navigate through non-node objects.
Changing the former would be a breaking change, but the I think the latter could be extended as a non-breaking change, along with #386.
Describe the bug Getting a value from a collection after setting the entire collection returns 'undefined'
To Reproduce See nodeJS script below.
Expected behaviour Getting a value from a collection after setting the entire collection should return the correct/actual value, not undefined.
Versions (please complete the following information):
yaml
: v2.2.1Additional context See script below.