Array.prototype.map()
and Function.prototype.apply()
to apply each function to the given arguments.const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args));
const minMax = over(Math.min, Math.max); minMax(1, 2, 3, 4, 5); // [1, 5]
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️