UNPKG

@withstudiocms/config-utils

Version:

Utilities for managing configuration files

16 lines (15 loc) 348 B
async function tryCatch(fnOrValue) { try { const result = typeof fnOrValue === "function" ? fnOrValue() : fnOrValue; if (result instanceof Promise) { const resolvedResult = await result; return [resolvedResult, null]; } return [result, null]; } catch (error) { return [null, error]; } } export { tryCatch };