Updated eslint whitespace rules

This commit is contained in:
n1474335 2017-02-09 15:09:33 +00:00
parent ebf2258715
commit e803d208e8
51 changed files with 801 additions and 793 deletions

View file

@ -113,7 +113,7 @@ Chef.prototype.silentBake = function(recipeConfig) {
try {
recipe.execute(dish);
} catch(err) {
} catch (err) {
// Suppress all errors
}
return new Date().getTime() - startTime;

View file

@ -100,7 +100,7 @@ Dish.enumLookup = function(typeEnum) {
Dish.prototype.set = function(value, type) {
this.value = value;
this.type = type;
if (!this.valid()) {
var sample = Utils.truncate(JSON.stringify(this.value), 13);
throw "Data is not a valid " + Dish.enumLookup(type) + ": " + sample;
@ -145,7 +145,7 @@ Dish.prototype.translate = function(toType) {
default:
break;
}
// Convert from byteArray to toType
switch (toType) {
case Dish.STRING:
@ -175,7 +175,7 @@ Dish.prototype.valid = function() {
if (!(this.value instanceof Array)) {
return false;
}
// Check that every value is a number between 0 - 255
for (var i = 0; i < this.value.length; i++) {
if (typeof this.value[i] != "number" ||

View file

@ -24,7 +24,7 @@ var FlowControl = {
* @default
*/
FORK_IGNORE_ERRORS: false,
/**
* Fork operation.
*
@ -45,10 +45,10 @@ var FlowControl = {
ignoreErrors = ings[2],
subOpList = [],
inputs = [];
if (input)
inputs = input.split(splitDelim);
// Create subOpList for each tranche to operate on
// (all remaining operations unless we encounter a Merge)
for (var i = state.progress + 1; i < opList.length; i++) {
@ -58,19 +58,19 @@ var FlowControl = {
subOpList.push(opList[i]);
}
}
var recipe = new Recipe(),
output = "",
progress = 0;
recipe.addOperations(subOpList);
// Run recipe over each tranche
for (i = 0; i < inputs.length; i++) {
var dish = new Dish(inputs[i], inputType);
try {
progress = recipe.execute(dish, 0);
} catch(err) {
} catch (err) {
if (!ignoreErrors) {
throw err;
}
@ -78,13 +78,13 @@ var FlowControl = {
}
output += dish.get(outputType) + mergeDelim;
}
state.dish.set(output, outputType);
state.progress += progress;
return state;
},
/**
* Merge operation.
*
@ -99,8 +99,8 @@ var FlowControl = {
// merge when it sees this operation.
return state;
},
/**
* @constant
* @default
@ -111,7 +111,7 @@ var FlowControl = {
* @default
*/
MAX_JUMPS: 10,
/**
* Jump operation.
*
@ -126,18 +126,18 @@ var FlowControl = {
var ings = state.opList[state.progress].getIngValues(),
jumpNum = ings[0],
maxJumps = ings[1];
if (state.numJumps >= maxJumps) {
state.progress++;
return state;
}
state.progress += jumpNum;
state.numJumps++;
return state;
},
/**
* Conditional Jump operation.
*
@ -154,21 +154,21 @@ var FlowControl = {
regexStr = ings[0],
jumpNum = ings[1],
maxJumps = ings[2];
if (state.numJumps >= maxJumps) {
state.progress++;
return state;
}
if (regexStr !== "" && dish.get(Dish.STRING).search(regexStr) > -1) {
state.progress += jumpNum;
state.numJumps++;
}
return state;
},
/**
* Return operation.
*
@ -182,5 +182,5 @@ var FlowControl = {
state.progress = state.opList.length;
return state;
},
};

View file

@ -12,7 +12,7 @@ var Ingredient = function(ingredientConfig) {
this.name = "";
this.type = "";
this.value = null;
if (ingredientConfig) {
this._parseConfig(ingredientConfig);
}

View file

@ -20,7 +20,7 @@ var Operation = function(operationName, operationConfig) {
this.breakpoint = false;
this.disabled = false;
this.ingList = [];
if (operationConfig) {
this._parseConfig(operationConfig);
}
@ -57,16 +57,16 @@ Operation.prototype._parseConfig = function(operationConfig) {
*/
Operation.prototype.getConfig = function() {
var ingredientConfig = [];
for (var o = 0; o < this.ingList.length; o++) {
ingredientConfig.push(this.ingList[o].getConfig());
}
var operationConfig = {
"op": this.name,
"args": ingredientConfig
};
return operationConfig;
};

View file

@ -10,7 +10,7 @@
*/
var Recipe = function(recipeConfig) {
this.opList = [];
if (recipeConfig) {
this._parseConfig(recipeConfig);
}
@ -43,11 +43,11 @@ Recipe.prototype._parseConfig = function(recipeConfig) {
*/
Recipe.prototype.getConfig = function() {
var recipeConfig = [];
for (var o = 0; o < this.opList.length; o++) {
recipeConfig.push(this.opList[o].getConfig());
}
return recipeConfig;
};
@ -123,13 +123,13 @@ Recipe.prototype.containsFlowControl = function() {
Recipe.prototype.lastOpIndex = function(startIndex) {
var i = startIndex + 1 || 0,
op;
for (; i < this.opList.length; i++) {
op = this.opList[i];
if (op.isDisabled()) return i-1;
if (op.isBreakpoint()) return i-1;
}
return i-1;
};
@ -144,7 +144,7 @@ Recipe.prototype.lastOpIndex = function(startIndex) {
Recipe.prototype.execute = function(dish, startFrom) {
startFrom = startFrom || 0;
var op, input, output, numJumps = 0;
for (var i = startFrom; i < this.opList.length; i++) {
op = this.opList[i];
if (op.isDisabled()) {
@ -153,10 +153,10 @@ Recipe.prototype.execute = function(dish, startFrom) {
if (op.isBreakpoint()) {
return i;
}
try {
input = dish.get(op.inputType);
if (op.isFlowControl()) {
// Package up the current state
var state = {
@ -165,7 +165,7 @@ Recipe.prototype.execute = function(dish, startFrom) {
"opList" : this.opList,
"numJumps" : numJumps
};
state = op.run(state);
i = state.progress;
numJumps = state.numJumps;
@ -184,11 +184,11 @@ Recipe.prototype.execute = function(dish, startFrom) {
} else {
e.displayStr = op.name + " - " + (e.displayStr || e.message);
}
throw e;
}
}
return this.opList.length;
};

View file

@ -922,8 +922,8 @@ var Utils = {
* @returns {Object}
*/
extend: function(a, b){
for(var key in b)
if(b.hasOwnProperty(key))
for (var key in b)
if (b.hasOwnProperty(key))
a[key] = b[key];
return a;
},
@ -1169,7 +1169,6 @@ String.prototype.count = function(chr) {
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Library overrides ///////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////