Disallow nested ternaries

This commit is contained in:
Juanjo Diaz 2018-07-14 01:39:55 +02:00
parent 3ab566204d
commit 8eedf9e7c6
3 changed files with 14 additions and 3 deletions

View File

@ -339,7 +339,7 @@
"no-negated-condition": "off",
// disallow nested ternary expressions
// "no-nested-ternary": "error",
"no-nested-ternary": "error",
// disallow use of the Object constructor
"no-new-object": "error",

View File

@ -144,7 +144,16 @@ export default function DES(passwd) {
kn = [];
for (let j = 0, l = 56; j < 56; ++j, l -= 8) {
l += l < -5 ? 65 : l < -3 ? 31 : l < -1 ? 63 : l === 27 ? 35 : 0; // PC1
// PC1
if (l < -5) {
l += 65;
} else if (l < -3) {
l += 31;
} else if (l < -1) {
l += 63;
} else if (l === 27) {
l += 35;
}
const m = l & 0x7;
pc1m[j] = ((keyBlock[l >>> 3] & (1 << m)) !== 0) ? 1 : 0;
}

View File

@ -11,7 +11,9 @@
*/
export function getPointerEvent(e) {
return e.changedTouches ? e.changedTouches[0] : e.touches ? e.touches[0] : e;
if (e.changedTouches) return e.changedTouches[0];
if (e.touches) return e.touches[0];
return e;
}
export function stopEvent(e) {