Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

esnext.math.clamp.js 314B

12345678910111213
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var min = Math.min;
  4. var max = Math.max;
  5. // `Math.clamp` method
  6. // https://rwaldron.github.io/proposal-math-extensions/
  7. $({ target: 'Math', stat: true, forced: true }, {
  8. clamp: function clamp(x, lower, upper) {
  9. return min(upper, max(lower, x));
  10. }
  11. });