quote-unquote
v1.0.0
Published
quote and unquote strings. escapes internal quotes and slashes. Automatically decides whether to use single or double quotes.
Downloads
4,403,426
Readme
quote-unquote
quote and unquote strings. escapes internal quotes and slashes. Automatically decides whether to use single or double quotes.
q = require('quote-unquote')
q.quote (string)
foo's bar
=> "foo's bar"
"foo's bar"
=> "\"foo's bar\""
"\"foo's bar\""
=> "\"\\\"foo's bar\\\"\""
etc
q.unquote(quoted_string)
the reverse of the above.
"foo's bar"
=> foo's bar
"\"foo's bar\""
=> "foo's bar"
"\"\\\"foo's bar\\\"\""
=> "\"foo's bar\""
License
MIT