These two characters are considered ordinary characters by JSON but line terminators by ECMAScript (prior to ES2019). When pretty-printing a string containing either character, JSON.stringify leaves it unescaped. The result in recast.prettyPrint is that fromString, which follows ECMAScript definitions, converts it mistakenly to a newline character. Escaping these characters manually when the intent is to generate ECMAScript (rather than JSON) eliminates the problem. |
||
|---|---|---|
| .. | ||
| comments.ts | ||
| fast-path.ts | ||
| lines.ts | ||
| mapping.ts | ||
| options.ts | ||
| parser.ts | ||
| patcher.ts | ||
| printer.ts | ||
| util.ts | ||