Codacy issue fixes
This commit is contained in:
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -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} } ]);
|
||||
});
|
||||
|
||||
@ -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} } ]);
|
||||
});
|
||||
|
||||
@ -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} } ]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user