Packages@accelint/predicates
isNotEqual
Curried predicate that determines if a value is not strictly equal to a reference value
Creates a predicate that determines if a value is not strictly equal to a reference value.
Reference
function isNotEqual<T>(reference: T): (value: T) => booleanExamples
import { isNotEqual } from '@accelint/predicates';
const isNotZero = isNotEqual(0);
isNotZero(5); // true
isNotZero(0); // false
// Removing null values
const values = [1, null, 2, null, 3];
const nonNull = values.filter(isNotEqual(null)); // [1, 2, 3]Good to know: This uses strict inequality (
!==). For filtering arrays, this is more efficient than using!isEqual(x).
Related
- isEqual - Check if value is equal to reference
- isGreater - Check if value is greater than threshold
- isGreaterEqual - Check if value is greater than or equal to threshold
- isLesser - Check if value is less than threshold
- isLesserEqual - Check if value is less than or equal to threshold
- isIn - Check if value exists in an array
- isNotIn - Check if value doesn't exist in an array