mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-02 20:00:05 +02:00
update node modules
This commit is contained in:
41
node_modules/abab/lib/btoa.js
generated
vendored
41
node_modules/abab/lib/btoa.js
generated
vendored
@@ -1,23 +1,23 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* btoa() as defined by the HTML5 spec, which mostly just references RFC4648.
|
||||
* btoa() as defined by the HTML and Infra specs, which mostly just references
|
||||
* RFC 4648.
|
||||
*/
|
||||
function btoa(s) {
|
||||
var i;
|
||||
// String conversion as required by WebIDL.
|
||||
s = String(s);
|
||||
// "The btoa() method must throw an INVALID_CHARACTER_ERR exception if the
|
||||
// method's first argument contains any character whose code point is
|
||||
// greater than U+00FF."
|
||||
let i;
|
||||
// String conversion as required by Web IDL.
|
||||
s = `${s}`;
|
||||
// "The btoa() method must throw an "InvalidCharacterError" DOMException if
|
||||
// data contains any character whose code point is greater than U+00FF."
|
||||
for (i = 0; i < s.length; i++) {
|
||||
if (s.charCodeAt(i) > 255) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
var out = '';
|
||||
let out = "";
|
||||
for (i = 0; i < s.length; i += 3) {
|
||||
var groupsOfSix = [undefined, undefined, undefined, undefined];
|
||||
const groupsOfSix = [undefined, undefined, undefined, undefined];
|
||||
groupsOfSix[0] = s.charCodeAt(i) >> 2;
|
||||
groupsOfSix[1] = (s.charCodeAt(i) & 0x03) << 4;
|
||||
if (s.length > i + 1) {
|
||||
@@ -28,9 +28,9 @@ function btoa(s) {
|
||||
groupsOfSix[2] |= s.charCodeAt(i + 2) >> 6;
|
||||
groupsOfSix[3] = s.charCodeAt(i + 2) & 0x3f;
|
||||
}
|
||||
for (var j = 0; j < groupsOfSix.length; j++) {
|
||||
if (typeof groupsOfSix[j] == 'undefined') {
|
||||
out += '=';
|
||||
for (let j = 0; j < groupsOfSix.length; j++) {
|
||||
if (typeof groupsOfSix[j] === "undefined") {
|
||||
out += "=";
|
||||
} else {
|
||||
out += btoaLookup(groupsOfSix[j]);
|
||||
}
|
||||
@@ -45,21 +45,22 @@ function btoa(s) {
|
||||
*/
|
||||
function btoaLookup(idx) {
|
||||
if (idx < 26) {
|
||||
return String.fromCharCode(idx + 'A'.charCodeAt(0));
|
||||
return String.fromCharCode(idx + "A".charCodeAt(0));
|
||||
}
|
||||
if (idx < 52) {
|
||||
return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));
|
||||
return String.fromCharCode(idx - 26 + "a".charCodeAt(0));
|
||||
}
|
||||
if (idx < 62) {
|
||||
return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));
|
||||
return String.fromCharCode(idx - 52 + "0".charCodeAt(0));
|
||||
}
|
||||
if (idx == 62) {
|
||||
return '+';
|
||||
if (idx === 62) {
|
||||
return "+";
|
||||
}
|
||||
if (idx == 63) {
|
||||
return '/';
|
||||
if (idx === 63) {
|
||||
return "/";
|
||||
}
|
||||
// Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
module.exports = btoa;
|
||||
|
Reference in New Issue
Block a user