@techmely/utils
Version:
Collection of helpful JavaScript / TypeScript utils
26 lines (22 loc) • 482 B
JavaScript
/*!
* @techmely/utils
* Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com>
* MIT Licensed
*/
;
(() => {
// src/isFunction.ts
function isFunction(val) {
return typeof val === "function";
}
// 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;
}
})();