mathiasbynens/jsesc
Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.
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.
Stars
795
Forks
53
Language
JavaScript
License
MIT
Category
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.
Related tools
retejs/rete-studio
A general-purpose code generation tool powered by Rete.js
chrishoermann/zod-prisma-types
Generator creates zod types for your prisma models with advanced validation
microsoft/ts-gyb
Generating native code interfaces from TypeScript
evoluteur/evolutility-ui-jquery
Model-driven Web UI for CRUD using REST or localStorage.
unjs/knitwork
🧶 Utilities to generate safe JavaScript code.