Created
March 4, 2024 21:12
-
-
Save jpblancoder/53c7e8e6fb66372342d8085d009b4e16 to your computer and use it in GitHub Desktop.
Revisions
-
jpblancoder created this gist
Mar 4, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ /** * 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));