You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
558 B
20 lines
558 B
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.switchRegex = void 0;
|
|
function switchRegex(text, cases, isAll = false) {
|
|
for (const [reg, callback] of cases) {
|
|
if (!reg) {
|
|
return callback([]) || '';
|
|
}
|
|
const results = text.match(reg);
|
|
if (results) {
|
|
const res = callback(results);
|
|
if (!isAll) {
|
|
return res || '';
|
|
}
|
|
}
|
|
}
|
|
return '';
|
|
}
|
|
exports.switchRegex = switchRegex;
|
|
//# sourceMappingURL=switchRegex.js.map
|