gray-matter
gray-matter copied to clipboard
todo: switch yaml libraries
I've spent quite a bit of time reviewing the code in https://github.com/eemeli/yaml, it's amazing. Very well done @eemeli!
If someone wants to do a PR to swap js-yaml for yaml, that would be great. Otherwise I'll do it when I get a chance.
For those of us that have not read it yet, what's amazing about the code? (Now considering if I should also try it for other projects) And would this require a major version bump because potentially the two yaml libraries behave differently?
what's amazing about the code?
Thanks for asking!
- the code is well written, well organized, and well tested
- The documentation is awesome
- the API is nice. From basic methods like
parse
andstringify
, to more advanced methods for getting the CST orYAML.Document
- loads 20-40ms faster than js-yaml
The only small gripe I have is that the package is published with browser code, which adds 299Kb to the download and should be released separately. But IMHO that's not important enough to dissuade me.
because potentially the two yaml libraries behave differently?
I'm not aware of any differences in expected output, and the comprehensive test suite and documentation indicate that yaml
will be a drop-in replacement.
@jonschlinkert any chance of merging and releasing this? https://github.com/jonschlinkert/gray-matter/pull/147
I'm less concerned about library size and performance. The biggest reason to prefer yaml
over js-yaml
, is that it's compliant with the YAML spec.