in src/helper.ts [27:44]
export function minMax(targetNum: number, min: number, max: number) {
const isNullableTargetNum: boolean = targetNum === undefined || targetNum === null;
const isNullableMin: boolean = min === undefined || min === null;
const isNullableMax: boolean = max === undefined || max === null;
if (isNullableTargetNum) {
targetNum = (!isNullableMin) ? min : null;
} else {
if (!isNullableMax) {
targetNum = targetNum <= max ? targetNum : max;
}
if (!isNullableMin) {
targetNum = targetNum >= min ? targetNum : null;
}
}
return targetNum;
}