Added alphabet check before decoding #7

Open
Ghost wants to merge 3 commits from (deleted):master into master
1 changed files with 3 additions and 3 deletions
Showing only changes of commit 34dd70eb8d - Show all commits

View File

@ -2,9 +2,9 @@
"use strict"; "use strict";
var atob = require('.'); var atob = require('.');
var encoded = "SGVsbG8sIFdvcmxkIQ==" var encoded = "SGVsbG8sIFdvcmxkIQ==";
var unencoded = "Hello, World!"; var unencoded = "Hello, World!";
var malformed = "SGVsbG8s{" var malformed = "SGVsbG8s{";
/* /*
, encoded = "SGVsbG8sIBZM" , encoded = "SGVsbG8sIBZM"
, unencoded = "Hello, 世界" , unencoded = "Hello, 世界"
@ -16,7 +16,7 @@
} }
try { try {
const decoded = atob(malformed) var decoded = atob(malformed);
console.log('[FAIL]', malformed, decoded); console.log('[FAIL]', malformed, decoded);
return; return;
} catch (_) { } catch (_) {