rk
5 天以前 214cda58c3786972c958da5c6d54a135490a3c11
1
2
3
4
5
6
7
8
9
10
11
12
'use strict';
var $ = require('../internals/export');
var $clamp = require('../internals/math-clamp');
var thisNumberValue = require('../internals/this-number-value');
 
// `Number.prototype.clamp` method
// https://github.com/tc39/proposal-math-clamp
$({ target: 'Number', proto: true, forced: true }, {
  clamp: function clamp(min, max) {
    return $clamp(thisNumberValue(this), min, max);
  }
});