UNPKG

tickethead-sdk

Version:

SDK for the Tickethead API

19 lines 631 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tryCatch = tryCatch; /** Utility function which resolves a promise and returns a result type, allowing for cleaner error handling. */ function tryCatch(arg) { if (typeof arg === 'function') { try { const result = arg(); return result instanceof Promise ? tryCatch(result) : { data: result }; } catch (error) { return { error: error }; } } return arg .then((data) => ({ data })) .catch((error) => ({ error: error })); } //# sourceMappingURL=try.js.map