update filter

This commit is contained in:
alexmorenograu 2021-03-22 09:50:47 +01:00
parent 2060cc5671
commit bd2fc454d6
1 changed files with 9 additions and 3 deletions

View File

@ -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;