From 8f6f796ce23d01db6721959050b60bf3e66a444c Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 2 Aug 2018 12:02:29 +0300 Subject: [PATCH] Codacy issue fixes --- snippets/filterNonUniqueBy.md | 2 +- test/filterNonUniqueBy/filterNonUniqueBy.js | 2 +- test/filterNonUniqueBy/filterNonUniqueBy.test.js | 4 ++-- test/uniqueElementsBy/uniqueElementsBy.test.js | 4 ++-- test/uniqueElementsByRight/uniqueElementsByRight.test.js | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/snippets/filterNonUniqueBy.md b/snippets/filterNonUniqueBy.md index 61b9fcc27..e8293bf66 100644 --- a/snippets/filterNonUniqueBy.md +++ b/snippets/filterNonUniqueBy.md @@ -7,7 +7,7 @@ The comparator function takes four arguments: the values of the two elements bei ```js const filterNonUniqueBy = (arr, fn) => - arr.filter((v, i) => arr.every((x, j) => (i == j) == fn(v, x, i, j))); + arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j))); ``` ```js diff --git a/test/filterNonUniqueBy/filterNonUniqueBy.js b/test/filterNonUniqueBy/filterNonUniqueBy.js index 5de53193c..cd70011e7 100644 --- a/test/filterNonUniqueBy/filterNonUniqueBy.js +++ b/test/filterNonUniqueBy/filterNonUniqueBy.js @@ -1,3 +1,3 @@ const filterNonUniqueBy = (arr, fn) => -arr.filter((v, i) => arr.every((x, j) => (i == j) == fn(v, x, i, j))); +arr.filter((v, i) => arr.every((x, j) => (i === j) === fn(v, x, i, j))); module.exports = filterNonUniqueBy; \ No newline at end of file diff --git a/test/filterNonUniqueBy/filterNonUniqueBy.test.js b/test/filterNonUniqueBy/filterNonUniqueBy.test.js index b73fb8f26..a5e33a37e 100644 --- a/test/filterNonUniqueBy/filterNonUniqueBy.test.js +++ b/test/filterNonUniqueBy/filterNonUniqueBy.test.js @@ -14,7 +14,7 @@ test('filterNonUniqueBy works for properties', () => { { id: 1, value: 'd' }, { id: 0, value: 'e' }, ], - (a, b) => a.id == b.id + (a, b) => a.id === b.id )).toEqual([ { id: 2, value: 'c' } ]); }); @@ -27,6 +27,6 @@ test('filterNonUniqueBy works for nested properties', () => { { id: 1, value: 'd', n: {p: 0} }, { id: 0, value: 'e', n: {p: 1} }, ], - (a, b) => a.id == b.id + (a, b) => a.id === b.id )).toEqual([ { id: 2, value: 'c', n: {p: 2} } ]); }); diff --git a/test/uniqueElementsBy/uniqueElementsBy.test.js b/test/uniqueElementsBy/uniqueElementsBy.test.js index aa5293336..1ed83a6e5 100644 --- a/test/uniqueElementsBy/uniqueElementsBy.test.js +++ b/test/uniqueElementsBy/uniqueElementsBy.test.js @@ -14,7 +14,7 @@ test('uniqueElementsBy works for properties', () => { { id: 1, value: 'd' }, { id: 0, value: 'e' }, ], - (a, b) => a.id == b.id + (a, b) => a.id === b.id )).toEqual([ { id: 0, value: 'a' }, { id: 1, value: 'b' }, { id: 2, value: 'c' } ]); }); @@ -27,6 +27,6 @@ test('uniqueElementsBy works for nested properties', () => { { id: 1, value: 'd', n: {p: 0} }, { id: 0, value: 'e', n: {p: 1} }, ], - (a, b) => a.id == b.id + (a, b) => a.id === b.id )).toEqual([ { id: 0, value: 'a', n: {p: 0} }, { id: 1, value: 'b', n: {p: 1} }, { id: 2, value: 'c', n: {p: 2} } ]); }); diff --git a/test/uniqueElementsByRight/uniqueElementsByRight.test.js b/test/uniqueElementsByRight/uniqueElementsByRight.test.js index aeed58d36..0c1469184 100644 --- a/test/uniqueElementsByRight/uniqueElementsByRight.test.js +++ b/test/uniqueElementsByRight/uniqueElementsByRight.test.js @@ -14,7 +14,7 @@ test('uniqueElementsByRight works for properties', () => { { id: 1, value: 'd' }, { id: 0, value: 'e' }, ], - (a, b) => a.id == b.id + (a, b) => a.id === b.id )).toEqual([ { id: 0, value: 'e' }, { id: 1, value: 'd' }, { id: 2, value: 'c' } ]); }); @@ -27,6 +27,6 @@ test('uniqueElementsByRight works for nested properties', () => { { id: 1, value: 'd', n: {p: 0} }, { id: 0, value: 'e', n: {p: 1} }, ], - (a, b) => a.id == b.id + (a, b) => a.id === b.id )).toEqual([ { id: 0, value: 'e', n: {p: 1} }, { id: 1, value: 'd', n: {p: 0} }, { id: 2, value: 'c', n: {p: 2} } ]); });