knip
Version:
Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects
14 lines (13 loc) • 378 B
JavaScript
import { debugLogObject } from './debug.js';
export const unwrapFunction = async (maybeFunction) => {
if (typeof maybeFunction === 'function') {
try {
return await maybeFunction();
}
catch (error) {
debugLogObject('*', 'Error executing function:', error);
throw error;
}
}
return maybeFunction;
};