@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
20 lines (18 loc) • 687 B
JavaScript
import { isFunction } from "./assertion.js";
//#region src/utils/function.ts
/** 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));
}
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 isFunction(valueOrFn) ? valueOrFn(...args) : valueOrFn;
}
//#endregion
export { callAll, noop, runIfFn };
globalThis.__vuiVersion__ = "5.3.1"
//# sourceMappingURL=function.js.map