Standard Toolkit
Packages@accelint/predicates

isLesser

Curried predicate that determines if a value is less than a threshold

Creates a predicate that determines if a value is less than a threshold.

Reference

function isLesser<T extends number | string>(threshold: T): (value: T) => boolean

Examples

import { isLesser } from '@accelint/predicates';

const isBelowLimit = isLesser(100);
isBelowLimit(50);  // true
isBelowLimit(150); // false

// Temperature filtering
const temperatures = [15, 25, 35, 45];
const cool = temperatures.filter(isLesser(30)); // [15, 25]

Good to know: String comparisons use lexicographic ordering. For case-insensitive comparisons, convert strings to the same case before applying predicates.

  • isLesserEqual - Check if value is less than or equal to threshold (inclusive)
  • isGreater - Check if value is greater than threshold
  • isGreaterEqual - Check if value is greater than or equal to threshold
  • isEqual - Check if value is equal to reference
  • isNotEqual - Check if value is not equal to reference
  • isBetween - Check if value is in a range (inclusive)

On this page