index-of-match.js 269 B

123456789
  1. function indexOfMatch(xml, pattern, startIndex) {
  2. const re = new RegExp(pattern);
  3. const match = re.exec(xml.slice(startIndex));
  4. if (match) return startIndex + match.index;
  5. else return -1;
  6. }
  7. module.exports = indexOfMatch;
  8. module.exports.default = indexOfMatch;