From 5bad1ed45200d5cf7f0df02f8bdd0c14752607a6 Mon Sep 17 00:00:00 2001 From: Scott Carver Date: Sun, 11 Nov 2018 13:46:52 -0800 Subject: [PATCH] lint: Use isNaN rather than identity equals comparison --- src/models/StoreJson.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/StoreJson.js b/src/models/StoreJson.js index 560dd2f..45983e7 100644 --- a/src/models/StoreJson.js +++ b/src/models/StoreJson.js @@ -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 {