This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a function that calls all the functions passed to it, with the same arguments. | |
* @example <div onClick={callAll(f, g, h)} /> | |
* @param {...any} fns - Functions to call (left-to-right execution) | |
* @returns {Function} | |
*/ | |
export const callAll = | |
(...fns) => | |
(...args) => | |
fns.forEach(fn => isFunctionThenInvoke(fn, args, undefined)); |