`Math.clamp` strawman

I believe the most important feature from the Math extensions proposal (last presented in 2016) is the Math.clamp function but the proposal as a whole has since gone quiet. Perhaps it was its amibition for features had eventually caused a roadblock in development.

But regardless, I wanted to take out only the Math.clamp function from the proposal and improve upon it in its own proposal. I'm not sure how the process of finding a champion, or for that matter, getting feedback in the first place goes, but I'll just put this out there.

Proposal: GitHub - Richienb/proposal-math-clamp: ECMAScript proposal and reference implementation for `Math.clamp`.

4 Likes

Could also support BigInt from the get go, if this other proposal advances.

You might want to reach out to @jschoi and see if they would be interested in championing this proposal. Seems like it would be easy to argue that it is motivated.

I am interested in championing (the explainer linked above looks pretty good), but I probably would not have the bandwidth to do so until after at least BigInt Math resolves.

2 Likes