Returns the absolute value of a number.
@param — - The number to get the absolute value of.
@returns — The absolute value of the number.
@example — ```ts import { Absolute } from "@ibnlanre/types";
type Test = Absolute<-5>; // ^? 5
A type representing the result of a bitwise AND operation.
@param — - The first bit to AND.
@param — - The second bit to AND.
@returns — The result of the AND operation.
@example — ```ts import { And } from "@ibnlanre/types";
type Test = And<0, 1>; // ^? 0
Compares two numbers.
@description — The result of the comparison is:
@param — - The left side of the comparison.
@param — - The right side of the comparison.
@returns — The result of the comparison.
Tuple of digits.
export type Tuple = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]@category — Digit
@namespace — Tuple
@public —
Parameterized function type
@see — ://github.com/microsoft/TypeScript/issues/1213#issuecomment-1215039765
@see — ://stackoverflow.com/a/73533674
Field for parameters within higher-order functions
@description — This field is used to represent parameters in a higher-order function.
Get the arguments of a function
@param — The function to get its arguments
@returns — The arguments of the function
@example — ```ts import { Fn } from "@ibnlanre/types";
type Test = Fn.Arguments; // ^? string
Mark out the void values in a list
@param — The list to mark out void values
@param — The parameters to compare with the list
@returns — The list with void values marked out
@description — - never extends void, but void does not extend never
Returns an Error
object if the result from a function cannot be applied to the next function.
@summary — Returns never if the argument can be applied to all the functions passed.
@param — - The argument to be passed to the functions.
@param — - The list of functions to be applied to the argument.
@returns — An Error
object if the argument cannot be applied to any of the functions passed.
Returns a list of functions that can accept the result of the previous function
@summary — - Omits functions that cannot be applied to the argument.
@param — - The argument to be passed to the functions.
@param — - The list of functions to be applied to the argument.
@returns — A list of functions that can be applied to the argument in reverse order.
Returns a tuple of widened types or void.
@param — - The tuple to widen.
@returns — A tuple of widened types or void.
@example — ```ts import { Preset } from "@ibnlanre/function";
type Test = Preset<[1, "b"]>; // ^? [number | void, string | void]
type Test2 = Preset<"a">; // ^? [string | void]
Field for arguments within higher-order functions
@description — This field is used to represent arguments in a higher-order function.
A field that represents a slot.
@description — This field is used to represent arguments in a function.
Field for the return value of functions
@description — This field is used to represent the return value of a function.
Represents the value at a path in an object.
@template — The type of the object.
@template — The type of the path.
@template — The type of the delimiter.
Tuple of digits representing the components of a number.
export type NumberComponents<TSign extends Sign, Integers extends string, Fraction extends string> = [Integers | Fraction extends "" ? "+" : TSign, Integers, Fraction]SquareRoot
takes a number and returns the square root of that number.
@description — This algorithm is based on the Heron's method for finding the square root of a number. Also known as the Babylonian method, it is an ancient algorithm that is still used today.
@param — A number to find the square root of.
@returns — The square root of the number.
@example — type Result = SquareRoot<16>; // ^? type Result = 4
@since — 0.1.0
Returns the remainder of the division of Dividend
by Divisor
.
@description — - If both dividend and divisor are positive, then all three definitions agree.
A type representing the result of a logical NOT operation.
@param — - The proposition to NOT.
@returns — The result of the NOT operation.
@example — ```ts import { Not } from "@ibnlanre/types";
type Test = Not<0>; // ^? 1
Used in filtering out the optional keys in a dictionary.
@params — ObjectType The type of the store.
@params — Key The type of the key.
@return — The keys that are optional in the dictionary.
@example — { [Key in keyof ObjectType as OptionalKeyMap<ObjectType, Key>]: ObjectType[Key] }
A type representing the result of a bitwise OR operation.
@param — - The first bit to OR.
@param — - The second bit to OR.
@returns — The result of the OR operation.
@example — ```ts import { Or } from "@ibnlanre/types";
type Test = Or<0, 1>; // ^? 1
Get all the possible paths of an object
@param — - The object to get the paths from
@param — - The delimiter to use to separate the keys
@param — - The level to stop the recursion
Used in filtering out the required keys in a dictionary.
@params — ObjectType The type of the store.
@params — Key The type of the key.
@return — The keys that are required in the dictionary.
@example — { [Key in keyof ObjectType as RequiredKeyMap<ObjectType, Key>]: ObjectType[Key] }
Signum representation of a number.
@description — The signum function of a number is a mathematical function that extracts the sign of a real number.
@summary — - If the number is negative, the signum is -1.
@param — The number to get the signum of.
@returns — The signum of the number.
Returns the absolute value of a number.
@param — - The number to get the absolute value of.
@returns — The absolute value of the number.
@examples — ```ts import { Apply, TAbsolute } from "@ibnlanre/types";
type Test = Apply<TAbsolute, [-5]>; // ^? 5
Adds two numbers.
@param — - The number to add.
@param — - The number to add to.
@returns — The sum of the two numbers.
@example — type Test = Call<TAdd<5, 5>>; // 10 type Test = Apply<Add<6>, [4]>; // 10
Performs a bitwise AND operation on two numbers.
@param — - The first number to AND.
@param — - The second number to AND.
@returns — The result of the AND operation.
@example — ```ts import { Apply, TAnd } from "@ibnlanre/types";
type Test = Apply<TAnd, [0, 1]>; // ^? 0
Compares two numbers.
@description — The result of the comparison is:
@param — - The right side of the comparison.
@param — - The left side of the comparison.
@returns — The result of the comparison.
Performs a logical NOT operation on a proposition.
@param — - The proposition to NOT.
@returns — The result of the NOT operation.
@example — ```ts import { Apply, TNot } from "@ibnlanre/types";
type Test = Apply<TNot, [0]>; // ^? 1
Performs a bitwise OR operation on two numbers.
@param — - The first number to OR.
@param — - The second number to OR.
@returns — The result of the OR operation.
@example — ```ts import { Apply, TOr } from "@ibnlanre/types";
type Test = Apply<TOr, [0, 1]>; // ^? 1
Performs a bitwise XOR operation on two numbers.
@param — - The first number to XOR.
@param — - The second number to XOR.
@returns — The result of the XOR operation.
@example — ```ts import { Apply, TXor } from "@ibnlanre/types";
type Test = Apply<TXor, [0, 1]>; // ^? 1
A type representing the result of a bitwise XOR operation.
@param — - The first bit to XOR.
@param — - The second bit to XOR.
@returns — The result of the XOR operation.
@example — ```ts import { Xor } from "@ibnlanre/types";
type Test = Xor<0, 1>; // ^? 1