Home | man(1)
escapes strings for use in JavaScript string literals while gen‐
erating the shortest possible valid ASCII-only output. Escape
any occurrences of ' in the input string as \', so that the out‐
put can be used in a JavaScript string literal wrapped in single
quotes. Escape any occurrences of " in the input string as \",
so that the output can be used in a JavaScript string literal
wrapped in double quotes. Make sure the output is a valid
JavaScript string literal wrapped in quotes. The type of quotes
can be specified using the or settings. Escape any astral Uni‐
code symbols using ECMAScript 6 Unicode code point escape se‐
quences. Escape all the symbols in the output, even printable
ASCII symbols. Make sure the output is valid JSON. Hexadecimal
character escape sequences and the \v or \0 escape sequences will
not be used. Setting this flag enables the and settings. Treat
the input as a JavaScript object rather than a string. Accepted
values are flat arrays containing only string values, and flat
objects containing only string values. Pretty-print the output
for objects, using whitespace to make it more readable. Setting
this flag enables the Use lowercase for alphabetical hexadecimal
digits in escape sequences. setting. Print jsesc's version.
Show the help screen. The utility exits with one of the follow‐
ing values: successfully escaped the given string and printed the
result. wasn't instructed to escape anything (for example, the
flag was set); or, an error occurred. Print an escaped version
of the given string. Print an escaped version of the string that
gets piped in. jsesc's bug tracker is located at
<https://github.com/mathiasbynens/jsesc/issues>. Mathias Bynens
<https://mathiasbynens.be/> <https://mths.be/jsesc>