Skip to main content

quote

Function quote 

Source
pub fn quote(text: &str) -> String
Expand description

What: Quote text as a JSON string literal. Why: serde_json escapes ", \ and control characters as JSON.stringify does; serializing a &str cannot fail.

In TS you’d write (pseudocode):

JSON.stringify(text)