update to state of the art
This commit is contained in:
24
node_modules/abab/lib/atob.js
generated
vendored
24
node_modules/abab/lib/atob.js
generated
vendored
@@ -84,24 +84,14 @@ function atob(data) {
|
||||
* A lookup table for atob(), which converts an ASCII character to the
|
||||
* corresponding six-bit number.
|
||||
*/
|
||||
|
||||
const keystr =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
function atobLookup(chr) {
|
||||
if (/[A-Z]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "A".charCodeAt(0);
|
||||
}
|
||||
if (/[a-z]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "a".charCodeAt(0) + 26;
|
||||
}
|
||||
if (/[0-9]/.test(chr)) {
|
||||
return chr.charCodeAt(0) - "0".charCodeAt(0) + 52;
|
||||
}
|
||||
if (chr === "+") {
|
||||
return 62;
|
||||
}
|
||||
if (chr === "/") {
|
||||
return 63;
|
||||
}
|
||||
// Throw exception; should not be hit in tests
|
||||
return undefined;
|
||||
const index = keystr.indexOf(chr);
|
||||
// Throw exception if character is not in the lookup string; should not be hit in tests
|
||||
return index < 0 ? undefined : index;
|
||||
}
|
||||
|
||||
module.exports = atob;
|
||||
|
22
node_modules/abab/lib/btoa.js
generated
vendored
22
node_modules/abab/lib/btoa.js
generated
vendored
@@ -43,22 +43,14 @@ function btoa(s) {
|
||||
* Lookup table for btoa(), which converts a six-bit number into the
|
||||
* corresponding ASCII character.
|
||||
*/
|
||||
function btoaLookup(idx) {
|
||||
if (idx < 26) {
|
||||
return String.fromCharCode(idx + "A".charCodeAt(0));
|
||||
}
|
||||
if (idx < 52) {
|
||||
return String.fromCharCode(idx - 26 + "a".charCodeAt(0));
|
||||
}
|
||||
if (idx < 62) {
|
||||
return String.fromCharCode(idx - 52 + "0".charCodeAt(0));
|
||||
}
|
||||
if (idx === 62) {
|
||||
return "+";
|
||||
}
|
||||
if (idx === 63) {
|
||||
return "/";
|
||||
const keystr =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
function btoaLookup(index) {
|
||||
if (index >= 0 && index < 64) {
|
||||
return keystr[index];
|
||||
}
|
||||
|
||||
// Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests.
|
||||
return undefined;
|
||||
}
|
||||
|
Reference in New Issue
Block a user