NuclearDispersionSystem/ant-design-vue-jeecg/node_modules/ant-design-vue/es/_util/createChainedFunction.js
2023-09-14 14:47:11 +08:00

22 lines
493 B
Java

/**
* Safe chained function
*
* Will only create a new function if needed,
* otherwise will pass back existing functions or null.
*
* @returns {function|null}
*/
export default function createChainedFunction() {
var args = [].slice.call(arguments, 0);
if (args.length === 1) {
return args[0];
}
return function chainedFunction() {
for (var i = 0; i < args.length; i++) {
if (args[i] && args[i].apply) {
args[i].apply(this, arguments);
}
}
};
}