Closed conartist6 closed 2 years ago
Ah crap, a lot of this was wrong. Captures can't be mutable. I just was lazy the first time around about writing the test that would have showed me I was breaking something.
This PR was merged, but I rewrote the history since the mistake was a day old, there are no forks yet, and there was no reason to make a mess of the history.
The particular test which I had neglected to write thus far and would have showed me the problem was:
it('(a(bc|b))c', () => {
const exp = parse('(a(bc|b))c');
expect(exec(exp, 'abc')).toEqual(['abc', 'ab', 'b']);
});
I've improved naming, reduced redundancy, and somehow changed the behavior regarding empty capturing groups. I believe the new behavior is more correct.