From 65407a29d0677a6519c9e1921de798bb53e50b5c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 9 Sep 2011 14:56:22 -0600 Subject: [PATCH] fixed mixup of atob / btoa --- index.js | 2 +- test.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 65bfaf5..72ddb40 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ "use strict"; function atob(str) { - return new Buffer(str, 'utf8').toString('base64'); + return new Buffer(str, 'base64').toString('utf8'); } module.exports = atob; diff --git a/test.js b/test.js index 65fb01d..38e5ffe 100644 --- a/test.js +++ b/test.js @@ -2,11 +2,12 @@ "use strict"; var atob = require('./index') - , expected = "SGVsbG8gV29ybGQ=" + , encoded = "SGVsbG8gV29ybGQ=" + , unencoded = "Hello World" , result ; - if (expected !== atob("Hello World")) { + if (unencoded !== atob(encoded)) { return; }