Hi could anyone help me with what seems like a sim...
# pact-js
d
Hi could anyone help me with what seems like a simple question I want to match a value that can be 0 or 1 After much trying I arrive at trial: term({ matcher: "\\[0 - 1]", generate: 0 }), No luck - Example '0' does not match provided regular expression '\[0 - 1]' What am I doing wrong please ?
It looks like
trial: regex({ matcher: "[0 - 1]", generate: "0" }),
is what I need
m
You can’t apply regexes to numbers
they only work on strings
in this case, your only option is to do exact match on value (not ideal) or use the
like
matcher
d
Thanks didn't realise that . OK thats a pity
m
I'd suggest raising a matcher for a range of integer values here: https://github.com/pact-foundation/pact-specification/issues
d
Thanks I don't mind digging into the code and doing a PR , I'll see how to go about that
🙌 1
m
It’ll be rust code where that matcher will go, btw 😉
d
Oh great I want to learn Rust where is the repo for all that
m
You should raise the suggestion first before issuing a PR, because it has ecosystem wide consequences and we would want to get a consensus that it’s a good idea
👍 1