yahoo/serialize-javascript
Serialize JavaScript to a superset of JSON that includes regular expressions and functions. observed · 2026-08-28
Health v2 · maintenance only
98/100
- Activity 99
- Release rhythm 96
- Longevity 100
Flags: no_license
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: 30.0
- age_days: 4369
- days_rel: 25
- days_push: 7
- n_releases_24m: 9
Adoption not part of the score
2922 stars · 213 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A small npm library from Yahoo that serializes JavaScript values into a string of literal JavaScript code, extending JSON.stringify to support functions, regular expressions, dates, Sets, Maps, BigInt, Infinity, and URLs. The output can be embedded in HTML script tags or saved as a .js file, with HTML characters and line terminators escaped automatically.
Use cases
- serialize javascript objects with functions and regexps to -like strings
- share route definitions with regexps from server to client
- embed serialized state into an html script tag safely
- serialize dates, maps, sets, and bigint values that .stringify cannot handle
- pass serializable state to server-side rendering hydration
When to choose
- you need to serialize javascript values beyond what .stringify supports, like functions, regexps, dates, sets, or maps
- you want output safe to embed directly into html script elements
- you need a small, focused, well-tested serialization utility for node or the browser
When to avoid
- you need to serialize arbitrary closures or functions that reference outside variables, such as for worker threads
- you need cross-language data interchange rather than literal javascript code
- you need secure deserialization of untrusted input
Facets
library · maturity stable
serialization web-development developer-tools serialize-javascript -superset functions regex express-state nodejs javascript web-server
2 sources
- readme: https://github.com/yahoo/serialize-javascript · fetched 2026-08-28 · 5c2bfaecf4f9
- registry_npm: https://registry.npmjs.org/serialize-javascript · fetched 2026-08-29 · 4545391bb97d
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| yahoo/serialize-javascript | main | 98 |
For agents
markdown · JSON · MCP: product_card(name="yahoo/serialize-javascript")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem