feat(filters): Add base64_encode and base64_decode filters for Shopify compatibility (#828)

* feat(filters): add base64 encode and decode

* fix: use Object.defineProperty for cross-platform btoa/atob mocking

* docs(filters): update docs

* docs(filters): update version
This commit is contained in:
Omri Rosner
2025-10-27 22:40:31 +08:00
committed by GitHub
parent 5d953132e8
commit 86fc135d9e
10 changed files with 282 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
export function base64Encode (str: string): string {
return btoa(String.fromCharCode(...new TextEncoder().encode(str)))
}
export function base64Decode (str: string): string {
return new TextDecoder().decode(
Uint8Array.from(atob(str), c => c.charCodeAt(0))
)
}