Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/samualtnorman/lib. A collection of common utilities I need. www.npmjs.com/package/@samual/lib
Something went wrong. Try again.
12345678910111213import { assert } from "./assert"
export function* findMatches(regex: RegExp, string: string) { assert(regex.global, `regex must have global flag`)
let current
while ((current = regex.exec(string))) yield { index: current.index, match: (current[1] || current[0])! }}
export default findMatches