mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-12 13:28:32 +03:00
lint: Use isNaN rather than identity equals comparison
This commit is contained in:
committed by
Lachie Kermode
parent
e418043d6b
commit
5bad1ed452
@@ -41,7 +41,7 @@ class StoreJson {
|
|||||||
// Do a lookup if fragment is included to filter a relevant item
|
// Do a lookup if fragment is included to filter a relevant item
|
||||||
// When the resource requested is 'ids'
|
// When the resource requested is 'ids'
|
||||||
const id = parseInt(parts[3]);
|
const id = parseInt(parts[3]);
|
||||||
if (id !== NaN && id >= 0 && id < data.length) {
|
if (!isNaN(id) && id >= 0 && id < data.length) {
|
||||||
return data[id];
|
return data[id];
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Fragment index does not exist`);
|
throw new Error(`Fragment index does not exist`);
|
||||||
@@ -49,7 +49,7 @@ class StoreJson {
|
|||||||
} else {
|
} else {
|
||||||
// Do a lookup if fragment is included to filter a relevant item
|
// Do a lookup if fragment is included to filter a relevant item
|
||||||
const index = parseInt(parts[3]);
|
const index = parseInt(parts[3]);
|
||||||
if (index !== NaN && index >= 0 && index < data.length) {
|
if (!isNaN(index) && index >= 0 && index < data.length) {
|
||||||
console.log(data, index);
|
console.log(data, index);
|
||||||
return data.filter((vl, idx) => idx === index)[0];
|
return data.filter((vl, idx) => idx === index)[0];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user