Forked from dlindenkreuz/gist:a439ec4b939f0561d6d9
Created
December 18, 2019 04:07
-
-
Save sarhov/72044701a03239e6853550d510f19fe0 to your computer and use it in GitHub Desktop.
Shopify handleize function in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// one-liner version | |
// retains latin-1 supplement chars as well as latin extended-a and latin extended-b | |
Shopify.handleize = function (str) { | |
return str.toLowerCase().replace(/[^\w\u00C0-\u024f]+/g, "-").replace(/^-+|-+$/g, ""); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment