Appearance
Equal
Makes a equivalent comparison among some values.
Example
Without Equal
ts
let result = a === b || a === c || a === dWith Equal
ts
import { strictEqOr } from 'sa-lambda/Equal'
let result = strictEqOr(a, b, c, d)API
isEqual
ts
(self: unknown, other: unknown) => booleanLoose equality compares two values for equality.
Equals to a == b.
ts
isEqual(1, 1) ➔ true
isEqual(1, '1') ➔ trueisStrictEqual
ts
(self: unknown, other: unknown) => booleanStrict equality compares two values for equality.
Equals to a === b.
ts
isStrictEqual(1, 1) ➔ true
isStrictEqual(1, '1') ➔ falseeqOr
ts
<A>(self: A): A
(self: unknown, ...others: unknown[]): booleanChecks if value is loose equal to any other value.
Returns self directly if others is empty.
ts
eqOr(1, 2, 3) ➔ false
eqOr(1, '1', 3) ➔ truenotEqOr
ts
<A>(self: A): A
(self: unknown, ...others: unknown[]): booleanChecks if value is loose not equal to any other value.
Returns self directly if others is empty.
ts
notEqOr(1) ➔ 1
notEqOr(1, '1', 1) ➔ false
notEqOr(1, 1, 2) ➔ truestrictEqOr
ts
<A>(self: A): A
(self: unknown, ...others: unknown[]): booleanChecks if value is strict equal to any other value.
Returns self directly if others is empty.
ts
strictEqOr(1, 2, 3) ➔ false
strictEqOr(1, '1', 3) ➔ false
strictEqOr(1, 1, 3) ➔ truestrictNotEqOr
ts
<A>(self: A): A
(self: unknown, ...others: unknown[]): booleanChecks if value is strict not equal to any other value.
Returns self directly if others is empty.
ts
strictNotEqOr(1) ➔ 1
strictNotEqOr(1, 1, 1) ➔ false
strictNotEqOr(1, 2, 3) ➔ true
strictNotEqOr(1, '1', 1) ➔ trueeqAnd
ts
<A>(self: A): A
(self: unknown, ...others: unknown[]): booleanChecks if value is loose equal to every other value.
Returns self directly if others is empty.
ts
eqAnd(1, 2, 3) ➔ false
eqAnd(1, '1', 3) ➔ false
eqAnd(1, '1', true) ➔ truenotEqAnd
ts
<A>(self: A): A
(self: unknown, ...others: unknown[]): booleanChecks if value is loose not equal to every other value.
Returns self directly if others is empty.
ts
notEqAnd(1) ➔ 1
notEqAnd(1, 2, 3) ➔ true
notEqAnd(1, '1', 3) ➔ falsestrictEqAnd
ts
<A>(self: A): A;
(self: unknown, ...others: unknown[]): boolean;Checks if value is strict equal to every other value.
Returns self directly if others is empty.
ts
strictEqAnd(1, 2, 3) ➔ false
strictEqAnd(1, 1, 2) ➔ false
strictEqAnd(1, 1, 1) ➔ truestrictNotEqAnd
ts
<A>(self: A): A
(self: unknown, ...others: unknown[]): booleanChecks if value is strict not equal to every other value.
Returns self directly if others is empty.
ts
strictNotEqAnd(1, 2, 3) ➔ true
strictNotEqAnd(1, '1', 2) ➔ true
strictNotEqAnd(1, 1, 1) ➔ false