environment: Add Math.clamp
The good old clamp function, now part of the Math family. Clamp is happy after so many years of loneliness. This is a strict implementation of the draft ECMAScript proposal. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1295
This commit is contained in:
@@ -362,6 +362,10 @@ function init() {
|
||||
const Format = imports.format;
|
||||
|
||||
String.prototype.format = Format.format;
|
||||
|
||||
Math.clamp = function (x, lower, upper) {
|
||||
return Math.min(Math.max(x, lower), upper);
|
||||
};
|
||||
}
|
||||
|
||||
// adjustAnimationTime:
|
||||
|
Reference in New Issue
Block a user