GitShow/sveltejs/devalue
sveltejs

devalue

Gets the job done when JSON.stringify can't

by sveltejs
Star on GitHubForkWebsitenpm

JavaScript

2.8k stars100 forks37 contributorsActive · 5d agoSince 2018v6.0.2MIT

Meet the team

See all 37 on GitHub →
Rich-Harris
Rich-Harris177 contributions
github-actions[bot]Bot
github-actions[bot]26 contributions
elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github25 contributions
mrkishi
mrkishi9 contributions
gtm-nayan
gtm-nayan7 contributions
danielroe
danielroe4 contributions
TooTallNate
TooTallNate4 contributions
ivanhofer
ivanhofer3 contributions

Languages

View on GitHub →
JavaScript93%
TypeScript7%

Commit activity

Last 12 weeks · 51 commits

Full graph →

Community health

2 of 6 standards met

Community profile →
50
✓README✓License○Contributing○Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 2 in progress · Last activity 5d ago
See all on GitHub →
DRMacIver
`stringifyAsync`: a promise resolving to `undefined`, `NaN`, `-0` or `Infinity` inside an object parses back as `-1`, `-3`, `-6` or `-4`OpenIssue

, , 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.

DRMacIver · 1w ago

Recent fixes

View closed PRs →
sapphi-red
Improve stringify_string performanceMergedPR

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.

sapphi-red · 2d ago
Likio3000
docs: initialize the input in the unflatten exampleMergedPR

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.

Likio3000 · 5d ago
Rich-Harris
chore: remove unused exportMergedPR
Rich-Harris · 6d ago
Structured data for AI agents

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.

·@ofershap

Replace github.com with gitshow.dev