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

feat(number): add wrap utility #489

Merged
merged 1 commit into from
Dec 18, 2021
Merged

feat(number): add wrap utility #489

merged 1 commit into from
Dec 18, 2021

Conversation

iamandrewluca
Copy link
Contributor

@iamandrewluca iamandrewluca commented Dec 13, 2021

See wrap

Returns a number whose value is limited to the given range, just like clamp.
The difference is that clamp does return the lower or upper limit if
the value is outside the range. Instead, wrap returns the value wrapped
around the range.

https://lovetoknow.github.io/love-utils-js/mathUtils.js.html

> See `wrap`
>
> Returns a number whose value is limited to the given range, just like `clamp`.
> The difference is that `clamp` doesn't return the lower or upper limit if
> the value is outside the range. Instead, `wrap` returns the value wrapped
> around the range.
>
> https://lovetoknow.github.io/love-utils-js/mathUtils.js.html
@phuocng phuocng merged commit 70978cd into phuocng:master Dec 18, 2021
@phuocng
Copy link
Owner

phuocng commented Dec 18, 2021

The snippet is now available at https://1loc.dev/number/wrap-a-number-between-two-values/
Thanks you, @iamandrewluca 👍

@iamandrewluca iamandrewluca deleted the add-wrap branch December 19, 2021 17:20
@mikecann mikecann mentioned this pull request Apr 28, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants