From f44695186bf146ded185c1ff4cd89587c98ab602 Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Sun, 5 Jun 2016 14:20:51 +0100 Subject: [PATCH] lint encoding --- app/app/utils/encoding.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/app/utils/encoding.js b/app/app/utils/encoding.js index 8f033859..60baf1b6 100644 --- a/app/app/utils/encoding.js +++ b/app/app/utils/encoding.js @@ -28,13 +28,13 @@ var Base64 = { u = (r & 15) << 2 | i >> 6; a = i & 63; if (isNaN(r)) { - u = a = 64 + u = a = 64; } else if (isNaN(i)) { - a = 64 + a = 64; } - t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a) + t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a); } - return t + return t; }, decode: function(e) { var t = ""; @@ -51,15 +51,15 @@ var Base64 = { r = (o & 15) << 4 | u >> 2; i = (u & 3) << 6 | a; t = t + String.fromCharCode(n); - if (u != 64) { - t = t + String.fromCharCode(r) + if (u !== 64) { + t = t + String.fromCharCode(r); } - if (a != 64) { - t = t + String.fromCharCode(i) + if (a !== 64) { + t = t + String.fromCharCode(i); } } t = Base64._utf8_decode(t); - return t + return t; }, _utf8_encode: function(e) { e = e.replace(/\r\n/g, "\n"); @@ -67,10 +67,10 @@ var Base64 = { for (var n = 0; n < e.length; n++) { var r = e.charCodeAt(n); if (r < 128) { - t += String.fromCharCode(r) + t += String.fromCharCode(r); } else if (r > 127 && r < 2048) { t += String.fromCharCode(r >> 6 | 192); - t += String.fromCharCode(r & 63 | 128) + t += String.fromCharCode(r & 63 | 128); } else { t += String.fromCharCode(r >> 12 | 224); t += String.fromCharCode(r >> 6 & 63 | 128); @@ -82,7 +82,9 @@ var Base64 = { _utf8_decode: function(e) { var t = ""; var n = 0; - var r = c1 = c2 = 0; + let r = 0; + // let c1 = 0; + let c2 = 0; while (n < e.length) { r = e.charCodeAt(n); if (r < 128) { @@ -94,7 +96,7 @@ var Base64 = { n += 2; } else { c2 = e.charCodeAt(n + 1); - c3 = e.charCodeAt(n + 2); + let c3 = e.charCodeAt(n + 2); t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63); n += 3; }