fix string non-alphanumeric non-whitespace chars before regex

This commit is contained in:
Berkeley Martinez
2015-08-06 15:37:07 -07:00
parent 64732077bb
commit 783d7cf1ec

View File

@ -62,7 +62,12 @@ module.exports = {
},
unDasherize: function unDasherize(name) {
return ('' + name).replace(/\-/g, ' ').trim();
return ('' + name)
// replace dash with space
.replace(/\-/g, ' ')
// strip nonalphanumarics chars except whitespace
.replace(/[^a-zA-Z\d\s]/g, '')
.trim();
},
getChallengeMapForDisplay: function() {