Created
October 13, 2016 11:08
-
-
Save CodeSigils/2c5a237b1dbf1089ff24dc1bb4271b0c to your computer and use it in GitHub Desktop.
Text normalizer
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
function textNormalizer(text) { | |
return text.toLowerCase().trim(); | |
} | |
// tests | |
function testTextNormalizer() { | |
var text = " let's GO SURFING NOW everyone is learning how "; | |
var expected = "let's go surfing now everyone is learning how"; | |
if (textNormalizer(text) === expected) { | |
console.log('SUCCESS: `textNormalizer` is working'); | |
} | |
else { | |
console.log('FAILURE: `textNormalizer` is not working'); | |
} | |
} | |
testTextNormalizer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment