Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Created March 5, 2019 01:37
Show Gist options
  • Save MeetMartin/ae2d9a5c653038411af2f79cb7052e4f to your computer and use it in GitHub Desktop.
Save MeetMartin/ae2d9a5c653038411af2f79cb7052e4f to your computer and use it in GitHub Desktop.
class TextTransformation {
constructor(text) {
this.text = text;
}
makeImportant() {
this.text = this.text.trim(); // trim
this.text = this.text.toLowerCase(); // make lowercase
this.text = this.text.charAt(0).toUpperCase() + this.text.slice(1); // capitalize
this.text = this.text + '!'; // add !
return this.text;
}
makeUnimportant() {
this.text = this.text.trim(); // trim
this.text = this.text.toLowerCase(); // make lowercase
this.text = this.text + '.'; // add .
return this.text;
}
}
export default TextTransformation;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment