jonschlinkert / gray-matter

Smarter YAML front matter parser, used by metalsmith, Gatsby, Netlify, Assemble, mapbox-gl, phenomic, vuejs vitepress, TinaCMS, Shopify Polaris, Ant Design, Astro, hashicorp, garden, slidev, saber, sourcegraph, and many others. Simple to use, and battle tested. Parses YAML by default but can also parse JSON Front Matter, Coffee Front Matter, TOML Front Matter, and has support for custom parsers. Please follow gray-matter's author: https://github.com/jonschlinkert
https://github.com/jonschlinkert
MIT License
3.97k stars 138 forks source link

Max Integer Size #139

Open symbiosdotwiki opened 2 years ago

symbiosdotwiki commented 2 years ago

I am noticing a problem with long integers (in my case ID numbers from flickr) which when they are imported with gray matter they are incorrect. I assume this is due to floating point error.

A typical flickr API number is 72157688988508171 which is then cast to 72157688988508180

This is easy enough to avoid by adding string quotes to the ID but perhaps gray matter should detect these cases and properly cast to string or something?

symbiosdotwiki commented 2 years ago

Is it possible to set the "type" of different YAML parameters in javascript (not typescript) so as to avoid this? Or to tell matter to interpret all parameters as strings?