Merge branch 'no-var-rule' of https://github.com/graingert/CyberChef into graingert-no-var-rule

This commit is contained in:
n1474335 2017-05-02 22:28:17 +01:00
commit d3377d56b4
65 changed files with 779 additions and 756 deletions

View file

@ -100,7 +100,7 @@ const StrUtils = {
* @returns {html}
*/
runRegex: function(input, args) {
var userRegex = args[1],
let userRegex = args[1],
i = args[2],
m = args[3],
displayTotal = args[4],
@ -112,7 +112,7 @@ const StrUtils = {
if (userRegex && userRegex !== "^" && userRegex !== "$") {
try {
var regex = new RegExp(userRegex, modifiers);
const regex = new RegExp(userRegex, modifiers);
switch (outputFormat) {
case "Highlight matches":
@ -149,7 +149,7 @@ const StrUtils = {
* @returns {string}
*/
runUpper: function (input, args) {
var scope = args[0];
const scope = args[0];
switch (scope) {
case "Word":
@ -213,7 +213,7 @@ const StrUtils = {
* @returns {string}
*/
runFindReplace: function(input, args) {
var find = args[0].string,
let find = args[0].string,
type = args[0].option,
replace = args[1],
g = args[2],
@ -257,7 +257,7 @@ const StrUtils = {
* @returns {string}
*/
runSplit: function(input, args) {
var splitDelim = args[0] || StrUtils.SPLIT_DELIM,
let splitDelim = args[0] || StrUtils.SPLIT_DELIM,
joinDelim = Utils.charRep[args[1]],
sections = input.split(splitDelim);
@ -274,16 +274,17 @@ const StrUtils = {
* @returns {string}
*/
runFilter: function(input, args) {
var delim = Utils.charRep[args[0]],
let delim = Utils.charRep[args[0]],
regex,
reverse = args[2];
try {
var regex = new RegExp(args[1]);
regex = new RegExp(args[1]);
} catch (err) {
return "Invalid regex. Details: " + err.message;
}
var regexFilter = function(value) {
const regexFilter = function(value) {
return reverse ^ regex.test(value);
};
@ -310,7 +311,7 @@ const StrUtils = {
* @returns {html}
*/
runDiff: function(input, args) {
var sampleDelim = args[0],
let sampleDelim = args[0],
diffBy = args[1],
showAdded = args[2],
showRemoved = args[3],
@ -354,7 +355,7 @@ const StrUtils = {
return "Invalid 'Diff by' option.";
}
for (var i = 0; i < diff.length; i++) {
for (let i = 0; i < diff.length; i++) {
if (diff[i].added) {
if (showAdded) output += "<span class='hlgreen'>" + Utils.escapeHtml(diff[i].value) + "</span>";
} else if (diff[i].removed) {
@ -382,7 +383,7 @@ const StrUtils = {
* @returns {html}
*/
runOffsetChecker: function(input, args) {
var sampleDelim = args[0],
let sampleDelim = args[0],
samples = input.split(sampleDelim),
outputs = [],
i = 0,
@ -526,7 +527,7 @@ const StrUtils = {
* @returns {string}
*/
_regexHighlight: function(input, regex, displayTotal) {
var output = "",
let output = "",
m,
hl = 1,
i = 0,
@ -568,7 +569,7 @@ const StrUtils = {
* @returns {string}
*/
_regexList: function(input, regex, displayTotal, matches, captureGroups) {
var output = "",
let output = "",
total = 0,
match;
@ -578,7 +579,7 @@ const StrUtils = {
output += match[0] + "\n";
}
if (captureGroups) {
for (var i = 1; i < match.length; i++) {
for (let i = 1; i < match.length; i++) {
if (matches) {
output += " Group " + i + ": ";
}