Last active
March 8, 2019 01:40
-
-
Save MeetMartin/c7bd7add088e59ffc176a511b23b2d13 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
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))); | |
export const trim = text => text.trim(); | |
export const toLowerCase = text => text.toLowerCase(); | |
export const capitalize = text => text.charAt(0).toUpperCase() + text.slice(1); | |
export const addExclamationMark = text => text + '!'; | |
export const addPunctuation = text => text + '.'; | |
export const makeImportant = compose(addExclamationMark, capitalize, toLowerCase, trim); | |
export const makeUnimportant = compose(addPunctuation, toLowerCase, trim); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment