froebel
Version:
TypeScript utility library
26 lines (22 loc) • 606 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* Take a list of functions that accept the same parameters and call them all
* with the provided arguments.
*
* @example
* ```
* const mult = (a: number, b: number) => a * b
* const div = (a: number, b: number) => a / b
*
* // prints: [8, 2]
* console.log( callAll([mult, div], 4, 2) )
* ```
*/
const callAll = (funs, ...args) => funs.map(cb => cb(...args)) ?? [];
var _default = callAll;
exports.default = _default;
module.exports = Object.assign(exports.default || {}, exports);