Skip to main content

isNotEqual()

isNotEqual(reference): (...args) => boolean

Creates a predicate function that determines if a value is not strictly equal to a reference value.

Parameters

reference

unknown

The reference value to compare against

Returns

(...args): boolean

Parameters

args

...[unknown]

Returns

boolean

Remarks

  • Pure function with no side effects
  • Uses strict inequality (!==) comparison
  • Negation of isEqual using functional composition

Example

const isNotZero = isNotEqual(0);
isNotZero(5); // true
isNotZero('0'); // true (strict inequality)
isNotZero(0); // false

const isNotFoo = isNotEqual('foo');
isNotFoo('bar'); // true
isNotFoo('foo'); // false

// Useful with arrays
const values = [1, null, 2, null, 3];
const nonNull = values.filter(isNotEqual(null)); // [1, 2, 3]