Remove leading string indent

Benchmark created on


Setup

const str = `SELECT * FROM users
             WHERE age >= 10
\t\t\t\t\t\t AND age <= 50`;

Test runner

Ready to run.

Testing in
TestOps/sec
split and join
str.split('\n')
   .map((l) => l.trimStart())
   .join('\n')
ready
regex replace
str.replace(/^\s+/gm, '')
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.