fixed mixup of atob / btoa
Cette révision appartient à :
Parent
aacae887e8
révision
65407a29d0
2
index.js
2
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;
|
||||
|
5
test.js
5
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;
|
||||
}
|
||||
|
||||
|
Chargement…
x
Référencer dans un nouveau ticket
Bloquer un utilisateur