MCPcopy Create free account
hub / github.com/docker/getting-started / createChainedFunction

Function createChainedFunction

app/src/static/js/react-bootstrap.js:9325–9347  ·  view source on GitHub ↗

* Safe chained function * * Will only create a new function if needed, * otherwise will pass back existing functions or null. * * @param {function} functions to chain * @returns {function|null}

()

Source from the content-addressed store, hash-verified

9323 * @returns {function|null}
9324 */
9325function createChainedFunction() {
9326 for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
9327 funcs[_key] = arguments[_key];
9328 }
9329
9330 return funcs.filter(function (f) {
9331 return f != null;
9332 }).reduce(function (acc, f) {
9333 if (typeof f !== 'function') {
9334 throw new Error('Invalid Argument Type, must only provide functions, undefined, or null.');
9335 }
9336
9337 if (acc === null) return f;
9338 return function chainedFunction() {
9339 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
9340 args[_key2] = arguments[_key2];
9341 }
9342
9343 acc.apply(this, args);
9344 f.apply(this, args);
9345 };
9346 }, null);
9347}
9348
9349/* harmony default export */ var utils_createChainedFunction = (createChainedFunction);
9350// CONCATENATED MODULE: ./src/Collapse.js

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…