js-yaml
js-yaml copied to clipboard
Load: empty input sring should return null, no undefined
~~Ref: https://github.com/nodeca/js-yaml/issues/565#issuecomment-659696047~~
https://github.com/nodeca/js-yaml/issues/567#issuecomment-685070822
Ups... closing after reference update
Found a couple problems:
> require('js-yaml').load("")
undefined
> require('js-yaml').load("\n")
undefined
> require('js-yaml').load("\n\n")
null
> require('js-yaml').load("# hmm")
null
> require('js-yaml').loadAll("")
[]
> require('js-yaml').loadAll("\n")
[]
> require('js-yaml').loadAll("\n\n")
[ null ]
> require('js-yaml').loadAll("# hmm")
[ null ]
So load returns null if there is one document and undefined if input stream doesn't contain any.
Seems to be correct as per explanation in https://github.com/nodeca/js-yaml/issues/565#issuecomment-659696047.