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

Patterns as numbers #262

Closed
yaxu opened this issue Nov 16, 2022 · 1 comment · Fixed by #287
Closed

Patterns as numbers #262

yaxu opened this issue Nov 16, 2022 · 1 comment · Fixed by #287
Labels
enhancement improves an existing feature

Comments

@yaxu
Copy link
Member

yaxu commented Nov 16, 2022

There's times where it would be convenient to be able to do this:

name("thing").a(3).b(2).c(1.5).mul(2)

.. where the values that are numbers (i.e. where typeof value === 'number') in the patterned object get multiplied by 2, making name("thing").a(6).b(4).c(3).

Currently this results in name("thing").a(6).b(4).c(3).value(2)

Any objections to supporting the alternative behaviour?

@felixroos
Copy link
Collaborator

sounds useful, also for just a single number that is wrapped e.g. n("c3").add(1) would then work.

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

Successfully merging a pull request may close this issue.

2 participants