Created
          March 10, 2018 00:01 
        
      - 
      
 - 
        
Save liseferguson/3abd5622ff729ea9d9b76f8417fece28 to your computer and use it in GitHub Desktop.  
    Normalizer function (returns lowercase, trims whitespace before and after text in string)
  
        
  
    
      This file contains hidden or 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()}`; | |
| } | |
| /* From here down, you are not expected to | |
| understand.... for now :) | |
| Nothing to see here! | |
| */ | |
| // tests | |
| function testTextNormalizer() { | |
| const text = " let's GO SURFING NOW everyone is learning how "; | |
| const 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