You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That would indeed make sense. The semantics of set and setIn currently consider the comment and anchor to have been a part of the original value, which gets replaced. But that can clearly break stuff:
constdoc=YAML.parseDocument(` a: &A value b: *A`)doc.set('a','foo')String(doc)// Error: Alias node must be after source node
Fixing this might be a breaking change, so it's good that I'm working on yaml@2 just now. At least the anchor should almost certainly stay no matter what; probably the comment as well?
I managed to solve this for scalar values, which is probably most of the real-world usage. To also make this work for collections, the semantics of set() and some of the other accessors would need to change, such that they always apply a wrapper to the value. That in turn would mean that get()ting a value that you've set() isn't always the same.
Also, routing the internal dependencies such that wrapping input would be possible within accessors would get a little hairy, so I'm going to leave this only mostly fixed, and see if anyone complains.
Hi.
Is it possible to save comments after value changing?
After call
doc.setIn(['args', 'objectKey'], 'objectValNew')
I havebut I would be want to have
The text was updated successfully, but these errors were encountered: