From bd2fc454d6d1d088ba2697fcd89f5136f054d276 Mon Sep 17 00:00:00 2001 From: alexmorenograu <61759297+alexmorenograu@users.noreply.github.com> Date: Mon, 22 Mar 2021 09:50:47 +0100 Subject: [PATCH] update filter --- utilities/filter.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/utilities/filter.js b/utilities/filter.js index 6bf7d28..c0055f5 100644 --- a/utilities/filter.js +++ b/utilities/filter.js @@ -4,16 +4,22 @@ function isBarcode(toFilter) { } let n = true; function isShelving(toFilter) { + if (!Array.isArray(toFilter)) { + let s = toFilter; + toFilter = Array; + toFilter[0] = s; + } const exp = /^[A-Z][A-Z][A-Z]$/; - toFilter.forEach(element => { - let state = exp.test(element); + for (let i = 0; i < toFilter.length; i++) { + let state = exp.test(toFilter[i]); if (state == false) n = false; - }); + } if (n == false) return false; else return true; } + exports.isBarcode = isBarcode; exports.isShelving = isShelving;