@techmely/utils
Version:
Collection of helpful JavaScript / TypeScript utils
15 lines (12 loc) • 306 B
JavaScript
import { isFunction } from './chunk-XD2YO3MV.mjs';
// src/callOrReturn.ts
function callOrReturn(value, context = void 0, ...props) {
if (isFunction(value)) {
if (context) {
return value.bind(context)(...props);
}
return value(...props);
}
return value;
}
export { callOrReturn };