nl_tokens: Based heavily on the abstract Quote / QuoteJSONString operation from ECMA - 262 ( 24 . 3 . 2 . 2 ) but augmented for a few select characters ( e . g . lineSeparator paragraphSeparator nextLine ) Note that this doesn t actually wrap the input in double quotes .
pl_tokens: function escapeString ( s ) { s = escapedCharsRegExp . test ( s ) ? s . <mask> ( escapedCharsRegExp , getReplacement ) : s ; return s ; function getReplacement ( c ) { return escapedCharsMap [ c ] || get16BitUnicodeEscapeSequence ( c . charCodeAt ( 0 ) ) ; } }