Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ashukasma/b5dabcd6d14117366174 to your computer and use it in GitHub Desktop.
Save ashukasma/b5dabcd6d14117366174 to your computer and use it in GitHub Desktop.
Shopify handleize function in JavaScript
// 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