// a function that composes any number of functions const compose = (..fns) => x => fns.reduceRight((acc, fn) => fn(acc), x);