mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-06 09:01:29 +00:00
Fix all the lint noise, mostly semicolons, duplicate var definitions and ==0
This commit is contained in:
@@ -213,7 +213,7 @@ function splitHeaders(text) {
|
||||
|
||||
var matchResult = reEmptyLine.exec(text);
|
||||
|
||||
if (matchResult != null) {
|
||||
if (matchResult !== null) {
|
||||
headers = text.slice(0, matchResult.index);
|
||||
body = text.slice(matchResult.index + matchResult[0].length);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ function splitChecksum(text) {
|
||||
|
||||
var matchResult = reChecksumStart.exec(text);
|
||||
|
||||
if (matchResult != null) {
|
||||
if (matchResult !== null) {
|
||||
body = text.slice(0, matchResult.index);
|
||||
checksum = text.slice(matchResult.index + 1);
|
||||
}
|
||||
@@ -268,14 +268,14 @@ function dearmor(text) {
|
||||
// so we know the index of the data we are interested in.
|
||||
var indexBase = 1;
|
||||
|
||||
var result, checksum;
|
||||
var result, checksum, msg;
|
||||
|
||||
if (text.search(reSplit) != splittext[0].length) {
|
||||
indexBase = 0;
|
||||
}
|
||||
|
||||
if (type != 2) {
|
||||
var msg = splitHeaders(splittext[indexBase]);
|
||||
msg = splitHeaders(splittext[indexBase]);
|
||||
var msg_sum = splitChecksum(msg.body);
|
||||
|
||||
result = {
|
||||
@@ -286,7 +286,7 @@ function dearmor(text) {
|
||||
checksum = msg_sum.checksum;
|
||||
} else {
|
||||
// Reverse dash-escaping for msg and remove trailing whitespace at end of line
|
||||
var msg = splitHeaders(splittext[indexBase].replace(/^- /mg, '').replace(/[\t ]+\n/g, "\n"));
|
||||
msg = splitHeaders(splittext[indexBase].replace(/^- /mg, '').replace(/[\t ]+\n/g, "\n"));
|
||||
var sig = splitHeaders(splittext[indexBase + 1].replace(/^- /mg, ''));
|
||||
var sig_sum = splitChecksum(sig.body);
|
||||
|
||||
@@ -300,10 +300,10 @@ function dearmor(text) {
|
||||
}
|
||||
|
||||
if (!verifyCheckSum(result.data, checksum)) {
|
||||
throw new Error("Ascii armor integrity check on message failed: '"
|
||||
+ checksum
|
||||
+ "' should be '"
|
||||
+ getCheckSum(result) + "'");
|
||||
throw new Error("Ascii armor integrity check on message failed: '" +
|
||||
checksum +
|
||||
"' should be '" +
|
||||
getCheckSum(result) + "'");
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ function s2r(t) {
|
||||
|
||||
for (n = 0; n < tl; n++) {
|
||||
c = t.charCodeAt(n);
|
||||
if (s == 0) {
|
||||
if (s === 0) {
|
||||
r += b64s.charAt((c >> 2) & 63);
|
||||
a = (c & 3) << 4;
|
||||
} else if (s == 1) {
|
||||
@@ -41,12 +41,12 @@ function s2r(t) {
|
||||
} else if (s == 2) {
|
||||
r += b64s.charAt(a | ((c >> 6) & 3));
|
||||
l += 1;
|
||||
if ((l % 60) == 0)
|
||||
if ((l % 60) === 0)
|
||||
r += "\n";
|
||||
r += b64s.charAt(c & 63);
|
||||
}
|
||||
l += 1;
|
||||
if ((l % 60) == 0)
|
||||
if ((l % 60) === 0)
|
||||
r += "\n";
|
||||
|
||||
s += 1;
|
||||
@@ -56,13 +56,13 @@ function s2r(t) {
|
||||
if (s > 0) {
|
||||
r += b64s.charAt(a);
|
||||
l += 1;
|
||||
if ((l % 60) == 0)
|
||||
if ((l % 60) === 0)
|
||||
r += "\n";
|
||||
r += '=';
|
||||
l += 1;
|
||||
}
|
||||
if (s == 1) {
|
||||
if ((l % 60) == 0)
|
||||
if ((l % 60) === 0)
|
||||
r += "\n";
|
||||
r += '=';
|
||||
}
|
||||
@@ -98,4 +98,4 @@ function r2s(t) {
|
||||
module.exports = {
|
||||
encode: s2r,
|
||||
decode: r2s
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user