This repository has been archived on 2024-09-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
front/node_modules/@mui/utils/esm/createChainedFunction/createChainedFunction.js
2024-09-18 13:34:19 -03:00

17 lines
414 B
JavaScript

/**
* Safe chained function.
*
* Will only create a new function if needed,
* otherwise will pass back existing functions or null.
*/
export default function createChainedFunction(...funcs) {
return funcs.reduce((acc, func) => {
if (func == null) {
return acc;
}
return function chainedFunction(...args) {
acc.apply(this, args);
func.apply(this, args);
};
}, () => {});
}