UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

27 lines (21 loc) 478 B
'use strict'; /*! * @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; } exports.callOrReturn = callOrReturn;