UNPKG

@ekwoka/alpine-history

Version:
14 lines (12 loc) 471 B
globalThis.btoa ??= (str) => Buffer.from(str).toString("base64"); globalThis.atob ??= (str) => Buffer.from(str, "base64").toString(); const base64 = { to: (value) => btoa(value), from: (value) => atob(value) }; const base64URL = { to: (value) => btoa(value).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", ""), from: (value) => atob(value.replaceAll("-", "+").replaceAll("_", "/")) }; export { base64, base64URL }; //# sourceMappingURL=encoding.js.map