slugify
slugify copied to clipboard
Option disabling `transliterate`
Heya, great one.
Can we add options.transliterate so we can disable transliteration? Defaulting to true if you will so.
https://github.com/sindresorhus/slugify/blob/b841d04d92533469714e586435ed4c1b3b451d8c/index.js#L46
to
string = options.transliterate ? transliterate(string, {customReplacements}) : string;
This would be great, we've seen transliteration add up to 250ms of processing time when we slugify a string, and as our website only operates in English it's generally not something we ever need.
Library seems unmaintained so in-sourcing the code into one's own project seems the way to go. So if you're insourcing, some tips that may help
- Commenting out transliterate is trivial. Even adding the option to true/false it is simple (an AI code editor could do it)
- Transliterate is slow mainly because of all the Regex object creation. Simplest fix is to change it to a string.replaceAll (as the code comment suggests anyway). All modern browsers support this