spanish-quizzer

An app to quiz you on Spanish vocabulary and verb conjugations
git clone https://git.ashermorgan.net/spanish-quizzer/
Log | Files | Refs | README

commit b2ac9213cc5c3bb1df71ef52206b3a6b8d6135ee
parent b9fe8fed134f0226f06388a0ad1fd6d2857771eb
Author: AsherMorgan <59518073+AsherMorgan@users.noreply.github.com>
Date:   Fri, 27 Mar 2020 11:43:40 -0700

Enforce style in Filter.js.

Diffstat:
MFilter.js | 39+++++++++++++--------------------------
1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/Filter.js b/Filter.js @@ -1,8 +1,6 @@ -class Filter -{ +class Filter { // Create a new Filter - constructor(io, value) - { + constructor(io, value) { // Set variables this.IO = io; // Format: [[<output index>, <input index>]] this.Value = value; // Format: [[<index>, [<values>], exclude?]] @@ -10,28 +8,21 @@ class Filter // Apply the filter to a vocabulary set - Apply(vocabSet) - { + Apply(vocabSet) { // Filter terms by value var vSet = vocabSet.slice(1); // Format: same as vocabSet but without headers - for (var i = 0; i < this.Value.length; i++) - { - for (var j = 0; j < vSet.length; j++) - { - if (this.Value[i][2]) - { + for (var i = 0; i < this.Value.length; i++) { + for (var j = 0; j < vSet.length; j++) { + if (this.Value[i][2]) { // Exclude values - if (this.Value[i][1].includes(vSet[j][this.Value[i][0]])) - { + if (this.Value[i][1].includes(vSet[j][this.Value[i][0]])) { vSet.splice(j, 1); // Remove item j--; // Adjust for the removal of an item } } - else - { + else { // Include values - if (!this.Value[i][1].includes(vSet[j][this.Value[i][0]])) - { + if (!this.Value[i][1].includes(vSet[j][this.Value[i][0]])) { vSet.splice(j, 1); // Remove item j--; // Adjust for the removal of an item } @@ -41,10 +32,8 @@ class Filter // Filter terms by input/output var ioSet = []; // Format: [<output type>, <output>, <input type>, <input>] - for (var i = 0; i < this.IO.length; i++) - { - for (var j = 0; j < vSet.length; j++) - { + for (var i = 0; i < this.IO.length; i++) { + for (var j = 0; j < vSet.length; j++) { ioSet.push([vocabSet[0][this.IO[i][0]], vSet[j][this.IO[i][0]], vocabSet[0][this.IO[i][1]], vSet[j][this.IO[i][1]]]); } } @@ -56,10 +45,8 @@ class Filter // Get a common filter - static GetFilter(name) - { - switch (name) - { + static GetFilter(name) { + switch (name) { case "None": return new Filter([], []);