Created
July 10, 2016 23:45
-
-
Save ikr7/1855a259aedee0e31f2afb41ea7d5b50 to your computer and use it in GitHub Desktop.
何重にも Base64 エンコードされたやつをデコードするやつ
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
'use strict'; | |
const decode = function (str) { | |
if(str.split('').every((ch) => { | |
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.indexOf(ch) > -1; | |
})) { | |
return decode(Buffer.from(str, 'base64').toString()); | |
} else { | |
return str; | |
} | |
}; | |
console.log( | |
decode('Vm0weE1HRXdNVWRXV0doWFYwZG9WbGxVU2xOV2JHeHlWMjFHV2xadVFsbFpNM0JIWVdzeFYyTklhRlppVkZaTVZsVmFWMVpWTVVWaGVqQTk=') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment