All files / src/helpers/number clip.js

66.66% Statements 4/6
40% Branches 2/5
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7    2x 3x 3x 3x  
import {MAX_SAFE_INTEGER} from "./const";
 
export const clip = (val, min, max = MAX_SAFE_INTEGER) => {
    Iif (val < min) return min;
    Iif (val > max) return max;
    return val;
}