guardian / typerighter

Even if you’re the right typer, couldn’t hurt to use Typerighter!
Apache License 2.0
276 stars 12 forks source link

Make 'before' and 'after' context available in match #82

Closed jonathonherbert closed 4 years ago

jonathonherbert commented 4 years ago

What does this change?

Adds a 'before' and 'after' property to the Match interface, to allow our interface to programmatically reconstruct the context of a match.

Before this, we had to manually parse out the matched text (example string: What a [misteak] to make), which was unreliable.

How to test

Run a check. before and after properties should be present in the match data when matches are made.

The automated tests cover this output, and should pass.

How can we measure success?

We're able to programmatically reconstruct the context of a match in tooling consuming our API, without parsing strings :)))