CanadaHonk / proposal-math-clamp

A TC39 proposal to add Math.clamp
https://canadahonk.github.io/proposal-math-clamp/
MIT License
36 stars 1 forks source link

Argument names #5

Closed Richienb closed 6 months ago

Richienb commented 8 months ago

https://github.com/Richienb/proposal-math-clamp/pull/3#discussion_r1455316475

The specification uses highest and lowest: tc39.es/ecma262/multipage/numbers-and-dates.html#sec-math.max

Meanwhile val/value/num/number, min/minimum and max/maximum are commonplace.

Richienb commented 8 months ago

If we are to adopt options object argument, I prefer the shorter min and max over the longer names because they would take longer to type without helping that much in readability.

Richienb commented 8 months ago

The spec uses value for arbitrary types: https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number-constructor-number-value ...and number for numbers: https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.isinteger

So, number it is.