Last 12 weeks · 51 commits
2 of 6 standards met
, , and round-trip through /, but when they are the resolved values of promises inside an object passed to , they come back as the numbers -1, -3, -6 and -4; a promise at the root round-trips: Output: The promised values come back as the numbers -1, -3, -6 and -4, and neither nor reports an error. A promise of at the root (third line) round-trips correctly; it is only when the promise sits inside an object or array that its resolved value is replaced by a number. The README says of that "the output format is identical to , so and work unchanged", so I expected the second line to parse to the same value as the first. Tested on devalue 6.0.0 from npm and on current (80e75e7c08f6, the 6.0.0 release commit), with Node 26.8.1. BTW, this was found by an automated program that writes property-based tests for various open source projects using hegel (but it has been reviewed by hand before reporting). We've also potentially found (but not yet hand validated) 6 other bugs in devalue. You can see the tests at https://github.com/hegeldev/hegel-zoo/tree/main/targets/typescript/devalue. Let us know if you would like us to file the other bugs found and/or contribute the tests. NB the tests are currently LLM generated and probably not yet suitable for inclusion as is, but we're happy to help get them into a better state if you want them.
scans every character in JS and concatenates slices, even when nothing needs escaping. This replaces the loop with one regex test; clean strings return as , the rest go through plus a replace for , U+2028 and U+2029. Unpaired surrogates now come out escaped, matching #181. Clean strings 1.5-4.6x faster, object keys 1.4x, short strings with an escape ~0.9x.
The README example calls before declaring later in the same code block. Running the example in one scope therefore throws a before serialization. Define a small value to serialize and keep for the revived result, with an expected-output comment to make the example self-contained. Validation: static review of JavaScript lexical binding and the / signatures in and . This changes only the README; I did not run the project suite or install dependencies. Prepared with AI assistance (OpenAI Codex), with source and diff review.
Repository: sveltejs/devalue. Description: Gets the job done when JSON.stringify can't Stars: 2805, Forks: 100. Primary language: JavaScript. Languages: JavaScript (93%), TypeScript (7%). License: MIT. Homepage: https://svelte.dev/repl/138d70def7a748ce9eda736ef1c71239 Latest release: v6.0.2 (1w ago). Open PRs: 2, open issues: 12. Last activity: 5d ago. Community health: 50%. Top contributors: Rich-Harris, github-actions[bot], elliott-with-the-longest-name-on-github, mrkishi, gtm-nayan, danielroe, TooTallNate, ivanhofer, LorisSigrist, Conduitry and others.