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

Introduce a helper function for clamping a value to a range #19617

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

Snuffleupagus
Copy link
Collaborator

Currently we have a number of spots in the code-base where we need to clamp a value to a [min, max] range. This is either implemented using Math.min/Math.max or with a local helper function, which leads to some unnecessary duplication.

Hence this patch adds and re-uses a single helper function for this, which we'll hopefully be able to remove in the future once https://github.com/tc39/proposal-math-clamp/ becomes generally available.

Currently we have a number of spots in the code-base where we need to clamp a value to a [min, max] range. This is either implemented using `Math.min`/`Math.max` or with a local helper function, which leads to some unnecessary duplication.

Hence this patch adds and re-uses a single helper function for this, which we'll hopefully be able to remove in the future once https://github.com/tc39/proposal-math-clamp/ becomes generally available.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/d043366d0a21f5d/output.txt

@Snuffleupagus Snuffleupagus marked this pull request as draft March 6, 2025 13:35
@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/d043366d0a21f5d/output.txt

Total script time: 30.51 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/ee1ca85a0c1f670/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/ee1ca85a0c1f670/output.txt

Total script time: 11.49 mins

  • Integration Tests: Passed

@Snuffleupagus Snuffleupagus marked this pull request as ready for review March 6, 2025 13:59
@Snuffleupagus Snuffleupagus requested a review from calixteman March 6, 2025 13:59
Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@Snuffleupagus Snuffleupagus merged commit 4f2cf38 into mozilla:master Mar 6, 2025
9 checks passed
@Snuffleupagus Snuffleupagus deleted the MathClamp branch March 6, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants