vtex-home-page-sabrina-miranda/dev/vtexEngine/utils.js

18 lines
351 B
JavaScript
Raw Normal View History

2022-12-05 13:22:58 +00:00
module.exports = {
regexFindAll(re, string) {
let regexResult = [];
while ((match = re.exec(string)) != null) {
regexResult.push(match);
}
return regexResult;
},
findInArray(lista, name) {
for (let i = 0; i < lista.length; i++) {
if (lista[i].name == name.trim().toLowerCase()) {
return lista[i];
}
}
return null;
},
};