UNPKG

@clerk/shared

Version:

Internal package utils used by the Clerk SDKs

1 lines 817 B
{"version":3,"file":"isomorphicAtob.mjs","names":[],"sources":["../src/isomorphicAtob.ts"],"sourcesContent":["/**\n * A function that decodes a string of data which has been encoded using base-64 encoding.\n * Uses `atob` if available, otherwise uses `Buffer` from `globalThis`. If neither are available, returns the data as-is.\n */\nexport const isomorphicAtob = (data: string) => {\n if (typeof atob !== 'undefined' && typeof atob === 'function') {\n return atob(data);\n } else if (typeof globalThis.Buffer !== 'undefined') {\n return globalThis.Buffer.from(data, 'base64').toString();\n }\n return data;\n};\n"],"mappings":";;;;;AAIA,MAAa,kBAAkB,SAAiB;CAC9C,IAAI,OAAO,SAAS,eAAe,OAAO,SAAS,YACjD,OAAO,KAAK,IAAI;MACX,IAAI,OAAO,WAAW,WAAW,aACtC,OAAO,WAAW,OAAO,KAAK,MAAM,QAAQ,CAAC,CAAC,SAAS;CAEzD,OAAO;AACT"}