UNPKG

@sentry/core

Version:
25 lines (24 loc) • 695 B
// src/utils/get-default-export.ts /** * Often we patch a module's default export, but we want to be able to do * something like this: * * ```ts * patchTheThing(await import('the-thing')); * ``` * * Or like this: * * ```ts * import theThing from 'the-thing'; * patchTheThing(theThing); * ``` * * Note: this does not support modules with a falsey default export. However, * presumably in those cases, there's no default export to patch anyway. */ function getDefaultExport(moduleExport) { return !!moduleExport && typeof moduleExport === "object" && "default" in moduleExport && moduleExport.default || moduleExport; } export { getDefaultExport }; //# sourceMappingURL=get-default-export.js.map