first commit

This commit is contained in:
rayd1o committed 2026-03-05 11:46:58 +08:00
commit e7033775d8
20657 files changed
+1988940

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
/**
* 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);
}
}
};
}