"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.callAll = callAll;
exports.noop = noop;
exports.runIfFn = runIfFn;
const assertion_1 = require("./assertion");
/** Calls each provided function with the same set of arguments. Useful for merging multiple callbacks. */
function callAll(...fns) {
    return (...args) => fns.forEach(fn => typeof fn === 'function' && fn(...args));
}
// Used as a safe default to be called when no function is provided.
function noop() { }
/**
 * If given value is a function, it's called with any additional arguments provided.
 * Otherwise, the provided value is returned directly.
 */
function runIfFn(valueOrFn, ...args) {
    return (0, assertion_1.isFunction)(valueOrFn) ? valueOrFn(...args) : valueOrFn;
}
//# sourceMappingURL=function.js.map