mathiasbynens/jsesc

Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.

51
/ 100
Established

When you have data like text, numbers, or objects that needs to be safely included in JavaScript code, this tool converts it into a clean, ASCII-only string. It takes your raw data and produces a standardized JavaScript string, helping developers avoid common encoding problems like mojibake or syntax errors. This is primarily for web developers or anyone working with JavaScript applications who needs to embed various data types securely.

795 stars. Used by 1 other package. No commits in the last 6 months. Available on npm.

Use this if you need to reliably represent diverse data (strings, arrays, objects, maps, sets, numbers) as a JavaScript-compatible string that is safe from encoding issues and syntax errors.

Not ideal if you simply need to convert data to standard JSON for non-JavaScript contexts or if you require human-readable output that is not ASCII-escaped.

web-development data-serialization javascript-programming encoding-management front-end-development
Stale 6m
Maintenance 0 / 25
Adoption 11 / 25
Maturity 25 / 25
Community 15 / 25

How are scores calculated?

Stars

795

Forks

53

Language

JavaScript

License

MIT

Last pushed

Dec 11, 2024

Commits (30d)

0

Reverse dependents

1

Get this data via API

curl "https://pt-edge.onrender.com/api/v1/quality/ai-coding/mathiasbynens/jsesc"

Open to everyone — 100 requests/day, no key needed. Get a free key for 1,000/day.