diff --git a/scripts/build.js b/scripts/build.js index 2eba5bc0e..dc270b4cf 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -181,7 +181,7 @@ try { for (const tag of tags) { const capitalizedTag = capitalize(tag, true); // ![advanced](/advanced.svg) - if (capitalizedTag == 'Uncategorized') { + if (capitalizedTag === 'Uncategorized') { uncategorizedOutput += `---\n ## _${capitalizedTag}_\n`; for (const taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) { uncategorizedOutput += `\n${snippets[taggedSnippet[0] + '.md'] + diff --git a/scripts/web.js b/scripts/web.js index 36864f989..972258edd 100644 --- a/scripts/web.js +++ b/scripts/web.js @@ -156,7 +156,7 @@ try { for (let tag of [...new Set(Object.entries(tagDbData).map(t => t[1][0]))] .filter(v => v) .sort((a, b) => a.localeCompare(b))) { - if (capitalize(tag, true) == 'Uncategorized') { + if (capitalize(tag, true) === 'Uncategorized') { uncategorizedOutput += md .render(`## ${capitalize(tag, true)}\n`) .replace(/

/g, '

'); diff --git a/snippets/flatten.md b/snippets/flatten.md index 63bec4b0d..d39dd9467 100644 --- a/snippets/flatten.md +++ b/snippets/flatten.md @@ -9,7 +9,7 @@ Omit the second argument, `depth` to flatten only to a depth of `1` (single flat ```js const flatten = (arr, depth = 1) => - depth != 1 + depth !== 1 ? arr.reduce((a, v) => a.concat(Array.isArray(v) ? flatten(v, depth - 1) : v), []) : arr.reduce((a, v) => a.concat(v), []); ``` diff --git a/snippets/isPrime.md b/snippets/isPrime.md index daee794f3..0b09bda15 100644 --- a/snippets/isPrime.md +++ b/snippets/isPrime.md @@ -8,7 +8,7 @@ Return `false` if any of them divides the given number, else return `true`, unle ```js const isPrime = num => { const boundary = Math.floor(Math.sqrt(num)); - for (var i = 2; i <= boundary; i++) if (num % i == 0) return false; + for (var i = 2; i <= boundary; i++) if (num % i === 0) return false; return num >= 2; }; ``` diff --git a/snippets/join.md b/snippets/join.md index 7803534f1..c91fd38c2 100644 --- a/snippets/join.md +++ b/snippets/join.md @@ -10,9 +10,9 @@ Omit the third argument, `end`, to use the same value as `separator` by default. const join = (arr, separator = ',', end = separator) => arr.reduce( (acc, val, i) => - i == arr.length - 2 + i === arr.length - 2 ? acc + val + end - : i == arr.length - 1 ? acc + val : acc + val + separator, + : i === arr.length - 1 ? acc + val : acc + val + separator, '' ); ``` diff --git a/snippets/negate.md b/snippets/negate.md index c00ce6e8c..3dd3843da 100644 --- a/snippets/negate.md +++ b/snippets/negate.md @@ -9,5 +9,5 @@ const negate = func => (...args) => !func(...args); ``` ```js -[1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 == 0)); // [ 1, 3, 5 ] +[1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 === 0)); // [ 1, 3, 5 ] ``` diff --git a/snippets/primes.md b/snippets/primes.md index 8ca6b4d0b..8d3747510 100644 --- a/snippets/primes.md +++ b/snippets/primes.md @@ -9,7 +9,7 @@ const primes = num => { let arr = Array.from({ length: num - 1 }).map((x, i) => i + 2), sqroot = Math.floor(Math.sqrt(num)), numsTillSqroot = Array.from({ length: sqroot - 1 }).map((x, i) => i + 2); - numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y == x))); + numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y === x))); return arr; }; ``` diff --git a/snippets/remove.md b/snippets/remove.md index 560da6b0c..8acaacaa2 100644 --- a/snippets/remove.md +++ b/snippets/remove.md @@ -16,5 +16,5 @@ const remove = (arr, func) => ``` ```js -remove([1, 2, 3, 4], n => n % 2 == 0); // [2, 4] +remove([1, 2, 3, 4], n => n % 2 === 0); // [2, 4] ``` diff --git a/snippets_archive/collatz.md b/snippets_archive/collatz.md index 9562895a6..998039a5e 100644 --- a/snippets_archive/collatz.md +++ b/snippets_archive/collatz.md @@ -5,7 +5,7 @@ Applies the Collatz algorithm. If `n` is even, return `n/2`. Otherwise, return `3n+1`. ```js -const collatz = n => (n % 2 == 0 ? n / 2 : 3 * n + 1); +const collatz = n => (n % 2 === 0 ? n / 2 : 3 * n + 1); ``` ```js diff --git a/test/collatz/collatz.js b/test/collatz/collatz.js index 185344cd3..f29036272 100644 --- a/test/collatz/collatz.js +++ b/test/collatz/collatz.js @@ -1,2 +1,2 @@ -const collatz = n => (n % 2 == 0 ? n / 2 : 3 * n + 1); +const collatz = n => (n % 2 === 0 ? n / 2 : 3 * n + 1); module.exports = collatz; \ No newline at end of file diff --git a/test/collatz/collatz.test.js b/test/collatz/collatz.test.js index 73ce78109..5b177db8d 100644 --- a/test/collatz/collatz.test.js +++ b/test/collatz/collatz.test.js @@ -11,14 +11,14 @@ test('Testing collatz', (t) => { let n = 9; while(true){ - if (n == 1){ + if (n === 1){ t.pass('Eventually reaches 1'); break; } n = collatz(n); } - + //t.false(collatz(args..), 'Expected'); //t.throws(collatz(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/flatten/flatten.js b/test/flatten/flatten.js index 185cda9e8..585aa5a37 100644 --- a/test/flatten/flatten.js +++ b/test/flatten/flatten.js @@ -1,5 +1,5 @@ const flatten = (arr, depth = 1) => -depth != 1 +depth !== 1 ? arr.reduce((a, v) => a.concat(Array.isArray(v) ? flatten(v, depth - 1) : v), []) : arr.reduce((a, v) => a.concat(v), []); module.exports = flatten; \ No newline at end of file diff --git a/test/isPrime/isPrime.js b/test/isPrime/isPrime.js index 8bcd42264..e1526b111 100644 --- a/test/isPrime/isPrime.js +++ b/test/isPrime/isPrime.js @@ -1,6 +1,6 @@ const isPrime = num => { const boundary = Math.floor(Math.sqrt(num)); -for (var i = 2; i <= boundary; i++) if (num % i == 0) return false; +for (var i = 2; i <= boundary; i++) if (num % i === 0) return false; return num >= 2; }; module.exports = isPrime; \ No newline at end of file diff --git a/test/join/join.js b/test/join/join.js index 05eb45f90..e3f836304 100644 --- a/test/join/join.js +++ b/test/join/join.js @@ -1,9 +1,9 @@ const join = (arr, separator = ',', end = separator) => arr.reduce( (acc, val, i) => -i == arr.length - 2 +i === arr.length - 2 ? acc + val + end -: i == arr.length - 1 ? acc + val : acc + val + separator, +: i === arr.length - 1 ? acc + val : acc + val + separator, '' ); module.exports = join; \ No newline at end of file diff --git a/test/negate/negate.test.js b/test/negate/negate.test.js index 8e85ef475..a356b8a2d 100644 --- a/test/negate/negate.test.js +++ b/test/negate/negate.test.js @@ -5,10 +5,10 @@ test('Testing negate', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof negate === 'function', 'negate is a Function'); - t.deepEqual([1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 == 0)), [1, 3, 5], "Negates a predicate function"); + t.deepEqual([1, 2, 3, 4, 5, 6].filter(negate(n => n % 2 === 0)), [1, 3, 5], "Negates a predicate function"); //t.deepEqual(negate(args..), 'Expected'); //t.equal(negate(args..), 'Expected'); //t.false(negate(args..), 'Expected'); //t.throws(negate(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/primes/primes.js b/test/primes/primes.js index 0c66ca826..9b8d435b8 100644 --- a/test/primes/primes.js +++ b/test/primes/primes.js @@ -2,7 +2,7 @@ const primes = num => { let arr = Array.from({ length: num - 1 }).map((x, i) => i + 2), sqroot = Math.floor(Math.sqrt(num)), numsTillSqroot = Array.from({ length: sqroot - 1 }).map((x, i) => i + 2); -numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y == x))); +numsTillSqroot.forEach(x => (arr = arr.filter(y => y % x !== 0 || y === x))); return arr; }; module.exports = primes; \ No newline at end of file diff --git a/test/remove/remove.test.js b/test/remove/remove.test.js index 0300c8c2a..64c00696c 100644 --- a/test/remove/remove.test.js +++ b/test/remove/remove.test.js @@ -5,10 +5,10 @@ test('Testing remove', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof remove === 'function', 'remove is a Function'); - t.deepEqual(remove([1, 2, 3, 4], n => n % 2 == 0), [2, 4], "Removes elements from an array for which the given function returns false"); + t.deepEqual(remove([1, 2, 3, 4], n => n % 2 === 0), [2, 4], "Removes elements from an array for which the given function returns false"); //t.deepEqual(remove(args..), 'Expected'); //t.equal(remove(args..), 'Expected'); //t.false(remove(args..), 'Expected'); //t.throws(remove(args..), 'Expected'); t.end(); -}); \ No newline at end of file +}); diff --git a/test/testlog b/test/testlog index 9a8c8f78c..43b1a79e5 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Sun Feb 04 2018 17:37:55 GMT+0200 (GTB Standard Time) +Test log for: Sun Feb 04 2018 17:47:43 GMT+0200 (GTB Standard Time) > 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code > tape test/**/*.test.js | tap-spec @@ -1711,6 +1711,6 @@ Test log for: Sun Feb 04 2018 17:37:55 GMT+0200 (GTB Standard Time) total: 813 passing: 813 - duration: 2.5s + duration: 2.4s