-
-
Save sundarj/0f319b66d6916988e5ba to your computer and use it in GitHub Desktop.
Javascript Slugify (works with unicode chars)
This file contains hidden or 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
| function slugify( title ) { | |
| return (title+'') | |
| .toLowerCase() | |
| .replace(/\s+/g, '-') | |
| .replace(/[!"'£$%\^&*()_+=\/\|`¬/><.,{}[\]:;]/g, '') | |
| .replace(/\-\-+/g, '-') | |
| .replace(/^-+/, '') | |
| .replace(/-+$/, '') | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment