summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
8e60c62)
The convention is to use `===` in situations where type·casting is
known not occur.
? $
: hasOwnProperty($, "raw")
? rawString(
? $
: hasOwnProperty($, "raw")
? rawString(
},
);
const { length } = u4s;
},
);
const { length } = u4s;
+ if (length % 2 === 1) {
// The length is such that an entire letter would be dropped during
// a forgiving decode.
throw new RangeError(
// The length is such that an entire letter would be dropped during
// a forgiving decode.
throw new RangeError(
const u5s = map(
wrmg
? stringReplace(source, /-/gu, "")
const u5s = map(
wrmg
? stringReplace(source, /-/gu, "")
- : source.length % 8 == 0
+ : source.length % 8 === 0
? stringReplace(source, /(?:=|={3,4}|={6})$/u, "")
: source,
(ucsCharacter) => {
? stringReplace(source, /(?:=|={3,4}|={6})$/u, "")
: source,
(ucsCharacter) => {
? code - 48
: code >= 0x41 && code <= 0x48
? code - 55
? code - 48
: code >= 0x41 && code <= 0x48
? code - 55
? 1 // I
: code >= 0x4A && code <= 0x4B
? code - 56
? 1 // I
: code >= 0x4A && code <= 0x4B
? code - 56
? 1 // L
: code >= 0x4D && code <= 0x4E
? code - 57
? 1 // L
: code >= 0x4D && code <= 0x4E
? code - 57
? 0 // O
: code >= 0x50 && code <= 0x54
? code - 58
? 0 // O
: code >= 0x50 && code <= 0x54
? code - 58
? code - 59
: code >= 0x61 && code <= 0x68
? code - 87
? code - 59
: code >= 0x61 && code <= 0x68
? code - 87
? 1 // i
: code >= 0x6A && code <= 0x6B
? code - 88
? 1 // i
: code >= 0x6A && code <= 0x6B
? code - 88
? 1 // l
: code >= 0x6D && code <= 0x6E
? code - 89
? 1 // l
: code >= 0x6D && code <= 0x6E
? code - 89
? 0 // o
: code >= 0x70 && code <= 0x74
? code - 90
? 0 // o
: code >= 0x70 && code <= 0x74
? code - 90
);
const { length } = u5s;
const lengthMod8 = length % 8;
);
const { length } = u5s;
const lengthMod8 = length % 8;
- if (lengthMod8 == 1 || lengthMod8 == 3 || lengthMod8 == 6) {
+ if (lengthMod8 === 1 || lengthMod8 === 3 || lengthMod8 === 6) {
// The length is such that an entire letter would be dropped during
// a forgiving decode.
throw new RangeError(
// The length is such that an entire letter would be dropped during
// a forgiving decode.
throw new RangeError(
// decode” behaviour specified by WhatW·G for base64.
const dataIndex = ceil(index * 5 / 8);
const remainder = index % 8;
// decode” behaviour specified by WhatW·G for base64.
const dataIndex = ceil(index * 5 / 8);
const remainder = index % 8;
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 3 | u5s[++index] >> 2,
]);
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 3 | u5s[++index] >> 2,
]);
- } else if (remainder == 1) {
+ } else if (remainder === 1) {
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 6 | u5s[++index] << 1 | u5s[++index] >> 4,
]);
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 6 | u5s[++index] << 1 | u5s[++index] >> 4,
]);
- } else if (remainder == 3) {
+ } else if (remainder === 3) {
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 4 | u5s[++index] >> 1,
]);
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 4 | u5s[++index] >> 1,
]);
- } else if (remainder == 4) {
+ } else if (remainder === 4) {
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 7 | u5s[++index] << 2 | u5s[++index] >> 3,
]);
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 7 | u5s[++index] << 2 | u5s[++index] >> 3,
]);
- } else { // remainder == 6
+ } else { // remainder === 6
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 5 | u5s[++index, index++],
call(viewSetUint8, dataView, [
dataIndex,
u5s[index] << 5 | u5s[++index, index++],
*/
const decodeBase64 = (source, safe = false) => {
const u6s = map(
*/
const decodeBase64 = (source, safe = false) => {
const u6s = map(
+ source.length % 4 === 0
? stringReplace(source, /={1,2}$/u, "")
: source,
(ucsCharacter) => {
? stringReplace(source, /={1,2}$/u, "")
: source,
(ucsCharacter) => {
? code - 71
: code >= 0x30 && code <= 0x39
? code + 4
? code - 71
: code >= 0x30 && code <= 0x39
? code + 4
- : code == (safe ? 0x2D : 0x2B)
+ : code === (safe ? 0x2D : 0x2B)
- : code == (safe ? 0x5F : 0x2F)
+ : code === (safe ? 0x5F : 0x2F)
? 63
: -1;
if (result < 0) {
? 63
: -1;
if (result < 0) {
},
);
const { length } = u6s;
},
);
const { length } = u6s;
+ if (length % 4 === 1) {
// The length is such that an entire letter would be dropped during
// a forgiving decode.
throw new RangeError(
// The length is such that an entire letter would be dropped during
// a forgiving decode.
throw new RangeError(
// decode” behaviour specified by WhatW·G for base64.
const dataIndex = ceil(index * 3 / 4);
const remainder = index % 4;
// decode” behaviour specified by WhatW·G for base64.
const dataIndex = ceil(index * 3 / 4);
const remainder = index % 4;
call(viewSetUint8, dataView, [
dataIndex,
u6s[index] << 2 | u6s[++index] >> 4,
]);
call(viewSetUint8, dataView, [
dataIndex,
u6s[index] << 2 | u6s[++index] >> 4,
]);
- } else if (remainder == 1) {
+ } else if (remainder === 1) {
call(viewSetUint8, dataView, [
dataIndex,
u6s[index] << 4 | u6s[++index] >> 2,
]);
call(viewSetUint8, dataView, [
dataIndex,
u6s[index] << 4 | u6s[++index] >> 2,
]);
- } else { // remainder == 2
+ } else { // remainder === 2
call(viewSetUint8, dataView, [
dataIndex,
u6s[index] << 6 | u6s[++index, index++],
call(viewSetUint8, dataView, [
dataIndex,
u6s[index] << 6 | u6s[++index, index++],
// digits 1, 3, 4 & 6 span multiple bytes
? call(viewGetUint8, dataView, [index])
: 0;
// digits 1, 3, 4 & 6 span multiple bytes
? call(viewGetUint8, dataView, [index])
: 0;
- const u5 = remainder == 0
+ const u5 = remainder === 0
? (currentByte & 0b00000111) << 2 | nextByte >> 6
? (currentByte & 0b00000111) << 2 | nextByte >> 6
? (currentByte & 0b00111111) >> 1
? (currentByte & 0b00111111) >> 1
? (currentByte & 0b00000001) << 4 | nextByte >> 4
? (currentByte & 0b00000001) << 4 | nextByte >> 4
? (currentByte & 0b00001111) << 1 | nextByte >> 7
? (currentByte & 0b00001111) << 1 | nextByte >> 7
? (currentByte & 0b01111111) >> 2
? (currentByte & 0b01111111) >> 2
? (currentByte & 0b00000011) << 3 | nextByte >> 5
? (currentByte & 0b00000011) << 3 | nextByte >> 5
- : (++index, currentByte & 0b00011111); // remainder == 7
+ : (++index, currentByte & 0b00011111); // remainder === 7
const result = wrmg
? u5 < 10 ? u5 + 48 : u5 < 18
? u5 + 55
const result = wrmg
? u5 < 10 ? u5 + 48 : u5 < 18
? u5 + 55
for (let index = 0; index < byteLength;) {
const codeUnitIndex = ceil(index * 4 / 3);
const currentIndex = codeUnitIndex + +(
for (let index = 0; index < byteLength;) {
const codeUnitIndex = ceil(index * 4 / 3);
const currentIndex = codeUnitIndex + +(
- index % 3 == 0 && resultingCodeUnits[codeUnitIndex] != 0x3D
+ index % 3 === 0 && resultingCodeUnits[codeUnitIndex] != 0x3D
); // every third byte handles two letters; this is for the second
const remainder = currentIndex % 4;
const currentByte = call(viewGetUint8, dataView, [index]);
); // every third byte handles two letters; this is for the second
const remainder = currentIndex % 4;
const currentByte = call(viewGetUint8, dataView, [index]);
// digits 1 & 2 span multiple bytes
? call(viewGetUint8, dataView, [index])
: 0;
// digits 1 & 2 span multiple bytes
? call(viewGetUint8, dataView, [index])
: 0;
- const u6 = remainder == 0
+ const u6 = remainder === 0
? (currentByte & 0b00000011) << 4 | nextByte >> 4
? (currentByte & 0b00000011) << 4 | nextByte >> 4
? (currentByte & 0b00001111) << 2 | nextByte >> 6
? (currentByte & 0b00001111) << 2 | nextByte >> 6
- : (++index, currentByte & 0b00111111); // remainder == 3
+ : (++index, currentByte & 0b00111111); // remainder === 3
const result = u6 < 26
? u6 + 65
: u6 < 52
const result = u6 < 26
? u6 + 65
: u6 < 52
*/
const sourceFromArgs = ($, $s) =>
stringReplace(
*/
const sourceFromArgs = ($, $s) =>
stringReplace(
- typeof $ == "string" ? $ : hasOwnProperty($, "raw")
+ typeof $ === "string" ? $ : hasOwnProperty($, "raw")
? rawString(
$,
...objectCreate(argumentIterablePrototype, {
? rawString(
$,
...objectCreate(argumentIterablePrototype, {
return false;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
return false;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
- return source.length % 2 != 1 &&
- call(reExec, /[^0-9A-F]/iu, [source]) == null;
+ return source.length % 2 !== 1 &&
+ call(reExec, /[^0-9A-F]/iu, [source]) === null;
return false;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
return false;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
- const trimmed = source.length % 8 == 0
+ const trimmed = source.length % 8 === 0
? stringReplace(source, /(?:=|={3,4}|={6})$/u, "")
: source;
? stringReplace(source, /(?:=|={3,4}|={6})$/u, "")
: source;
- return trimmed.length % 8 != 1 &&
- call(reExec, /[^2-7A-Z/]/iu, [trimmed]) == null;
+ return trimmed.length % 8 !== 1 &&
+ call(reExec, /[^2-7A-Z/]/iu, [trimmed]) === null;
return false;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
return false;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
- const trimmed = source.length % 4 == 0
+ const trimmed = source.length % 4 === 0
? stringReplace(source, /={1,2}$/u, "")
: source;
? stringReplace(source, /={1,2}$/u, "")
: source;
- return trimmed.length % 4 != 1 &&
- call(reExec, /[^0-9A-Za-z+\/]/u, [trimmed]) == null;
+ return trimmed.length % 4 !== 1 &&
+ call(reExec, /[^0-9A-Za-z+\/]/u, [trimmed]) === null;
return false;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
return false;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
- const trimmed = source.length % 4 == 0
+ const trimmed = source.length % 4 === 0
? stringReplace(source, /={1,2}$/u, "")
: source;
? stringReplace(source, /={1,2}$/u, "")
: source;
- return trimmed.length % 4 != 1 &&
- call(reExec, /[^0-9A-Za-z_-]/u, [trimmed]) == null;
+ return trimmed.length % 4 !== 1 &&
+ call(reExec, /[^0-9A-Za-z_-]/u, [trimmed]) === null;
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
const trimmed = stringReplace(source, /-/gu, "");
} else {
const source = stringReplace($, /[\t\n\f\r ]+/gu, "");
const trimmed = stringReplace(source, /-/gu, "");
- return trimmed.length % 8 != 1 &&
- call(reExec, /[^0-9A-TV-Z]/iu, [trimmed]) == null;
+ return trimmed.length % 8 !== 1 &&
+ call(reExec, /[^0-9A-TV-Z]/iu, [trimmed]) === null;