UNPKG

vuestic-ui

Version:
22 lines (21 loc) 470 B
const isMatchRegex = (str, regex) => { return regex.test(str); }; const regexGroupsValues = (str, regex) => { if (typeof regex !== "string" && regex.global) { return [...str.matchAll(regex)].map((g) => g.slice(1)); } const match = str.match(regex) || []; if (!match) { return []; } if (match.length > 1) { return match.slice(1); } return match; }; export { isMatchRegex as i, regexGroupsValues as r }; //# sourceMappingURL=regex.js.map