Packages@accelint/predicates
isGreater
Curried predicate that determines if a value is greater than a threshold
Creates a predicate that determines if a value is greater than a threshold.
Reference
function isGreater<T extends number | string>(threshold: T): (value: T) => booleanExamples
import { isGreater } from '@accelint/predicates';
const isGreaterThan10 = isGreater(10);
isGreaterThan10(15); // true
isGreaterThan10(5); // false
// String comparison (lexicographic)
const isAfterM = isGreater('M');
isAfterM('Z'); // true
isAfterM('A'); // false
// Array filtering
const numbers = [1, 5, 10, 15, 20];
const greaterThan10 = numbers.filter(isGreater(10)); // [15, 20]Good to know: String comparisons use lexicographic ordering. For case-insensitive comparisons, convert strings to the same case before applying predicates.
Related
- isGreaterEqual - Check if value is greater than or equal to threshold (inclusive)
- isLesser - Check if value is less than threshold
- isLesserEqual - Check if value is less 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)