Fix all the lint noise, mostly semicolons, duplicate var definitions and ==0

This commit is contained in:
Robert Nelson
2014-01-02 12:24:10 -08:00
parent 17ad1f5fed
commit dba6f379e8
49 changed files with 379 additions and 380 deletions

View File

@@ -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;
}

View File

@@ -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
}
};