-
-
Save gdyrrahitis/d516f20ecd5a2405fc1a9da805b3f6b4 to your computer and use it in GitHub Desktop.
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
const splitCharacters = (str) => str.split(''); | |
const splitWords = (str) => str.split(' '); | |
const combineAllCharacters = (str) => str.join(''); | |
const filter = (fn) => (array) => array.filter(fn); | |
const map = (fn) => (array) => array.map(fn); | |
const append = (text) => (value) => value + text; | |
const removeTheLetter = (letter) => (sentence) => | |
sentence | |
|> splitCharacters | |
|> filter(c => c !== letter) | |
|> combineAllCharacters; | |
const makeLetterUpperCase = (letter) => (sentence) => | |
sentence | |
|> splitCharacters | |
|> map(c => c === letter ? c.toUpperCase() : c) | |
|> combineAllCharacters; | |
const removeWordsWithLessThanFourLetters = (sentence) => | |
sentence | |
|> splitWords | |
|> filter(word => word.length > 4 ) | |
|> combineAllCharacters; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment