This version yaml
has been published to npm using the next
dist-tag, so install it with:
npm install --save-exact yaml@next
Be aware that further breaking changes are likely before we get to a final 2.0.0 release. However, at least so far the basic YAML.parse()
and YAML.stringify()
APIs are pretty much unaffected by any of the breaking changes.
BREAKING CHANGES
Drop deprecated end points, members, options & defaults (#171)
- The following entry points are removed:
- 'yaml/map'
- 'yaml/pair'
- 'yaml/scalar'
- 'yaml/schema'
- 'yaml/seq'
- 'yaml/types/binary'
- 'yaml/types/omap'
- 'yaml/types/pairs'
- 'yaml/types/set'
- 'yaml/types/timestamp'
- The package.json
"exports"
no longer include an"./": "./"
escape hatch. Schema.defaultTags
andSchema.defaultPrefix
are removed.- The
tags
alias for thecustomTags
option is removed, andprettyErrors
is now default-true. - Custom tags that use
class
instead ofidentify()
are no longer supported.
Breaking changes to Document & createNode APIs (#186)
See the PR for usage examples of:
new YAML.Document(value, options?)
- The Document constructor gets a new first argumentvalue
. This allows for much more ergonomic document creation.doc.createNode(value, options?)
- The methodsYAML.createNode()
anddoc.schema.createNode()
are replaced by a singledoc.createNode()
. Their non-value arguments are also collected into an options object.doc.createPair(key, value, options?)
- The methoddoc.schema.createPair()
is replaced bydoc.createPair()
, and also uses an options bag instead of named positional arguments.
When creating a mapping from a JS Object, drop undefined values (#173)
When creating a YAML mapping from a JS Object, keys with undefined
values are not included. This matches the behaviour of JSON.stringify()
. In all other cases, the handling of undefined
is unchanged, so e.g. [1, undefined, 2]
will still result in a sequence of three items, the second of which has a null
value. This too matches the behaviour of JSON.stringify()
.
Previously, undefined
object values were mapped to null
.
Retain existing nodes when using set() in mappings & sequences (#185)
When overwriting a Scalar
value with a scalar using set(), the original node is retained.