Last active
March 8, 2019 01:36
-
-
Save MeetMartin/ecf8e0c60c91964f8ee7df772de6345d to your computer and use it in GitHub Desktop.
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
class TextTransformation { | |
static capitalize(text) { | |
return text.charAt(0).toUpperCase() + text.slice(1); | |
} | |
static addExclamationMark(text) { | |
return text + '!'; | |
} | |
static addPunctuation(text) { | |
return text + '.'; | |
} | |
static makeImportant(text) { | |
let transformed = text; | |
transformed = transformed.trim(); | |
transformed = transformed.toLowerCase(); | |
transformed = TextTransformation.capitalize(transformed); | |
transformed = TextTransformation.addExclamationMark(transformed); | |
return transformed; | |
} | |
static makeUnimportant(text) { | |
let transformed = text; | |
transformed = transformed.trim(); | |
transformed = transformed.toLowerCase(); | |
transformed = TextTransformation.addPunctuation(transformed); | |
return transformed; | |
} | |
} | |
export default TextTransformation; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment