Logic
either()
Computes the result of the logical OR operation.
- Type
- Details
Takes two boolean parameters
- Example
either(true, false); // true
either(false)(false); // falseeither(true, false); // true
either(false)(false); // falseboth()
Computes the result of the logical AND operation.
- Type
- Details
Takes two boolean parameters
- Example
both(true, false); // false
both(true)(true); // trueboth(true, false); // false
both(true)(true); // truenot()
Computes the result of the NOT operation.
- Type
- Details
Takes one boolean parameter
- Example
not(false); // truenot(false); // truelt()
Computes the result of the
- Type
- Details
Takes two comparable parameters
- Example
lt(2, 3); // true
lt(3)(3); // falselt(2, 3); // true
lt(3)(3); // falselte()
Computes the result of the $ \leq $ operation.
- Type
- Details
Takes two comparable parameters
- Example
lte(2, 3); // true
lte(3)(3); // truelte(2, 3); // true
lte(3)(3); // truegt()
Computes the result of the
- Type
- Details
Takes two comparable parameters
- Example
gt(2, 3); // false
gt(3)(3); // falsegt(2, 3); // false
gt(3)(3); // falsegte()
Computes the result of the
- Type
- Details
Takes two comparable parameters
- Example
gte(2, 3); // false
gte(3)(3); // truegte(2, 3); // false
gte(3)(3); // trueequal()
Computes the result of the
- Type
- Details
Takes two comparable parameters
- Example
equal(1, 1); // true
equal(5)(1); // falseequal(1, 1); // true
equal(5)(1); // falseequalStrict()
Computes the result of the
- Type
- Details
Takes two comparable parameters
- Example
equalStrict(1, 1); // true
equalStrict(5)(1); // falseequalStrict(1, 1); // true
equalStrict(5)(1); // falsedeepEqual()
Compares whether two values (which can be arrays, objects, or general values) are equal.
- Type
- Details
Takes two values and returns whether they are deeply equal or not.
- Example
deepEqual([1, 2, 3], [4, 5, 6]); // false
deepEqual({ a: 1 }, { a: 1 }); // truedeepEqual([1, 2, 3], [4, 5, 6]); // false
deepEqual({ a: 1 }, { a: 1 }); // truewhen()
Constructs a function that performs a certain operation when a condition is met.
- Type
- Details
Initially takes two function-type parameters
- Example
const foo = when(
(v) => v == ' is you!',
(v) => 'homo' + v
);
foo(' is you!'); // "homo is you!"const foo = when(
(v) => v == ' is you!',
(v) => 'homo' + v
);
foo(' is you!'); // "homo is you!"unless()
Constructs a function that performs a certain operation when a condition is not met.
- Type
- Details
Initially takes two function-type parameters
- Example
const foo = unless(
(v) => !(v == ' is you!'),
(v) => 'homo' + v
);
foo(' is you!'); // "homo is you!"const foo = unless(
(v) => !(v == ' is you!'),
(v) => 'homo' + v
);
foo(' is you!'); // "homo is you!"ifElse()
Constructs a function that performs a certain operation based on a condition.
- Type
- Details
Initially takes three function-type parameters
- Example
const foo = ifElse(
(v) => v == ' is you!',
(v) => 'homo' + v,
(v) => 'homo' + v
);
foo(' not you!'); // "homo not you!"const foo = ifElse(
(v) => v == ' is you!',
(v) => 'homo' + v,
(v) => 'homo' + v
);
foo(' not you!'); // "homo not you!"id()
Returns the passed-in argument.
- **
Type**
- Details
Takes an argument and returns it directly.
- Example
id(114514); // 114514id(114514); // 114514always()
Constructs a function that returns a constant value.
- Type
- Details
Takes a constant value and returns a function that, when invoked, returns this constant value.
- Example
always(114514)(); // 114514always(114514)(); // 114514eqType()
Determines if the types of two values are equal.
- Type
- Details
Takes two values and returns whether their types are equal.
- Example
eqType(1, 1); // true
eqType(1, '1'); // falseeqType(1, 1); // true
eqType(1, '1'); // falseeqData()
Compares whether two abstract data structures are equal.
- Type
- Details
Takes two objects constructed by the Data API. The function can determine whether these two objects are from the same abstract data structure and are equal.
- Example
const foo = Data('A a b c');
eqData(foo.A(1, 1, 2), foo.A(1, 1, 2)); // trueconst foo = Data('A a b c');
eqData(foo.A(1, 1, 2), foo.A(1, 1, 2)); // true