Sha256: c4737df21f2087ae331b83f7e2cc477b9f4635572599a1a6b2bf38b523af8a61
Contents?: true
Size: 474 Bytes
Versions: 24
Compression:
Stored size: 474 Bytes
Contents
'use strict'; const cloneRegexp = require('clone-regexp'); module.exports = (regexp, string) => { let match; const matches = []; const clonedRegexp = cloneRegexp(regexp, {lastIndex: 0}); const isGlobal = clonedRegexp.global; // eslint-disable-next-line no-cond-assign while (match = clonedRegexp.exec(string)) { matches.push({ match: match[0], subMatches: match.slice(1), index: match.index }); if (!isGlobal) { break; } } return matches; };
Version data entries
24 entries across 24 versions & 1 rubygems