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

Issue with example on the web page #65

Open
ashleydavis opened this issue Nov 6, 2020 · 2 comments
Open

Issue with example on the web page #65

ashleydavis opened this issue Nov 6, 2020 · 2 comments

Comments

@ashleydavis
Copy link

ashleydavis commented Nov 6, 2020

Thanks for this library, it's really nice.

If found an issue with an example on the web page.

If you run this code, nothing matches, it returns undefined:

matches([1])(
  (a, b,  tail)      => 'Will not match here',
  (a = 2, tail = []) => 'Will not match here',
  (a = 1, tail)      => 'Will match here, tail = []'
)

I would have expected the 3rd case to match.

Did the library change and the docs haven't been updated?

@leonardiwagner
Copy link
Member

@ashleydavis only if you pass 1 as argument it would match the last case. [1] is an array of 1 .

Please let me know if that answered your question.

@ashleydavis
Copy link
Author

The example above (from your README) implies that the last case will be matched and the value returned will be 'Will match here, tail = []'.

This doesn't happen.

Instead, it returns undefined.

So either your example is wrong or a bug has been introduced in the library which breaks this example.

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

2 participants