From d1f4887b036966e008f7c413867308092d0d15a7 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 31 Jan 2018 20:11:12 +0000 Subject: [PATCH] Fixes --- commands/search/periodic-table.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/search/periodic-table.js b/commands/search/periodic-table.js index aac70f18..76109b14 100644 --- a/commands/search/periodic-table.js +++ b/commands/search/periodic-table.js @@ -26,8 +26,8 @@ module.exports = class PeriodicTableCommand extends Command { type: 'string', validate: element => { const num = parseInt(element, 10); - if (!isNaN(num) && num >= 0 && num <= elements.length) return true; - const search = element.toLowerCase(); + if (!isNaN(num) && num >= 0 && num <= elements.length - 1) return true; + const search = element.toString().toLowerCase(); if (elements.find(e => e.name.toLowerCase() === search || e.symbol.toLowerCase() === search)) return true; return 'Invalid element, please enter a valid element symbol, name, or atomic number.'; },