normalize apostrophe (v3)

Revision 3 of this benchmark created on


Setup

const text="I don't know what I'm doing"

Test runner

Ready to run.

Testing in
TestOps/sec
reducer
const isString = (typeof text !== 'string');
['‘', '’', '`', 'ʼ'].reduce(
    (acc, char) => acc.split(char).join("'"),
    text
);
ready
regex
const isString = (typeof text !== 'string');
const apostropheRegex = /[‘’`ʼ]/g;
return text.replace(apostropheRegex, "'");
ready

Revisions

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