@clerk/shared
Version:
Internal package utils used by the Clerk SDKs
16 lines (14 loc) • 666 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
//#region src/isomorphicAtob.ts
/**
* A function that decodes a string of data which has been encoded using base-64 encoding.
* Uses `atob` if available, otherwise uses `Buffer` from `globalThis`. If neither are available, returns the data as-is.
*/
const isomorphicAtob = (data) => {
if (typeof atob !== "undefined" && typeof atob === "function") return atob(data);
else if (typeof globalThis.Buffer !== "undefined") return globalThis.Buffer.from(data, "base64").toString();
return data;
};
//#endregion
exports.isomorphicAtob = isomorphicAtob;
//# sourceMappingURL=isomorphicAtob.js.map