diff options
Diffstat (limited to 'js/b.js')
-rw-r--r-- | js/b.js | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/js/b.js b/js/b.js index d1d44b2..52a34af 100644 --- a/js/b.js +++ b/js/b.js @@ -22,29 +22,29 @@ const b = { }; -// pipe -const title = '10 Weird Facts About Dogs'; -const toLowerCase = (str) => str.toLowerCase(); -const addHyphens = (str) => str.replace(/\s/g, '-'); -const reverseText = (str) => (str === '') ? '' : reverseText(str.substr(1)) + str.charAt(0); -const slug = b.pipe(title, toLowerCase, addHyphens, reverseText); -console.log('pipe ', slug); - - -// compose -const toUpperCase = x => x.toUpperCase(); -const exclaim = x => `${x}!`; -const shout = b.compose(exclaim, toUpperCase); -const ret = shout('send in the clowns'); // "SEND IN THE CLOWNS!" -console.log('compose ', ret); - - -// curry family -const hasLetterR = b.match(/r/g); -const r1 = hasLetterR('hello world'); -const r2 = hasLetterR('just j and s and t etc'); -const r3 = b.filter(hasLetterR, ['rock and roll', 'smooth jazz']); -const noVowels = b.replace(/[aeiou]/ig); -const censored = noVowels('*'); -const r4 = censored('Chocolate Rain'); -console.log('curry ', r1, r2, r3, r4); \ No newline at end of file +// // pipe +// const title = '10 Weird Facts About Dogs'; +// const toLowerCase = (str) => str.toLowerCase(); +// const addHyphens = (str) => str.replace(/\s/g, '-'); +// const reverseText = (str) => (str === '') ? '' : reverseText(str.substr(1)) + str.charAt(0); +// const slug = b.pipe(title, toLowerCase, addHyphens, reverseText); +// console.log('pipe ', slug); + + +// // compose +// const toUpperCase = x => x.toUpperCase(); +// const exclaim = x => `${x}!`; +// const shout = b.compose(exclaim, toUpperCase); +// const ret = shout('send in the clowns'); // "SEND IN THE CLOWNS!" +// console.log('compose ', ret); + + +// // curry family +// const hasLetterR = b.match(/r/g); +// const r1 = hasLetterR('hello world'); +// const r2 = hasLetterR('just j and s and t etc'); +// const r3 = b.filter(hasLetterR, ['rock and roll', 'smooth jazz']); +// const noVowels = b.replace(/[aeiou]/ig); +// const censored = noVowels('*'); +// const r4 = censored('Chocolate Rain'); +// console.log('curry ', r1, r2, r3, r4); \ No newline at end of file |