Last active
July 7, 2021 22:10
-
-
Save jonoliver/c2ac0a21330722ef2c08531b50032056 to your computer and use it in GitHub Desktop.
Bob
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
// Team Reed, Sheridan, Zastrow and Jon | |
export const hey = (message) => { | |
if (isEmpty(message)) { | |
return 'Fine. Be that way!' | |
} | |
if (isAllCaps(message) && isQuestion(message)) { | |
return 'Calm down, I know what I\'m doing!' | |
} | |
if (isQuestion(message)) { | |
return 'Sure.' | |
} | |
if (isAllCaps(message)) { | |
return 'Whoa, chill out!' | |
} | |
return 'Whatever.' | |
}; | |
const isAllCaps = (message) => { | |
return message.match(/[A-Z]/) && message === message.toUpperCase(); | |
}; | |
const isQuestion = (message) => { | |
return message.trim().match(/\?$/); | |
} | |
const isEmpty = (message) => { | |
return ! message.match(/\S/); | |
} |
gtempus
commented
Jul 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment