isNotBetween()
isNotBetween(
bounds
): (...args
) =>boolean
Creates a predicate function that determines if a number is not between two bounds (exclusive of range).
Parameters
bounds
[number
, number
]
The tuple containing the lower and upper bounds (order doesn't matter)
Returns
(...
args
):boolean
Parameters
args
...[number
]
Returns
boolean
Remarks
- Pure function with no side effects
- Negation of
isBetween
using functional composition - Automatically sorts bounds, so order doesn't matter in the tuple
Example
const isOutOfRange = isNotBetween([10, 90]);
isOutOfRange(5); // true (below range)
isOutOfRange(95); // true (above range)
isOutOfRange(50); // false (within range)
isOutOfRange(10); // false (on boundary, inclusive)
// Useful for validation
const scores = [5, 25, 75, 95, 105];
const outliers = scores.filter(isNotBetween([0, 100])); // [105]