Whatevs

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Regex
const split = ["ab''", "nb"'];

const inchesFeetMap = split.map((part) => !part.match(/'$/) ? `${part}"` : part);
const value = inchesFeetMap.join(' x ');

console.log('Value', value);
ready
Before
const split = ["ab''", "nb"'];

if (split[0].lastIndexOf("'") !== split[0].length - 1) {
          split[0] = split[0].trim() + '"';
        }
        if (split[1].lastIndexOf("'") !== split[1].length - 1) {
          split[1] = split[1].trim() + '"';
        }
console.log('Value', split);
ready

Revisions

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