pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
12 lines (11 loc) • 361 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.match = void 0;
function match(re, text) {
if (arguments.length === 1)
return (_text) => match(re, _text);
const regex = RegExp(re);
const result = text.match(regex);
return result ? (regex.global ? result : [result[0]]) : [];
}
exports.match = match;