Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string.matches #2

Open
jchonde opened this issue Apr 15, 2019 · 4 comments
Open

string.matches #2

jchonde opened this issue Apr 15, 2019 · 4 comments

Comments

@jchonde
Copy link

jchonde commented Apr 15, 2019

Hello,

You did an amazing job with that ast, thanks for that.
I'm struguling using the string.matches from yup.
I should be able to write something like that if I understood correctly the tests:

[["yup.string"], ["yup.matches", /hi|bye/], ["yup.required"]]

But it seems that regexp serialization is not working properly or is not implemented.
Have you any suggestions, ideas ?

@tavurth
Copy link
Contributor

tavurth commented Apr 17, 2019

Hi @jchonde,

Unfortunately I don't have access to this repo any more as I've left the company where the work was made, and they seem now unresponsive to my pull requests.

I never implemented regular expression serialisation, but I suggest you could patch this with a PR by looking into the code around these lines, and running a check of the type for each argument.

Alternately I would suggest using the getCustomValidator or setCustomValidator to implement a local validation. This local validation could then extract the string and build a regular expression before testing against the object values.

@atassis

@SuperRoach
Copy link

Are you thinking of forking or moving the code base to a place where you can keep maintaining it, if you are interested?

@tavurth
Copy link
Contributor

tavurth commented Mar 12, 2020

Outlined in #10

@adarshaacharya
Copy link

I tried executing the regular expression passed from BE using eval(/REGEX/) instead of doing JSON.Parse(), and working fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants