json-tag
Tagged template literal that escapes arguments as JSON values
json-tag uses JSON.stringify()
to escape the template literal's arguments.
Usage:
json`string: `json`number: `json`boolean: & `json`null: `json`array: `json`object: `
You will get the following strings:
string: "double quote \""
number: 1337
boolean: true & false
null: null
array: ["double quote \"",null,1337]
object: {"doubleQuote":"\"","doubleNumber":1337}
It works as follows, this:
json`text `
Is essentialy this:
`text `