freeCodeCamp/common/utils/index.js

8 lines
158 B
JavaScript

export function dashify(str) {
return ('' + str)
.toLowerCase()
.replace(/\s/g, '-')
.replace(/[^a-z0-9\-\.]/gi, '')
.replace(/\:/g, '');
}