I like the look of this library a lot and it's very close to meeting my needs. But I'd quite like to see some regexp support:
Currently, the pattern can contain either fully ground values, or variable-placeholders. It would be nice to allow those variable-placeholders to contain regexps sort of maybe in the style of https://github.com/squaremo/rejson
So maybe something like:
match({ a: '$a =~ /\\d+/' }, { a: 5 });
would only match if a is assigned a number. There are some more interesting open questions though, such as:
- How do you indicate optionality? I want to express that a field may or may not exist! { a: '$a?' } ??
What do you think? I'm happy to try and hack some of this stuff in myself, but I wonder if you've already had thoughts along these lines?
I like the look of this library a lot and it's very close to meeting my needs. But I'd quite like to see some regexp support:
Currently, the pattern can contain either fully ground values, or variable-placeholders. It would be nice to allow those variable-placeholders to contain regexps sort of maybe in the style of https://github.com/squaremo/rejson
So maybe something like:
would only match if
ais assigned a number. There are some more interesting open questions though, such as:What do you think? I'm happy to try and hack some of this stuff in myself, but I wonder if you've already had thoughts along these lines?