Open edongashi opened 2 weeks ago
Replaces regex with a simple state machine.
Since there is no test infrastructure, I ran the following snippet for a sanity check:
console.log([ "Line1\\Line2", "Line1\\\\Line2", "Line1\\tLine2", "Line1\\nLine2", "Line1\\n\\nLine2", "Line1\\n\\\\nLine2", "Line1\\n\\\\\\nLine2", ].map(replaceLinebreakInString).join('\n======\n'))
And got:
Line1\Line2 ====== Line1\Line2 ====== Line1\tLine2 ====== Line1 Line2 ====== Line1 Line2 ====== Line1 \nLine2 ====== Line1 \ Line2
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Replaces regex with a simple state machine.
Since there is no test infrastructure, I ran the following snippet for a sanity check:
And got: