2024-10-23
This commit is contained in:
parent
5793fcb710
commit
5093529cc1
427 changed files with 6691 additions and 1740 deletions
|
|
@ -1,28 +1,168 @@
|
|||
function _gte(a, b) {
|
||||
return a >= b;
|
||||
function mod_(t2, n2) {
|
||||
if (0 === n2) {
|
||||
throw {
|
||||
RE_EXN_ID: "Division_by_zero",
|
||||
Error: new Error()
|
||||
};
|
||||
}
|
||||
return t2 % n2;
|
||||
}
|
||||
function placeholder(t2) {
|
||||
}
|
||||
function pred(t2) {
|
||||
return t2 - 1 | 0;
|
||||
}
|
||||
function succ(t2) {
|
||||
return t2 + 1 | 0;
|
||||
}
|
||||
function _add(t2, n2) {
|
||||
return t2 + n2;
|
||||
}
|
||||
function add() {
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _add(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _add(arguments[0], arguments[1]);
|
||||
}
|
||||
function _subtract(t2, n2) {
|
||||
return t2 - n2;
|
||||
}
|
||||
function subtract() {
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _subtract(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _subtract(arguments[0], arguments[1]);
|
||||
}
|
||||
function _multiply(t2, n2) {
|
||||
return t2 * n2;
|
||||
}
|
||||
function multiply() {
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _multiply(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _multiply(arguments[0], arguments[1]);
|
||||
}
|
||||
function _divide(t2, n2) {
|
||||
return t2 / n2;
|
||||
}
|
||||
function divide() {
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _divide(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _divide(arguments[0], arguments[1]);
|
||||
}
|
||||
var t = mod_;
|
||||
function modulo() {
|
||||
if (1 === arguments.length) {
|
||||
const n2 = arguments;
|
||||
return function fn(r) {
|
||||
return t(r, n2[0]);
|
||||
};
|
||||
}
|
||||
return t(arguments[0], arguments[1]);
|
||||
}
|
||||
function _divideWithModulo(t2, n2) {
|
||||
return [t2 / n2, mod_(0 | t2, 0 | n2)];
|
||||
}
|
||||
function divideWithModulo() {
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _divideWithModulo(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _divideWithModulo(arguments[0], arguments[1]);
|
||||
}
|
||||
function _gt(t2, n2) {
|
||||
return t2 > n2;
|
||||
}
|
||||
function gt() {
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _gt(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _gt(arguments[0], arguments[1]);
|
||||
}
|
||||
function _gte(t2, n2) {
|
||||
return t2 >= n2;
|
||||
}
|
||||
function gte() {
|
||||
if (arguments.length === 1) {
|
||||
const args = arguments;
|
||||
return function fn(data) {
|
||||
return _gte(data, args[0]);
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _gte(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _gte(arguments[0], arguments[1]);
|
||||
}
|
||||
function _lt(a, b) {
|
||||
return a < b;
|
||||
function _lt(t2, n2) {
|
||||
return t2 < n2;
|
||||
}
|
||||
function lt() {
|
||||
if (arguments.length === 1) {
|
||||
const args = arguments;
|
||||
return function fn(data) {
|
||||
return _lt(data, args[0]);
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _lt(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _lt(arguments[0], arguments[1]);
|
||||
}
|
||||
const estEntreDeuxNombres = (nombre, min, max) => gte(nombre, min) && lt(nombre, max);
|
||||
function _lte(t2, n2) {
|
||||
return t2 <= n2;
|
||||
}
|
||||
function lte() {
|
||||
if (1 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _lte(n2, t2[0]);
|
||||
};
|
||||
}
|
||||
return _lte(arguments[0], arguments[1]);
|
||||
}
|
||||
function _clamp(t2, n2, r) {
|
||||
return Math.min(Math.max(t2, n2), r);
|
||||
}
|
||||
function clamp() {
|
||||
if (2 === arguments.length) {
|
||||
const t2 = arguments;
|
||||
return function fn(n2) {
|
||||
return _clamp(n2, t2[0], t2[1]);
|
||||
};
|
||||
}
|
||||
return _clamp(arguments[0], arguments[1], arguments[2]);
|
||||
}
|
||||
var n = {
|
||||
__proto__: null,
|
||||
placeholder,
|
||||
pred,
|
||||
succ,
|
||||
add,
|
||||
subtract,
|
||||
multiply,
|
||||
divide,
|
||||
modulo,
|
||||
divideWithModulo,
|
||||
gt,
|
||||
gte,
|
||||
lt,
|
||||
lte,
|
||||
clamp
|
||||
};
|
||||
const estEntreDeuxNombres = (nombre, min, max) => n.gte(nombre, min) && n.lt(nombre, max);
|
||||
export {
|
||||
estEntreDeuxNombres as e
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue