Created
January 23, 2019 16:39
-
-
Save RyanWarner/6eef4b461de993f7660e89105ff21027 to your computer and use it in GitHub Desktop.
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
// For an array of strings, remove special characters, | |
// replace spaces with hyphens, | |
// and convert all characters to lower case. | |
myArray.map(key => { | |
const removeSpecials = key.replace(/[^a-zA-Z0-9 -]/, '').replace(/\.|!|'/g, '') | |
const replaceSpaces = removeSpecials.replace(/ /g, '-') | |
return replaceSpaces.toLowerCase() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment