Skip to content

Add support for regexp-like matching #1

@msackman

Description

@msackman

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions