Merge branch 'v9' of github.com:gchq/CyberChef into node-lib

This commit is contained in:
d98762625 2019-07-05 13:10:44 +01:00
commit 0de89f3145
28 changed files with 386 additions and 303 deletions

View file

@ -184,10 +184,10 @@ class PairMapBase {
// self-stecker
return;
}
if (this.map.hasOwnProperty(a)) {
if (Object.prototype.hasOwnProperty.call(this.map, a)) {
throw new OperationError(`${name} connects ${pair[0]} more than once`);
}
if (this.map.hasOwnProperty(b)) {
if (Object.prototype.hasOwnProperty.call(this.map, b)) {
throw new OperationError(`${name} connects ${pair[1]} more than once`);
}
this.map[a] = b;
@ -203,7 +203,7 @@ class PairMapBase {
* @returns {number}
*/
transform(c) {
if (!this.map.hasOwnProperty(c)) {
if (!Object.prototype.hasOwnProperty.call(this.map, c)) {
return c;
}
return this.map[c];

View file

@ -338,7 +338,7 @@ class Magic {
}
// Prune branches that result in unhelpful outputs
results = results.filter(r =>
const prunedResults = results.filter(r =>
(r.useful || r.data.length > 0) && // The operation resulted in ""
( // One of the following must be true
r.languageScores[0].probability > 0 || // Some kind of language was found
@ -349,7 +349,7 @@ class Magic {
);
// Return a sorted list of possible recipes along with their properties
return results.sort((a, b) => {
return prunedResults.sort((a, b) => {
// Each option is sorted based on its most likely language (lower is better)
let aScore = a.languageScores[0].score,
bScore = b.languageScores[0].score;
@ -450,7 +450,7 @@ class Magic {
const opPatterns = [];
for (const op in OperationConfig) {
if (!OperationConfig[op].hasOwnProperty("patterns")) continue;
if (!("patterns" in OperationConfig[op])) continue;
OperationConfig[op].patterns.forEach(pattern => {
opPatterns.push({

View file

@ -124,7 +124,7 @@ class Protobuf {
// Get the field key/values
const key = field.key;
const value = field.value;
object[key] = object.hasOwnProperty(key) ?
object[key] = Object.prototype.hasOwnProperty.call(object, key) ?
object[key] instanceof Array ?
object[key].concat([value]) :
[object[key], value] :

View file

@ -98,14 +98,14 @@ export class TypexMachine extends Enigma.EnigmaBase {
if (x === " ") {
inputMod += "X";
} else if (mode) {
if (KEYBOARD_REV.hasOwnProperty(x)) {
if (Object.prototype.hasOwnProperty.call(KEYBOARD_REV, x)) {
inputMod += KEYBOARD_REV[x];
} else {
mode = false;
inputMod += "V" + x;
}
} else {
if (KEYBOARD_REV.hasOwnProperty(x)) {
if (Object.prototype.hasOwnProperty.call(KEYBOARD_REV, x)) {
mode = true;
inputMod += "Z" + KEYBOARD_REV[x];
} else {