Skip to content

Instantly share code, notes, and snippets.

@CodeSigils
Created October 13, 2016 11:08
Show Gist options
  • Save CodeSigils/2c5a237b1dbf1089ff24dc1bb4271b0c to your computer and use it in GitHub Desktop.
Save CodeSigils/2c5a237b1dbf1089ff24dc1bb4271b0c to your computer and use it in GitHub Desktop.
Text normalizer
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