1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = createChainedFunction;
|
7 | /**
|
8 | * Safe chained function
|
9 | *
|
10 | * Will only create a new function if needed,
|
11 | * otherwise will pass back existing functions or null.
|
12 | *
|
13 | * @returns {function|null}
|
14 | */
|
15 | function createChainedFunction() {
|
16 | var args = [].slice.call(arguments, 0);
|
17 | if (args.length === 1) {
|
18 | return args[0];
|
19 | }
|
20 | return function chainedFunction() {
|
21 | for (var i = 0; i < args.length; i++) {
|
22 | if (args[i] && args[i].apply) {
|
23 | args[i].apply(this, arguments);
|
24 | }
|
25 | }
|
26 | };
|
27 | } |
\ | No newline at end of file |