re: Daily Challenge #3 - Vowel Counter VIEW POST

TOP OF THREAD FULL DISCUSSION
re: import { compose } from 'crocks'; const toLowerCase = s => s.toLowerCase(); const spread = s => [...s]; const length = xs => xs.length; c...
 

You could replace the import of compose with a tiny implementation of it that looks like this (and could be shortened to one line if you really want to):

const identity = (x) => x;
const compose2 = (f, g) => (x) => f(g(x));
const compose = (...funcs) => funcs.reduce(compose2, identity);
 

Could also

const compose = (...fns) => fns.reduce((f, g) => (...args) => (f(g(...args)));
code of conduct - report abuse