Last active
December 23, 2019 13:55
-
-
Save CodyKochmann/2d58a1f4cec5be8de6e0 to your computer and use it in GitHub Desktop.
small base64 object for easy encoding/decoding with b64.e() and b64.d()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class b64 | |
constructor:()->@ | |
e:(a)-> window.btoa unescape(encodeURIComponent(a)) | |
d:(a)-> decodeURIComponent escape(window.atob(a)) | |
eval:(a)-> eval decodeURIComponent(escape(window.atob(a))) | |
b64 = new b64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var b64=function(){ | |
// small base64 object for easy encoding/decoding with b64.e and b64.d | |
// b64.eval() evaluates base64 stored javascript | |
// by: Cody Kochmann | |
this.e = function(a){return(window.btoa(unescape(encodeURIComponent(a))))}; | |
this.d = function(a){return(decodeURIComponent(escape(window.atob(a))))}; | |
this.eval = function(a){return(eval(decodeURIComponent(escape(window.atob(a)))))}; | |
} | |
b64=new b64(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment