Files
NapCatQQ/.pnpm-store/v3/files/33/7d31ad9134e8e9db665454d99f19b9a41c18c59444524b224bcc1623699c02fd91ea3a54db418b7c2f493864a6b837a69b7c9863466ba7e17c81df2aa5fcb8
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

15 lines
508 B
Plaintext

'use strict';
var $TypeError = require('es-errors/type');
var max = require('math-intrinsics/max');
var min = require('math-intrinsics/min');
// https://262.ecma-international.org/12.0/#clamping
module.exports = function clamp(x, lower, upper) {
if (typeof x !== 'number' || typeof lower !== 'number' || typeof upper !== 'number' || !(lower <= upper)) {
throw new $TypeError('Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`');
}
return min(max(lower, x), upper);
};