mirror of
https://github.com/bellingcat/datasheet-server.git
synced 2026-06-08 03:18:33 +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
|
||||
// When the resource requested is 'ids'
|
||||
const id = parseInt(parts[3]);
|
||||
if (id !== NaN && id >= 0 && id < data.length) {
|
||||
if (!isNaN(id) && id >= 0 && id < data.length) {
|
||||
return data[id];
|
||||
} else {
|
||||
throw new Error(`Fragment index does not exist`);
|
||||
@@ -49,7 +49,7 @@ class StoreJson {
|
||||
} else {
|
||||
// Do a lookup if fragment is included to filter a relevant item
|
||||
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);
|
||||
return data.filter((vl, idx) => idx === index)[0];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user