isNot (source code)
- Alias: notEquals
- Curried: false
- Failsafe status: failsafe by default
The isNot
function returns true
if the given values (or references) are not
equal and false
otherwise. It provides the opposite behavior of the
Object.is()
method.
- The two values to be checked for equality.
The primary difference between isNot()
and !==
is that isNot()
is a
curried function, which means you can partially apply it to create a new
function that's pre-configured to compare one value against another value
repeatedly.
const value1 = 10;
const isNotValue1 = isNot(value1);
const value2 = 20;
isNotValue1(value2); // true
// Filter out fruits that are not Apple
const fruits = ["Apple", "Orange", "Lemon"];
fruits.filter(notEquals("Apple")); // ["Orange", "Lemon"];