Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
286 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var $ = require('../internals/export');
|
---|
| 2 |
|
---|
| 3 | var min = Math.min;
|
---|
| 4 | var max = Math.max;
|
---|
| 5 |
|
---|
| 6 | // `Math.clamp` method
|
---|
| 7 | // https://rwaldron.github.io/proposal-math-extensions/
|
---|
| 8 | $({ target: 'Math', stat: true }, {
|
---|
| 9 | clamp: function clamp(x, lower, upper) {
|
---|
| 10 | return min(upper, max(lower, x));
|
---|
| 11 | }
|
---|
| 12 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.