New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hkt-toolbelt

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hkt-toolbelt - npm Package Compare versions

Comparing version 0.22.2 to 0.23.0

boolean/and-all.d.ts

4

$/$.d.ts

@@ -32,4 +32,4 @@ import { Kind, Function } from '..';

*
* @param F - A type-level function.
* @param X - The input type to apply the type-level function to.
* @template F - A type-level function.
* @template X - The input type to apply the type-level function to.
*

@@ -36,0 +36,0 @@ * ### Basic Usage

@@ -50,4 +50,4 @@ import { Kind, List } from '..';

*
* @param FX - A tuple of type-level functions that will be piped together.
* @param X - The input type that the type-level functions will be applied to.
* @template FX - A tuple of type-level functions that will be piped together.
* @template X - The input type that the type-level functions will be applied to.
*

@@ -54,0 +54,0 @@ * ### Basic Usage

@@ -10,4 +10,4 @@ import { Kind } from '..';

*
* @param {Kind.Kind} K - The type-level function to apply.
* @param {List.List} X - The list of arguments to apply the type-level function to.
* @template {Kind.Kind} K - The type-level function to apply.
* @template {List.List} X - The list of arguments to apply the type-level function to.
*

@@ -14,0 +14,0 @@ * Since all type-level functions are curried, we successively apply the

@@ -8,4 +8,4 @@ import { Kind, Type } from '..';

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -35,4 +35,4 @@ * @example

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -39,0 +39,0 @@ * @example

@@ -10,4 +10,4 @@ import { Kind, Type } from '..';

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -39,4 +39,4 @@ * @example

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -43,0 +43,0 @@ * @example

@@ -10,1 +10,6 @@ export * from './and';

export * from './nimply';
export * from './and-all';
export * from './nand-all';
export * from './nor-all';
export * from './or-all';
export * from './xnor-all';

@@ -8,4 +8,4 @@ import { Type, Kind } from '..';

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -35,4 +35,4 @@ * @example

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -39,0 +39,0 @@ * @example

@@ -8,4 +8,4 @@ import { Kind, Type } from '..';

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -35,4 +35,4 @@ * @example

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -39,0 +39,0 @@ * @example

@@ -8,4 +8,4 @@ import { Type, Kind } from '..';

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -35,4 +35,4 @@ * @example

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -39,0 +39,0 @@ * @example

@@ -7,3 +7,3 @@ import { Type, Kind } from '..';

*
* @param T - A boolean type.
* @template T - A boolean type.
*

@@ -24,3 +24,3 @@ * @example

*
* @param T - A boolean type.
* @template T - A boolean type.
*

@@ -27,0 +27,0 @@ * @example

@@ -8,4 +8,4 @@ import { Type, Kind } from '..';

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -35,4 +35,4 @@ * @example

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -39,0 +39,0 @@ * @example

@@ -8,4 +8,4 @@ import { Type, Kind } from '..';

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -42,4 +42,4 @@ * @example

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -46,0 +46,0 @@ * @example

@@ -8,4 +8,4 @@ import { Type, Kind } from '..';

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -32,4 +32,4 @@ * @example

*
* @param T - A boolean type.
* @param U - A boolean type.
* @template T - A boolean type.
* @template U - A boolean type.
*

@@ -36,0 +36,0 @@ * @example

@@ -13,3 +13,3 @@ import { $, Type, Kind, Combinator } from '..';

*
* @param F - A recursive kind that takes in itself as a type argument.
* @template F - A recursive kind that takes in itself as a type argument.
*

@@ -16,0 +16,0 @@ * @example

@@ -38,3 +38,3 @@ import { Kind, NaturalNumber, Number, Conditional, Type } from '..';

*
* @param N - The arity of the type-level function to create.
* @template N - The arity of the type-level function to create.
*

@@ -41,0 +41,0 @@ * This is useful for creating type-level functions that are 'variadic' in the

@@ -6,4 +6,4 @@ import { Type, Kind, List, Conditional } from '..';

*
* @param T - An array of types.
* @param U - A type.
* @template T - An array of types.
* @template U - A type.
*

@@ -60,3 +60,3 @@ * @example

*
* @param T - An array of types.
* @template T - An array of types.
*

@@ -63,0 +63,0 @@ * @example

@@ -6,4 +6,4 @@ import { Kind } from '..';

*
* @param T - A type.
* @param U - A type.
* @template T - A type.
* @template U - A type.
*

@@ -40,4 +40,4 @@ * @example

*
* @param T - A type.
* @param U - A type.
* @template T - A type.
* @template U - A type.
*

@@ -44,0 +44,0 @@ * @example

@@ -7,4 +7,4 @@ import { Type, Kind, List, Conditional } from '..';

*
* @param T - An array of types.
* @param U - A type.
* @template T - An array of types.
* @template U - A type.
*

@@ -65,4 +65,4 @@ * @example

*
* @param U - A type.
* @param T - An array of types.
* @template U - A type.
* @template T - An array of types.
*

@@ -69,0 +69,0 @@ * @example

@@ -13,4 +13,4 @@ import { Kind } from '..';

*
* @param T - The supertype that we are checking if `X` extends.
* @param X - The type that we are checking if it is a subtype of `T`.
* @template T - The supertype that we are checking if `X` extends.
* @template X - The type that we are checking if it is a subtype of `T`.
*

@@ -38,4 +38,4 @@ * @example

*
* @param T - The supertype that we are checking if `U` extends.
* @param U - The type that we are checking if it is a subtype of `T`.
* @template T - The supertype that we are checking if `U` extends.
* @template U - The type that we are checking if it is a subtype of `T`.
*

@@ -42,0 +42,0 @@ * @example

@@ -10,6 +10,6 @@ import { $, Type, Kind } from '..';

*
* @param Predicate - A type-level function of the form `(x: never) => boolean`.
* @param Then - A type-level function that is applied on the truthy branch.
* @param Else - A type-level function that is applied on the falsy branch.
* @param X - The input to the predicate function.
* @template Predicate - A type-level function of the form `(x: never) => boolean`.
* @template Then - A type-level function that is applied on the truthy branch.
* @template Else - A type-level function that is applied on the falsy branch.
* @template X - The input to the predicate function.
*/

@@ -36,8 +36,8 @@ export type _$if<Predicate extends Kind.Kind<(x: never) => boolean>, Then extends Kind.Kind, Else extends Kind.Kind, X extends Kind._$inputOf<Predicate>> = $<Predicate, X> extends true ? $<Then, Type._$cast<X, Kind._$inputOf<Then>>> : $<Else, Type._$cast<X, Kind._$inputOf<Else>>>;

*
* @param Predicate - A type-level function of the form `(x: never) => boolean`.
* @param Then - A type-level function that is applied when the predicate returns
* @template Predicate - A type-level function of the form `(x: never) => boolean`.
* @template Then - A type-level function that is applied when the predicate returns
* `true`.
* @param Else - A type-level function that is applied when the predicate returns
* @template Else - A type-level function that is applied when the predicate returns
* `false`.
* @param X - The input to the predicate function.
* @template X - The input to the predicate function.
*

@@ -44,0 +44,0 @@ * ## Usage Examples

@@ -14,4 +14,4 @@ import { $, $$, Conditional, Kind } from '..';

*
* @param T - The subtype that we are checking if `X` is a supertype of.
* @param X - The type that we are checking if it is a supertype of `T`.
* @template T - The subtype that we are checking if `X` is a supertype of.
* @template X - The type that we are checking if it is a supertype of `T`.
*

@@ -49,4 +49,4 @@ * @example

*
* @param T - The supertype that we are checking if `U` extends.
* @param U - The type that we are checking if it is a subtype of `T`.
* @template T - The supertype that we are checking if `U` extends.
* @template U - The type that we are checking if it is a subtype of `T`.
*

@@ -53,0 +53,0 @@ * @example

@@ -6,4 +6,4 @@ import { Kind } from '..';

*
* @param T - The first type to compare.
* @param U - The second type to compare.
* @template T - The first type to compare.
* @template U - The second type to compare.
*

@@ -28,4 +28,4 @@ * @example

*
* @param T - The first type to compare.
* @param U - The second type to compare.
* @template T - The first type to compare.
* @template U - The second type to compare.
*

@@ -32,0 +32,0 @@ * @example

@@ -107,4 +107,4 @@ import { Digit, DigitList, Kind, Type } from '..';

*
* @param A - A digit list.
* @param B - A digit list.
* @template A - A digit list.
* @template B - A digit list.
*

@@ -130,4 +130,4 @@ * @example

*
* @param A - A digit list.
* @param B - A digit list.
* @template A - A digit list.
* @template B - A digit list.
*

@@ -134,0 +134,0 @@ * @example

@@ -81,4 +81,4 @@ import { Digit, DigitList, Kind, NaturalNumber, Type } from '../';

*
* @param A - A digit list type.
* @param B - A digit list type.
* @template A - A digit list type.
* @template B - A digit list type.
*

@@ -114,4 +114,4 @@ * @example

*
* @param A - A digit list type.
* @param B - A digit list type.
* @template A - A digit list type.
* @template B - A digit list type.
*

@@ -118,0 +118,0 @@ * @example

@@ -79,3 +79,3 @@ import { Type, Kind, Digit, DigitList } from '..';

*
* @param A - A digit list type.
* @template A - A digit list type.
*

@@ -112,3 +112,3 @@ * @example

*
* @param A - A digit list type.
* @template A - A digit list type.
*

@@ -115,0 +115,0 @@ * @example

@@ -74,5 +74,5 @@ import { Type, Kind, Digit, DigitList } from '..';

*
* @param A - A digit list representing a number to divide.
* @param B - A digit list representing a number to divide by.
* @param OPERATION - A string type representing the operation to be performed. Can be either "DIVIDE" or "MODULO".
* @template A - A digit list representing a number to divide.
* @template B - A digit list representing a number to divide by.
* @template OPERATION - A string type representing the operation to be performed. Can be either "DIVIDE" or "MODULO".
*

@@ -105,4 +105,4 @@ * @example

*
* @param A - A digit list representing a number to divide.
* @param B - A digit list representing a number to divide by.
* @template A - A digit list representing a number to divide.
* @template B - A digit list representing a number to divide by.
*

@@ -109,0 +109,0 @@ * @example

@@ -65,3 +65,3 @@ import { Type, Kind, Digit, DigitList } from '..';

*/
NEXT_REMAINDER extends DigitList.DigitList = DigitList._$divideBySubtraction<ARROW_DOWN, B, 'MODULO'>,
NEXT_REMAINDER extends DigitList.DigitList = Type._$cast<DigitList._$divideBySubtraction<ARROW_DOWN, B, 'MODULO'>, DigitList.DigitList>,
/**

@@ -81,5 +81,5 @@ * We have reached the end of the division when the next dividend is empty.

*
* @param A - A digit list representing a number to divide.
* @param B - A digit list representing a number to divide by.
* @param OPERATION - A string type representing the operation to be performed. Can be either "DIVIDE" or "MODULO".
* @template A - A digit list representing a number to divide.
* @template B - A digit list representing a number to divide by.
* @template OPERATION - A string type representing the operation to be performed. Can be either "DIVIDE" or "MODULO".
*

@@ -86,0 +86,0 @@ * @example

@@ -6,3 +6,3 @@ import { Digit, DigitList, Kind, Type } from '../';

*
* @param T - The digit list to extract the first digit from.
* @template T - The digit list to extract the first digit from.
*

@@ -9,0 +9,0 @@ * @example

@@ -6,3 +6,3 @@ import { Kind, Type, DigitList, Digit } from '..';

*
* @param T - The string to be converted into a digit list.
* @template T - The string to be converted into a digit list.
*

@@ -21,3 +21,3 @@ * @example

*
* @param A - The string to be converted into a digit list.
* @template A - The string to be converted into a digit list.
*

@@ -24,0 +24,0 @@ * @example

import { Type, Kind, Digit, DigitList } from '..';
/**
* `_$increment` is a type-level function that takes in a digit list `A` and
* returns a new digit list representing the result of incrementing the input
* digit list by 1. If the input digit list is empty or represents zero, the
* result will be a digit list representing zero.
*
* @template A - A digit list type.
*
* @example
* For example, we can use `_$increment` to increment a digit list representing
* the number 42 by 1. In this example, the digit list `["4", "2"]` is passed as
* a type argument to the type-level function:
*
* ```ts
* import { DigitList } from "hkt-toolbelt";
*
* type Result = DigitList._$increment<["4", "2"]>; // ["4", "3"]
* ```
*
* @example
* We can also use `_$increment` with an empty digit list or a digit list
* representing zero. In both cases, the result will be a digit list
* representing one:
*
* ```ts
* import { DigitList } from "hkt-toolbelt";
*
* type Result1 = DigitList._$increment<[]>; // ["1"]
* type Result2 = DigitList._$increment<["0"]>; // ["1"]
* ```
*/
export type _$increment<

@@ -53,3 +84,3 @@ /**

*
* @param A - The digit list to increment.
* @template A - The digit list to increment.
*

@@ -56,0 +87,0 @@ * @example

@@ -18,2 +18,3 @@ export * from './add';

export * from './shift';
export * from './signed-add';
export * from './subtract';

@@ -23,1 +24,2 @@ export * from './to-string';

export * from './trim';
export * from './trim-right';

@@ -6,4 +6,4 @@ import { Type, Kind, Digit, DigitList } from '..';

*
* @param T - The digit list to check.
* @param LAST - The last digit of T.
* @template T - The digit list to check.
* @template LAST - The last digit of T.
*

@@ -22,3 +22,3 @@ * @example

*
* @param T - The digit list to check.
* @template T - The digit list to check.
*

@@ -25,0 +25,0 @@ * @example

@@ -5,4 +5,4 @@ import { Type, Kind, Digit, DigitList } from '..';

*
* @param T - The digit list to check.
* @param LAST - The last digit of T.
* @template T - The digit list to check.
* @template LAST - The last digit of T.
*

@@ -23,3 +23,3 @@ * @returns `true` if the digit list is odd, `false` otherwise.

*
* @param T - The digit list to check.
* @template T - The digit list to check.
*

@@ -26,0 +26,0 @@ * @example

@@ -6,3 +6,3 @@ import { Type, Kind, Digit, DigitList } from '..';

*
* @param A - The digit list to get the last digit from.
* @template A - The digit list to get the last digit from.
*

@@ -21,3 +21,3 @@ * @example

*
* @param A - The digit list to get the last digit from.
* @template A - The digit list to get the last digit from.
*

@@ -24,0 +24,0 @@ * @example

@@ -6,4 +6,4 @@ import { Kind, Type, DigitList } from '..';

*
* @param A - The first digit list.
* @param B - The second digit list.
* @template A - The first digit list.
* @template B - The second digit list.
*

@@ -25,4 +25,4 @@ * @example

*
* @param A - The first digit list.
* @param B - The second digit list.
* @template A - The first digit list.
* @template B - The second digit list.
*

@@ -29,0 +29,0 @@ * @example

@@ -9,4 +9,4 @@ import { Kind, Type, Digit, DigitList } from '..';

*
* @param A - The digit list.
* @param B - The single digit.
* @template A - The digit list.
* @template B - The single digit.
*

@@ -37,4 +37,4 @@ * @example

*
* @param A - The digit list.
* @param B - The single digit.
* @template A - The digit list.
* @template B - The single digit.
*

@@ -41,0 +41,0 @@ * @example

@@ -71,10 +71,10 @@ import { Type, Kind, Digit, DigitList } from '..';

/**
* `_$multiplyDigit` is a type-level function that multiplies a digit list by a single digit.
* `_$multiply` is a type-level function that multiplies a digit list by another digit list.
* It returns the result of the multiplication operation.
*
* @param A - The digit list.
* @param B - The single digit.
* @template A - The digit list.
* @template B - A digit list.
*
* @example
* For example, we can use `_$multiplyDigit` to multiply a digit list by a single digit:
* For example, we can use `_$multiply` to multiply a digit list ["4", "2"] by another digit list ["1", "2"]:
*

@@ -84,7 +84,14 @@ * ```ts

*
* type Result = DigitList._$multiplyDigit<["3"], "2">; // ["6"]
* type Is504 = DigitList._$multiply<["4", "2"], ["1", "2"]>; // ["5", "0", "4"]
* ```
*
* In this example, `Result` is a type that represents ["6"], which is the result of multiplying ["3"] by "2".
* @example
* If one of the inputs is an empty digit list or the zero digit, the result will be the zero digit.
*
* ```ts
* import { DigitList } from "hkt-toolbelt";
*
* type IsZero = DigitList._$multiply<["4", "2"], []>; // ["0"]
* type IsZero2 = DigitList._$multiply<["4", "2"], ["0"]>; // ["0"]
* ```
*/

@@ -96,10 +103,10 @@ export type _$multiply<A extends DigitList.DigitList, B extends DigitList.DigitList> = DigitList._$trim<Type._$cast<_$multiply2<A, B>, DigitList.DigitList>>;

/**
* `MultiplyDigit` is a type-level function that multiplies a digit list by a single digit.
* `Multiply` is a type-level function that multiplies a digit list by another digit list.
* It returns the result of the multiplication operation.
*
* @param A - The digit list.
* @param B - The single digit.
* @template A - The digit list.
* @template B - The single digit.
*
* @example
* For example, we can use `MultiplyDigit` to multiply a digit list by a single digit:
* For example, we can use `Multiply` to multiply a digit list ["4", "2"] by another digit list ["1", "2"]:
*

@@ -109,6 +116,13 @@ * ```ts

*
* type Result = $<$<DigitList.MultiplyDigit, "2">, ["3"]>; // ["6"]
* type Is504 = $<$<DigitList.Multiply, ["1", "2"]>, ["4", "2"]>; // ["5", "0", "4"]
* ```
*
* In this example, `Result` is a type that represents ["6"], which is the result of multiplying ["3"] by "2".
* @example
* If one of the inputs is an empty digit list or the zero digit, the result will be the zero digit.
*
* ```ts
* import { DigitList } from "hkt-toolbelt";
*
* type IsZero = $<$<DigitList.Multiply, []>, ["4", "2"]>; // ["0"]
* type IsZero2 = $<$<DigitList.Multiply, ["0"], ["4", "2"]>; // ["0"]
*/

@@ -115,0 +129,0 @@ export interface Multiply extends Kind.Kind {

@@ -9,3 +9,3 @@ import { Type, Kind, DigitList } from '..';

*
* @param A - The digit list.
* @template A - The digit list.
*

@@ -31,3 +31,3 @@ * @example

*
* @param A - The digit list.
* @template A - The digit list.
*

@@ -34,0 +34,0 @@ * @example

@@ -6,3 +6,3 @@ import { Type, Kind, DigitList } from '..';

*
* @param T - The digit list.
* @template T - The digit list.
*

@@ -9,0 +9,0 @@ * @example

@@ -124,4 +124,4 @@ import { Digit, DigitList, Kind, Type } from '..';

*
* @param A - A digit list representing a number to subtract.
* @param B - A digit list representing a number to subtract by.
* @template A - A digit list representing a number to subtract.
* @template B - A digit list representing a number to subtract by.
*

@@ -149,4 +149,4 @@ * @example

*
* @param A - A digit list representing a number to subtract.
* @param B - A digit list representing a number to subtract by.
* @template A - A digit list representing a number to subtract.
* @template B - A digit list representing a number to subtract by.
*

@@ -153,0 +153,0 @@ * @example

@@ -6,4 +6,4 @@ import { DigitList, Kind, Number, Type } from '..';

*
* @param T - The digit list to convert.
* @param RESULT - The number that the digit list represents.
* @template T - The digit list to convert.
* @template RESULT - The number that the digit list represents.
*

@@ -27,3 +27,3 @@ * @example

*
* @param x - A digit list to convert to a number.
* @template x - A digit list to convert to a number.
*

@@ -30,0 +30,0 @@ * @example

@@ -7,5 +7,5 @@ import { Type, Kind, DigitList } from '..';

*
* @param T - The digit list to convert.
* @param JOIN - The string that joins the digits in the list.
* @param RESULT - The string that the digit list represents.
* @template T - The digit list to convert.
* @template JOIN - The string that joins the digits in the list.
* @template RESULT - The string that the digit list represents.
*

@@ -29,3 +29,3 @@ * @example

*
* @param A - A digit list to convert to a string.
* @template A - A digit list to convert to a string.
*

@@ -32,0 +32,0 @@ * @example

@@ -10,5 +10,5 @@ import { Type, Kind, DigitList } from '..';

*
* @param A - The digit list to trim.
* @param TRIM - The digit list after trimming leading zeros.
* @param OUTPUT - The final output after trimming. If the trimmed list is empty, it returns ["0"].
* @template A - The digit list to trim.
* @template TRIM - The digit list after trimming leading zeros.
* @template OUTPUT - The final output after trimming. If the trimmed list is empty, it returns ["0"].
*

@@ -32,3 +32,3 @@ * @example

*
* @param x - A digit list to trim leading zeros from.
* @template x - A digit list to trim leading zeros from.
*

@@ -35,0 +35,0 @@ * @example

@@ -134,4 +134,4 @@ import { Type, Digit, Kind } from '..';

*
* @param A - A one-character decimal digit type.
* @param B - A one-character decimal digit type.
* @template A - A one-character decimal digit type.
* @template B - A one-character decimal digit type.
*

@@ -157,4 +157,4 @@ * @example

* ## Parameters
* @param A - A one-character decimal digit type.
* @param B - A one-character decimal digit type.
* @template A - A one-character decimal digit type.
* @template B - A one-character decimal digit type.
*

@@ -161,0 +161,0 @@ * @example

@@ -134,4 +134,4 @@ import { Type, Digit, Kind } from '..';

*
* @param A - A one-character decimal digit type.
* @param B - A one-character decimal digit type.
* @template A - A one-character decimal digit type.
* @template B - A one-character decimal digit type.
*

@@ -158,4 +158,4 @@ * @example

* ## Parameters
* @param A - A one-character decimal digit type.
* @param B - A one-character decimal digit type.
* @template A - A one-character decimal digit type.
* @template B - A one-character decimal digit type.
*

@@ -162,0 +162,0 @@ * @example

@@ -138,4 +138,4 @@ import { Digit, Kind, Type } from '../';

*
* @param A - A one-character decimal digit type.
* @param B - A one-character decimal digit type.
* @template A - A one-character decimal digit type.
* @template B - A one-character decimal digit type.
*

@@ -161,4 +161,4 @@ * @example

* ## Parameters
* @param A - A one-character decimal digit type.
* @param B - A one-character decimal digit type.
* @template A - A one-character decimal digit type.
* @template B - A one-character decimal digit type.
*

@@ -165,0 +165,0 @@ * @example

@@ -21,3 +21,3 @@ import { Type, Digit, Kind } from '..';

*
* @param A - A one-character decimal digit type.
* @template A - A one-character decimal digit type.
*

@@ -40,3 +40,3 @@ * @example

* ## Parameters
* @param A - A one-character decimal digit type.
* @template A - A one-character decimal digit type.
*

@@ -43,0 +43,0 @@ * @example

@@ -15,3 +15,3 @@ import { Type, Digit, Kind } from '..';

*
* @param A - A single-digit type which represents a digit from "0" to "9".
* @template A - A single-digit type which represents a digit from "0" to "9".
*

@@ -36,3 +36,3 @@ * @example

*
* @param A - A single-digit type which represents a digit from "0" to "9".
* @template A - A single-digit type which represents a digit from "0" to "9".
*

@@ -39,0 +39,0 @@ * @example

@@ -14,3 +14,3 @@ import { Type, Digit, Kind } from '..';

*
* @param A - A digit type.
* @template A - A digit type.
*

@@ -40,3 +40,3 @@ * @example

*
* @param A - A digit type.
* @template A - A digit type.
*

@@ -43,0 +43,0 @@ * @example

@@ -12,3 +12,3 @@ import { Type, Digit, Kind } from '..';

*
* @param A - A digit type.
* @template A - A digit type.
*

@@ -30,3 +30,3 @@ * @example

*
* @param A - A digit type.
* @template A - A digit type.
*

@@ -33,0 +33,0 @@ * @example

@@ -7,4 +7,4 @@ import { Type, Kind, Digit } from '..';

*
* @param A - A single-digit type.
* @param B - A single-digit type.
* @template A - A single-digit type.
* @template B - A single-digit type.
*

@@ -148,4 +148,4 @@ * @example

*
* @param A - A single-digit type
* @param B - A single-digit type
* @template A - A single-digit type
* @template B - A single-digit type
*

@@ -167,4 +167,4 @@ * @example

*
* @param A - A single-digit type.
* @param B - A single-digit type.
* @template A - A single-digit type.
* @template B - A single-digit type.
*

@@ -171,0 +171,0 @@ * @example

@@ -137,4 +137,4 @@ import { Type, Kind, Digit } from '..';

*
* @param A - A digit type.
* @param B - A digit type.
* @template A - A digit type.
* @template B - A digit type.
*

@@ -160,4 +160,4 @@ * @example

*
* @param A - A digit type.
* @param B - A digit type.
* @template A - A digit type.
* @template B - A digit type.
*

@@ -164,0 +164,0 @@ * @example

@@ -133,4 +133,4 @@ import { Type, Digit, Kind } from '..';

*
* @param A - A digit type.
* @param B - A digit type.
* @template A - A digit type.
* @template B - A digit type.
*

@@ -160,4 +160,4 @@ * @example

*
* @param A - A digit type.
* @param B - A digit type.
* @template A - A digit type.
* @template B - A digit type.
*

@@ -164,0 +164,0 @@ * @example

@@ -139,4 +139,4 @@ import { Type, Digit, Kind } from '..';

*
* @param A - A digit type.
* @param B - A digit type.
* @template A - A digit type.
* @template B - A digit type.
*

@@ -161,4 +161,4 @@ * @example

*
* @param A - A digit type.
* @param B - A digit type.
* @template A - A digit type.
* @template B - A digit type.
*

@@ -165,0 +165,0 @@ * @example

@@ -11,4 +11,4 @@ import { Kind } from '..';

*
* @param T - The constant value to return.
* @param X - The input type. This is ignored.
* @template T - The constant value to return.
* @template X - The input type. This is ignored.
*

@@ -15,0 +15,0 @@ * @returns The configured constant value T.

@@ -8,3 +8,3 @@ import { Kind } from '..';

* @template T - The input type to return unchanged
* @param x - The input value of type T
* @template x - The input value of type T
* @returns The input value x, unchanged

@@ -11,0 +11,0 @@ *

@@ -11,3 +11,3 @@ import { Kind, Type } from '..';

*
* @param T - A function type
* @template T - A function type
* @returns The inferred return type R of T, or `never`

@@ -30,3 +30,3 @@ *

*
* @param x - A function type
* @template x - A function type
* @returns The inferred return type of the function

@@ -33,0 +33,0 @@ *

@@ -14,2 +14,3 @@ export { $, $$, $N } from './$';

export * as Function from './function';
export * as Integer from './integer';
import * as Kind from './kind';

@@ -16,0 +17,0 @@ export * as Kind from './kind';

@@ -9,4 +9,4 @@ import { $, Type, Kind } from '..';

*
* @param K - The kind to apply
* @param X - The value to apply K to
* @template K - The kind to apply
* @template X - The value to apply K to
*

@@ -29,4 +29,4 @@ * @returns The result of applying K to the casted X

*
* @param X - The value of type X to apply the kind to
* @param K - The kind to apply
* @template X - The value of type X to apply the kind to
* @template K - The kind to apply
*

@@ -33,0 +33,0 @@ * @returns The result of applying K to x

@@ -13,3 +13,3 @@ import { Type, Kind } from '..';

*
* @param F - A tuple containing two kinds to check
* @template F - A tuple containing two kinds to check
*

@@ -38,3 +38,3 @@ * @returns Whether the kinds are composable

*
* @param K - A tuple containing two kinds to check
* @template K - A tuple containing two kinds to check
*

@@ -41,0 +41,0 @@ * @returns Whether the kinds are composable

@@ -29,3 +29,3 @@ import { Type, List, Kind } from '..';

*
* @param FX - The tuple of kinds to check
* @template FX - The tuple of kinds to check
* @returns Whether the kinds can be composed

@@ -64,3 +64,3 @@ *

*
* @param K - The tuple of kinds to check
* @template K - The tuple of kinds to check
* @returns Whether the kinds are composable

@@ -67,0 +67,0 @@ *

@@ -9,4 +9,4 @@ import { $, Type, List, Kind } from '..';

*
* @param {Kind.Kind[]} FX - a tuple of type-level functions
* @param X - a type to which a `Kind` can be applied.
* @template {Kind.Kind[]} FX - a tuple of type-level functions
* @template X - a type to which a `Kind` can be applied.
*

@@ -44,4 +44,4 @@ * @see {@link Kind._$pipe}

*
* @param {Kind.Kind[]} FX - a tuple of type-level functions
* @param X - a type to which a `Kind` can be applied.
* @template {Kind.Kind[]} FX - a tuple of type-level functions
* @template X - a type to which a `Kind` can be applied.
*

@@ -48,0 +48,0 @@ * @see {@link Kind.Pipe}

@@ -14,4 +14,4 @@ import { $, Kind, Number, NaturalNumber, Conditional, Type } from '..';

*
* @param {Number.Number} N - The number of arguments to expect.
* @param {Kind.Kind} K - The type-level function to curry.
* @template {Number.Number} N - The number of arguments to expect.
* @template {Kind.Kind} K - The type-level function to curry.
*

@@ -63,4 +63,4 @@ * See `Combinator.Collate` for a similar combinator.

*
* @param {Number.Number} N - The number of arguments to expect.
* @param {Kind.Kind} K - The type-level function to curry.
* @template {Number.Number} N - The number of arguments to expect.
* @template {Kind.Kind} K - The type-level function to curry.
*

@@ -67,0 +67,0 @@ * See `Combinator.Collate` for a similar combinator.

export * from './apply';
export * from './apply-n';
export * from './arity';
export * from './composable-pair';

@@ -9,2 +11,3 @@ export * from './composable';

export * from './output-of';
export * from './parameters';
export * from './pipe';

@@ -11,0 +14,0 @@ export * from './reify';

@@ -6,3 +6,3 @@ import { Type, Kind } from '..';

*
* @template F The kind whose function's input type needs to be inferred.
* @template F - The kind whose function's input type needs to be inferred.
*

@@ -23,3 +23,3 @@ * @returns The inferred input type of the provided kind's function. If the kind's function doesn't have a deducible input type, it will return `unknown`.

*
* @template F The kind whose input type needs to be inferred.
* @template F - The kind whose input type needs to be inferred.
*

@@ -26,0 +26,0 @@ * @returns The inferred input type of the provided kind. If the kind doesn't

@@ -15,3 +15,3 @@ import { Function } from '..';

*
* @template F The type-level function associated with the kind. Defaults to the base `Function.Function`.
* @template F - The type-level function associated with the kind. Defaults to the base `Function.Function`.
*

@@ -18,0 +18,0 @@ * - [_] An internal unique identifier for the kind.

@@ -6,3 +6,3 @@ import { Kind, Type } from '..';

*
* @template F The kind whose function's output type needs to be inferred.
* @template F - The kind whose function's output type needs to be inferred.
*

@@ -22,3 +22,3 @@ * @returns The inferred output type of the provided kind's function. If the kind's function doesn't have a deducible output type, it will return `unknown`.

*
* @template F The kind whose output type needs to be inferred.
* @template F - The kind whose output type needs to be inferred.
*

@@ -25,0 +25,0 @@ * @returns The inferred output type of the provided kind. If the kind doesn't have a deducible output type, it will return `unknown`.

@@ -8,4 +8,4 @@ import { Type, List, Kind } from '..';

*
* @param {Kind.Kind[]} FX - a tuple of type-level functions
* @param X - a type to which a `Kind` can be applied
* @template {Kind.Kind[]} FX - a tuple of type-level functions
* @template X - a type to which a `Kind` can be applied
*

@@ -42,4 +42,4 @@ * @see {@link Kind._$compose}

*
* @param {Kind.Kind[]} FX - a tuple of type-level functions
* @param X - a type to which a `Kind` can be applied
* @template {Kind.Kind[]} FX - a tuple of type-level functions
* @template X - a type to which a `Kind` can be applied
*

@@ -46,0 +46,0 @@ * @see {@link Kind.Compose}

@@ -6,3 +6,3 @@ import { $, Kind, Type } from '..';

*
* @template K The kind to be "reified" or transformed into a function signature.
* @template K - The kind to be "reified" or transformed into a function signature.
*

@@ -23,3 +23,3 @@ * @returns A function signature derived from the provided kind, allowing it to accept and return appropriate types.

*
* @template F The kind to be reified.
* @template F - The kind to be reified.
*

@@ -26,0 +26,0 @@ * @returns A function signature derived from the provided kind.

@@ -8,4 +8,4 @@ import { $, Kind, Type } from '..';

*
* @param {Kind.Kind} K - The target type-level function to unapply.
* @param {Kind.Kind} F - The type-level function that was applied to an argument to derive `K`
* @template {Kind.Kind} K - The target type-level function to unapply.
* @template {Kind.Kind} F - The type-level function that was applied to an argument to derive `K`
*

@@ -37,4 +37,4 @@ * Note that `_$unapply` infers the most specific type for the closure argument,

*
* @param {Kind.Kind} K - The target type-level function to unapply.
* @param {Kind.Kind} F - The type-level function that was applied to an argument to derive `K`
* @template {Kind.Kind} K - The target type-level function to unapply.
* @template {Kind.Kind} F - The type-level function that was applied to an argument to derive `K`
*

@@ -41,0 +41,0 @@ * Note that `_$unapply` infers the most specific type for the closure argument,

@@ -10,4 +10,4 @@ import { $, Kind, Type } from '..';

*
* @param {Kind.Kind} K - The type-level function to apply.
* @param {List.List} X - The list of arguments to apply the type-level function to.
* @template {Kind.Kind} K - The type-level function to apply.
* @template {List.List} X - The list of arguments to apply the type-level function to.
*

@@ -32,4 +32,4 @@ * This is useful for applying a type-level function that takes many arguments,

*
* @param {Kind.Kind} K - The type-level function to apply.
* @param {List.List} X - The list of arguments to apply the type-level function to.
* @template {Kind.Kind} K - The type-level function to apply.
* @template {List.List} X - The list of arguments to apply the type-level function to.
*

@@ -36,0 +36,0 @@ * This is useful for applying a type-level function that takes many arguments,

@@ -12,6 +12,7 @@ import { $N, Kind, Type, List } from '..';

*
* @param F - A type-level function for a pairwise operation.
* @param X - A list of types. The target of the accumulate operation.
* @param O - A type specifying the initial argument that will be taken by `F`.
* @template F - A type-level function for a pairwise operation.
* @template X - A list of types. The target of the accumulate operation.
* @template O - A type specifying the initial argument that will be taken by `F`.
* To use the first element of `X` as the initial argument, simply pass in `Function.Identity`.
* @returns A list of types containing the results of the accumulate operation.
*

@@ -21,7 +22,3 @@ * @example

*
* ```ts
* import { List } from "hkt-toolbelt";
*
* type SummationSum1to10 = List._$accumulate<NaturalNumber.Add, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], []>; // [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]
* ```
*/

@@ -45,6 +42,7 @@ export type _$accumulate<F extends Kind.Kind<(x: never) => Kind.Kind>, X extends List.List, O extends Kind._$inputOf<F>, M extends Kind._$inputOf<F>[] = [], CURR = List._$first<X>, REST extends List.List = List._$shift<X>, ACC = $N<F, [O, CURR]>, RESULT extends Kind._$inputOf<F>[] = X extends [] ? M : ACC extends Kind._$inputOf<F> ? _$accumulate<F, REST, ACC, List._$push<ACC, M>> : never> = 0 extends 1 ? never : RESULT;

*
* @param F - A type-level function for a pairwise operation.
* @param O - A type specifying the initial argument that will be taken by `F`.
* @template F - A type-level function for a pairwise operation.
* @template O - A type specifying the initial argument that will be taken by `F`.
* To use first element of `X` as the initial argument, simply pass in `Function.Identity`.
* @param X - A list of types. The target of the accumulate operation.
* @template X - A list of types. The target of the accumulate operation.
* @returns A list of types containing the results of the accumulate operation.
*

@@ -54,7 +52,3 @@ * @example

*
* ```ts
* import { $, List } from "hkt-toolbelt";
*
* type SummationSum1to10 = $<$<$<List.Accumulate, NaturalNumber.Add>, 0>, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>; // [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]
* ```
*

@@ -65,5 +59,2 @@ * @example

*
* ```ts
* import { $N, List } from "hkt-toolbelt";
*
* type IsFalse = $N<List.Accumulate, [

@@ -74,3 +65,2 @@ * Boolean.Xor,

* ]>; // [true, false, false, true]
* ```
*

@@ -81,9 +71,5 @@ * @example

*
* ```ts
* import { $, $N, List, Number } from hkt-toolbelt;
*
* type GetMax = $N<List.Accumulate, [Number.Max, Number.MIN_SAFE_INTEGER]>;
* type IsZero = $<GetMax, [-5, -4, -3, -2, -1, 0]; // [-5, -4, -3, -2, -1, 0]
* type IsHundred = $<GetMax, [1, -1, 10, -10, 100, -100]>; // [1, 1, 10, 10, 100, 100]
* ```
*

@@ -94,5 +80,2 @@ * @example

*
* ```ts
* import { $, $N, List, Conditional, Number, String } from "hkt-toolbelt";
*
* type GetMinOrJoin = $N<Conditional.If, [

@@ -103,6 +86,4 @@ * $<Conditional.Extends, number[]>,

* ]>;
*
* type IsNegativeHundred = $<GetMinOrJoin, [1, -1, 10, -10, 100, -100]>; // [1, -1, -1, -10, -10, -100]
* type HelloWorld = $<GetMinOrJoin, ["hello", "world"]>; // "hello, world"
* ```
*/

@@ -109,0 +90,0 @@ export interface Accumulate extends Kind.Kind {

import { DigitList, Kind, Type, Number, List, NaturalNumber } from '../';
export type _$at<T extends List.List, POS extends Number.Number, T_LENGTH extends DigitList.DigitList = NaturalNumber._$toList<T['length']>, POS_ABS extends DigitList.DigitList = NaturalNumber._$toList<Number._$absolute<POS>>, POS_NORM extends DigitList.DigitList = Number._$isNatural<POS> extends true ? DigitList._$compare<POS_ABS, T_LENGTH> extends -1 ? POS_ABS : never : DigitList._$compare<T_LENGTH, POS_ABS> extends -1 ? never : DigitList._$subtract<T_LENGTH, POS_ABS>, INDEX extends number = DigitList._$toNumber<POS_NORM>> = POS_NORM extends never ? never : T[INDEX];
/**
* `_$at` is a type-level function that retrieves and returns an element from a tuple type.
*
* It takes in two arguments: a tuple, and an integer specifying the index of the element to be accessed.
* Both positive and negative indices are supported, with negative indices being normalized into zero-based indices under the hood.
*
* @template T - A tuple type.
* @template POS - An integer type specifying the index of the element to be accessed.
* @returns The element of `T` at index `POS`.
*
* ## Edge Cases
*
* If `POS` is greater than or equal to the length of `T`, returns `never`.
* If `POS` is lesser than the negated length of `T`, returns `never`.
* If `POS` is not a numeric type, returns `never`.
*
* @example
* A negative index counts back from the end of the input tuple.
*
* type MyList = ['a', 'b', 'c', 'd', 'e'];
*
* type Head = List._$at<MyList, 0>; // 'a'
* type Tail = List._$at<MyList, -1>; // 'e'
*
* type IsNever = List._$at<MyList, 5>; // never
* type IsNever2 = List._$at<MyList, -6>; // never
* ```
*/
export type _$at<
/**
* The list to extract the element from.
*/
T extends List.List,
/**
* The index of the element to extract.
*/
POS extends Number.Number,
/**
* The length of the list. Computed via taking the length of the tuple and
* converting it to a natural number.
*/
T_LENGTH extends DigitList.DigitList = NaturalNumber._$toList<T['length']>,
/**
* The absolute value of the index. Computed via taking the absolute value of
* the index.
*/
POS_ABS extends DigitList.DigitList = NaturalNumber._$toList<Number._$absolute<POS>>,
/**
* The normalized index. Computed via taking the absolute value of the index
* if the index is negative, otherwise the index itself.
*/
POS_NORM extends DigitList.DigitList = Number._$isNatural<POS> extends true ? DigitList._$compare<POS_ABS, T_LENGTH> extends -1 ? POS_ABS : never : DigitList._$compare<T_LENGTH, POS_ABS> extends -1 ? never : DigitList._$subtract<T_LENGTH, POS_ABS>, INDEX extends number = DigitList._$toNumber<POS_NORM>> = POS_NORM extends never ? never : T[INDEX];
interface At_T<X extends Number.Number> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], unknown[]>): Number._$isInteger<X> extends true ? _$at<typeof x, X> : never;
}
/**
* `At` is a type-level function that retrieves and returns an element from a tuple type.
*
* It takes in two arguments: a tuple, and an integer specifying the index of the element to be accessed.
* Both positive and negative indices are supported, with negative indices being normalized into zero-based indices under the hood.
*
* @template T - A tuple type.
* @template POS - An integer type specifying the index of the element to be accessed.
* @returns The element of `T` at index `POS`.
*
* ## Edge Cases
*
* If `POS` is greater than or equal to the length of `T`, returns `never`.
* If `POS` is lesser than the negated length of `T`, returns `never`.
* If `POS` is not an integer type, returns `never`.
*
* @example
* A negative index counts back from the end of the input tuple.
*
* type MyList = ['a', 'b', 'c', 'd', 'e'];
*
* type Head = $<$<List.At, 0>, MyList>; // 'a'
* type Tail = $<$<List.At, -1>, MyList>; // 'e'
*
* type IsNever = $<$<List.At, 5>, MyList>; // never
* type IsNever2 = $<$<List.At, -6>, MyList>; // never
*/
export interface At extends Kind.Kind {

@@ -7,0 +85,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): At_T<typeof x>;

@@ -8,4 +8,6 @@ import { Type, Kind, List } from '..';

*
* @param T - A tuple type.
* @param U - A tuple type, or an unknown.
* @template T - A tuple type to be concatenated onto.
* @template U - A tuple type to concatenate, or an unknown.
* @returns A tuple type.
*
* If `U` is not a tuple type, it will be pushed into `T` as its new last element.

@@ -16,19 +18,11 @@ *

* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type Result = List._$concat<[0, 1], [2, 3]>; // [0, 1, 2, 3]
* ```
*
* ## Advanced Usage
*
* @example
* Concatenating to a tuple with a rest parameter results in a tuple that contains the concatenated tuple.
*
* ```ts
* import { $, List } from 'hkt-toolbelt';
* @example
* type Result = List._$concat<[1, 2, ...string[]], ["foo"]>; // [1, 2, ...string[], "foo"]
*
* List._$concat<[1, 2, ...string[]], ["foo"]>; // [1, 2, ...string[], "foo"]
* ```
*
*/

@@ -45,4 +39,6 @@ export type _$concat<U extends unknown, T extends unknown[]> = U extends unknown[] ? [...T, ...U] : List._$push<U, T>;

*
* @param T - A tuple type.
* @param U - A tuple type, or an unknown.
* @template T - A tuple type to be concatenated onto.
* @template U - A tuple type to concatenate, or an unknown.
* @returns A tuple type.
*
* If `U` is not a tuple type, it will be pushed into `T` as its new last element.

@@ -53,19 +49,11 @@ *

* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type Result = $<$<List.Concat [2, 3]>, [1, 2]>; // [0, 1, 2, 3]
* ```
*
* ## Advanced Usage
*
* @example
* Concatenating to a tuple with a rest parameter results in a tuple that contains the concatenated tuple.
*
* ```ts
* import { $, List } from 'hkt-toolbelt';
* @example
* type Result = $<$<List.Concat, ["foo"]>, [1, 2, ...string[]]>; // [1, 2, ...string[], "foo"]
*
* $<$<List.Concat, ["foo"]>, [1, 2, ...string[]]>; // [1, 2, ...string[], "foo"]
* ```
*
*/

@@ -72,0 +60,0 @@ export interface Concat extends Kind.Kind {

import { $, Boolean, Type, Kind } from '..';
/**
* `_$every` is a type-level function that checks if every element in a tuple satisfies a predicate.
*
* @template F - The predicate function.
* @template T - The tuple to check.
* @returns A boolean.
*
* @example
* type T0 = List._$every<$<Conditional.Extends, number>, [1, 2, 3]> // true
* type T1 = List._$every<$<Conditional.Extends, number>, [1, 2, 3, 'x']> // false
*/
export type _$every<F extends Kind.Kind<(x: never) => boolean>, T extends unknown[], O extends boolean = true> = T extends [infer Head, ...infer Rest] ? _$every<F, Rest, Boolean._$and<O, $<F, Type._$cast<Head, Kind._$inputOf<F>>>>> : O;

@@ -6,2 +17,13 @@ interface Every_T<F extends Kind.Kind<(x: never) => boolean>> extends Kind.Kind {

}
/**
* `Every` is a type-level function that checks if every element in a tuple satisfies a predicate.
*
* @template F - The predicate function.
* @template T - The tuple to check.
* @returns A boolean.
*
* @example
* type T0 = $<$<List.Every, $<Conditional.Extends, number>>, [1, 2, 3]> // true
* type T1 = $<$<List.Every, $<Conditional.Extends, number>>, [1, 2, 3, 'x']> // false
*/
export interface Every extends Kind.Kind {

@@ -8,0 +30,0 @@ f(x: Type._$cast<this[Kind._], Kind.Kind<(x: never) => boolean>>): Every_T<typeof x>;

@@ -11,4 +11,5 @@ import { $, Type, Kind } from '..';

*
* @param F - A type-level function that returns a boolean type indicating whether a type should be included in the result.
* @param X - A list of types. The target of the filtering operation.
* @template F - A type-level function that returns a boolean type indicating whether a type should be included in the result.
* @template X - A list of types. The target of the filtering operation.
* @returns A list of types that satisfy the predicate `F`.
*

@@ -18,7 +19,3 @@ * @example

*
* ```ts
* import { List } from "hkt-toolbelt";
*
* type FilteredNumbers = List._$filter<Conditional.IsPositive, [1, -2, 3, -4]>; // [1, 3]
* ```
*/

@@ -38,4 +35,5 @@ export type _$filter<F extends Kind.Kind, X extends unknown[], O extends unknown[] = []> = X extends [infer Head, ...infer Tail] ? $<F, Type._$cast<Head, Kind._$inputOf<F>>> extends true ? _$filter<F, Tail, [...O, Head]> : _$filter<F, Tail, O> : O;

*
* @param F - A type-level function that returns a boolean type indicating whether a type should be included in the result.
* @param X - A list of types. The target of the filtering operation.
* @template F - A type-level function that returns a boolean type indicating whether a type should be included in the result.
* @template X - A list of types. The target of the filtering operation.
* @returns A list of types that satisfy the predicate `F`.
*

@@ -45,7 +43,3 @@ * @example

*
* ```ts
* import { $, List, Conditional } from "hkt-toolbelt";
*
* type FilteredNumbers = $<$<List.Filter, Conditional.IsPositive>, [1, -2, 3, -4]>; // [1, 3]
* ```
*

@@ -56,5 +50,2 @@ * @example

*
* ```ts
* import { $N, List } from "hkt-toolbelt";
*
* type FilterZeros = $N<List.Filter, [

@@ -64,3 +55,2 @@ * $<Conditional.NotEquals, 0>,

* ]>; // [1, 2, 3]
* ```
*

@@ -71,9 +61,5 @@ * @example

*
* ```ts
* import { $, List, Conditional } from hkt-toolbelt;
*
* type FilterZeros = $<List.Filter, $<Conditional.NotEquals, 0>>;
* type AllZero = $<FilterZeros, [0, 0, 0, 0, 0]>; // []
* type OneZero = $<FilterZeros, [0, 1, 2, 3, 4, 5]>; // [1, 2, 3, 4, 5]
* ```
*

@@ -84,5 +70,2 @@ * @example

*
* ```ts
* import { $, $$, List, Conditional, String } from "hkt-toolbelt";
*
* type HelloWorld = $$<[

@@ -92,3 +75,2 @@ * $<List.Filter, $<Conditional.Extends, string>>

* ], [42.42, null, "hello", undefined, "world"]> // "hello, world"
* ```
*/

@@ -95,0 +77,0 @@ export interface Filter extends Kind.Kind {

import { $, Type, Kind } from '..';
/**
* `_$find` is a type-level function that finds the first element in a list that satisfies a predicate.
*
* @template F - The predicate function.
* @template X - The list to search.
* @returns An element of `X`.
*
* @example
* type T0 = List._$find<$<Conditional.Equals, 3>, [1, 2, 3]> // 3
* type T1 = List._$find<$<Conditional.Equals, 4>, [1, 2, 3]> // never
*/
export type _$find<F extends Kind.Kind, X extends unknown[]> = X extends [

@@ -6,5 +17,21 @@ infer Head,

] ? $<F, Type._$cast<Head, Kind._$inputOf<F>>> extends true ? Head : _$find<F, Tail> : never;
/**
* `List.Find_T` is an intermediate interface for currying.
*
* @template F - The condition function.
*/
interface Find_T<F extends Kind.Kind<(x: never) => boolean>> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], Kind._$inputOf<F>[]>): _$find<F, typeof x>;
}
/**
* `Find` is a type-level function that finds the first element in a list that satisfies a predicate.
*
* @template F - The predicate function.
* @template X - The list to search.
* @returns An element of `X`.
*
* @example
* type T0 = $<$<List.Find, $<Conditional.Equals, 3>>, [1, 2, 3]> // 3
* type T1 = $<$<List.Find, $<Conditional.Equals, 4>>, [1, 2, 3]> // never
*/
export interface Find extends Kind.Kind {

@@ -11,0 +38,0 @@ f(x: Type._$cast<this[Kind._], Kind.Kind<(x: never) => boolean>>): Find_T<typeof x>;

import { Type, Kind } from '..';
/**
* `_$first` is a type-level function that returns the first element of a tuple.
*
* @template T - The tuple to get the first element of.
* @returns An element of `T`.
*
* @example
* type T0 = List._$first<[1, 2, 3]> // 1
* type T1 = List._$first<[]> // never
*/
export type _$first<T extends unknown[]> = T extends [] ? never : T[0];
/**
* `First` is a type-level function that returns the first element of a tuple.
*
* @template T - The tuple to get the first element of.
* @returns An element of `T`.
*
* @example
* type T0 = $<List.First, [1, 2, 3]> // 1
* type T1 = $<List.First, []> // never
*/
export interface First extends Kind.Kind {
f(x: Type._$cast<this[Kind._], unknown[]>): _$first<typeof x>;
}

@@ -7,20 +7,13 @@ import { DigitList, Kind, Number, Type, NaturalNumber, Digit, List } from '..';

*
* @param T - The input tuple.
* @param N - Natural number specifying the depth level by which a nested tuple should be flattened.
* @template T - The input tuple.
* @template N - Natural number specifying the depth level by which a nested tuple should be flattened.
* If N is greater than or equal to the depth of the input tuple `T`, `T` will be flattened completely.
* @returns A single depth-level list of types.
*
* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type MyList = [0, [1, [2, [3, [4]]]]]
*
* type Result1 = List._$flattenN<MyList, 1> // [0, 1, [2, [3, [4]]]]
*
* type Result2 = List._$flattenN<MyList, 2> // [0, 1, 2, [3, [4]]]
*
* type Result3 = List._$flattenN<MyList, 4> // [0, 1, 2, 3, 4]
*
* type Result4 = List._$flattenN<MyList, 5> // [0, 1, 2, 3, 4]
* ```
*/

@@ -34,20 +27,13 @@ export type _$flattenN<T extends unknown[], N extends Number.Number, RESULT extends List.List = Number._$isNatural<N> extends true ? _$flattenN2<T, NaturalNumber._$toList<N>> : never> = RESULT;

*
* @param T - The input tuple.
* @param N - Natural number specifying the depth level by which a nested tuple should be flattened.
* @template T - The input tuple.
* @template N - Natural number specifying the depth level by which a nested tuple should be flattened.
* If N is greater than or equal to the depth of the input tuple `T`, `T` will be flattened completely.
* @returns A single depth-level list of types.
*
* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type MyList = [0, [1, [2, [3, [4]]]]]
*
* type Result1 = $<$<List.FlattenN, 1>, MyList> // [0, 1, [2, [3, [4]]]]
*
* type Result2 = $<$<List.FlattenN, 2>, MyList> // [0, 1, 2, [3, [4]]]
*
* type Result3 = $<$<List.FlattenN, 4>, MyList> // [0, 1, 2, 3, 4]
*
* type Result4 = $<$<List.FlattenN, 5>, MyList> // [0, 1, 2, 3, 4]
* ```
*/

@@ -54,0 +40,0 @@ export interface FlattenN extends Kind.Kind {

@@ -5,13 +5,8 @@ import { Kind, List, Type } from '..';

*
* @param T - The input tuple.
* @template T - The input tuple.
* @returns A single depth-level list of types.
*
* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type MyList = [0, [1, [2, [3, [4]]]]]
*
* type Result = List._$flatten<MyList> // [0, 1, 2, 3, 4]
* ```
*
*/

@@ -22,13 +17,8 @@ export type _$flatten<T extends unknown[], RESULT extends List.List = T extends [infer H, ...infer R] ? H extends unknown[] ? [..._$flatten<H>, ..._$flatten<R>] : [H, ..._$flatten<R>] : []> = RESULT;

*
* @param T - The input tuple.
* @template T - The input tuple.
* @returns A single depth-level list of types.
*
* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type MyList = [0, [1, [2, [3, [4]]]]]
*
* type Result = $<List.Flatten, MyList> // [0, 1, 2, 3, 4]
* ```
*
*/

@@ -35,0 +25,0 @@ export interface Flatten extends Kind.Kind {

import { $, Type, Kind } from '..';
/**
* `_$includes` is a type-level function that checks if a list includes a certain element.
*
* @template F - The function to apply to each element.
* @template X - The list to check.
* @returns A boolean.
*
* @example
* type T0 = List._$includes<$<Conditional.Equals, 3>, [1, 2, 3]> // true
* type T1 = List._$includes<$<Conditional.Equals, 4>, [1, 2, 3]> // false
*/
export type _$includes<F extends Kind.Kind, X extends unknown[]> = X extends [

@@ -9,2 +20,13 @@ infer Head,

}
/**
* `Includes` is a type-level function that checks if a list includes a certain element.
*
* @template T - The function to apply to each element.
* @template X - The list to check.
* @returns A boolean.
*
* @example
* type T0 = $<$<List.Includes, $<Conditional.Equals, 3>>, [1, 2, 3]> // true
* type T1 = $<$<List.Includes, $<Conditional.Equals, 4>>, [1, 2, 3]> // false
*/
export interface Includes extends Kind.Kind {

@@ -11,0 +33,0 @@ f(x: Type._$cast<this[Kind._], Kind.Kind<(x: never) => boolean>>): Includes_T<typeof x>;

@@ -11,2 +11,4 @@ export * from './accumulate';

export * from './includes';
export * from './inverse-map';
export * from './inverse-map-n';
export * from './iterate';

@@ -18,2 +20,3 @@ export * from './is-variadic';

export * from './map';
export * from './map-n';
export * from './pair';

@@ -20,0 +23,0 @@ export * from './pop';

import { Type, Kind } from '..';
/**
* `_$isVariadic` is a type-level function that checks if a tuple is variadic.
*
* @template T - The tuple to check.
* @returns A boolean.
*
* @example
* type T0 = List._$isVariadic<[1, 2, 3, ...number[]]> // true
* type T1 = List._$isVariadic<[1, 2, 3]> // false
*/
export type _$isVariadic<T extends unknown[]> = number extends T['length'] ? true : false;
/**
* `IsVariadic` is a type-level function that checks if a tuple is variadic.
*
* @template T - The tuple to check.
* @returns A boolean.
*
* @example
* type T0 = $<List.IsVariadic, [1, 2, 3, ...number[]]> // true
* type T1 = $<List.IsVariadic, [1, 2, 3]> // false
*/
export interface IsVariadic extends Kind.Kind {
f(x: Type._$cast<this[Kind._], unknown[]>): _$isVariadic<typeof x>;
}
import { $, Type, Kind, Number, List, NaturalNumber } from '..';
/**
* `_$iterate` is a type-level function that repeatedly applies a function over an input value for a given number of times,
* and returns a list containing all of the intermediate results.
*
* @template F - The function to iterate with.
* @template O - The initial input to the function.
* @template N - The number of times to iterate.
* @returns A list of types containing the results of iterating `F` over `O` `N` times.
*
* @example
* type T0 = List._$iterate<$<Boolean.Xor, true>, true, 5> // [true, false, true, false, true]
*/
export type _$iterate<F extends Kind.Kind, O extends Kind._$inputOf<F>, N extends Number.Number, COUNT extends Number.Number = NaturalNumber._$decrement<N>, M extends Kind._$inputOf<F>[] = [O], CURR extends Kind._$inputOf<F> = O, ACC = $<F, CURR>, RESULT extends Kind._$inputOf<F>[] = COUNT extends 0 ? M : ACC extends Kind._$inputOf<F> ? _$iterate<F, O, N, NaturalNumber._$decrement<COUNT>, List._$push<ACC, M>, ACC> : never> = 0 extends 1 ? never : RESULT;

@@ -9,2 +21,14 @@ interface Iterate_T2<F extends Kind.Kind, N extends Number.Number> extends Kind.Kind {

}
/**
* `Iterate` is a type-level function that repeatedly applies a function over an input value for a given number of times,
* and returns a list containing all of the intermediate results.
*
* @template F - The function to iterate with.
* @template N - The number of times to iterate.
* @template O - The initial input to the function.
* @returns A list of types containing the results of iterating `F` over `O` `N` times.
*
* @example
* type T0 = $<$<$<List.Iterate, $<Boolean.Xor, true>>, 5>, true> // [true, false, true, false, true]
*/
export interface Iterate extends Kind.Kind {

@@ -11,0 +35,0 @@ f(x: Type._$cast<this[Kind._], Kind.Kind>): Iterate_T<typeof x>;

import { Type, Kind } from '..';
/**
* `_$last` is a type-level function that returns the last element of a tuple.
*
* @template T - The tuple to get the last element of.
* @returns An element of `T`.
*
* @example
* type T0 = List._$last<[1, 2, 3]> // 3
* type T1 = List._$last<[]> // never
* type T2 = List._$last<number[]> // number
* type T3 = List._$last<[string, ...number[]]> // number
* type T4 = List._$last<[string, ...number[], 'foo']> // 'foo'
* type T5 = List._$last<[string]> // string
*/
export type _$last<T extends readonly unknown[]> = T extends [infer X] ? X : T extends [unknown, ...infer Tail] ? _$last<Tail> : T extends [...unknown[], infer X] ? X : T[number];
/**
* `Last` is a type-level function that returns the last element of a tuple.
*
* @template T - The tuple to get the last element of.
* @returns An element of `T`.
*
* @example
* type T0 = $<List.Last, [1, 2, 3]> // 3
* type T1 = $<List.Last, []> // never
* type T2 = $<List.Last, number[]> // number
* type T3 = $<List.Last, [string, ...number[]]> // number
* type T4 = $<List.Last, [string, ...number[], 'foo']> // 'foo'
* type T5 = $<List.Last, [string]> // string
*/
export interface Last extends Kind.Kind {
f(x: Type._$cast<this[Kind._], readonly unknown[]>): _$last<typeof x>;
}
import { Type, Kind } from '..';
/**
* `_$length` is a type-level function that returns the length of a list.
*
* @template T - The list to get the length of.
* @returns A non-negative integer type.
*
* @example
* type T0 = List._$length<[1, 2, 3]> // 3
* type T1 = List._$length<[]> // 0
*/
export type _$length<T extends unknown[]> = T['length'];
/**
* `Length` is a type-level function that returns the length of a list.
*
* @template T - The list to get the length of.
* @returns A non-negative integer type.
*
* @example
* type T0 = $<List.Length, [1, 2, 3]> // 3
* type T1 = $<List.Length, []> // 0
*/
export interface Length extends Kind.Kind {
f(x: Type._$cast<this[Kind._], unknown[]>): _$length<typeof x>;
}
import { $, Type, Kind } from '..';
/**
* `_$map` is a type-level function that takes in two inputs:
* a partially-applied type-level function that expects one more argument,
* and a target list of types upon which to perform the map operation.
* It returns a mapped list of types.
* `_$map` is a type-level function that maps a type-level function over a list of types.
*
* The type-level function input must be a unary, curried `Kind` type as defined in this library.
* @see {@link https://github.com/poteat/hkt-toolbelt/blob/main/docs/guides/custom-kinds.md} for details on how to create a custom kind.
* @template F - The type-level function to map.
* @template X - The list of types to map over.
* @returns A list of types containing the results of mapping `F` over `X`.
*
* @param F - A type-level function that transforms a unary input and returns the result.
* @param X - A list of types. The target of the map operation.
*
* @example
* For example, we can use `_$map` to extract the same property from a list of objects.
*
* ```ts
* import { List, Object } from "hkt-toolbelt";
*
* type GetCities = List._$map<$<
* Object.At, "city">,
* [{ city: "Los Angeles", country: "USA" }, { city: "Seoul", country: "Korea" }, { city: "Paris", country: "France" }]
* >; // ["Los Angeles", "Seoul", "Paris"]
* ```
* type T0 = List._$map<$<Conditional.Equals, 'foo'>, ['foo', 'bar']> // [true, false]
* type T1 = List._$map<$<Function.Constant, 'foo'>, ['foo', 'bar']> // ['foo', 'foo']
*/
export type _$map<T extends Kind.Kind, X extends unknown[]> = {
[key in keyof X]: $<T, Type._$cast<X[key], Kind._$inputOf<T>>>;
export type _$map<F extends Kind.Kind, X extends unknown[]> = {
[key in keyof X]: $<F, Type._$cast<X[key], Kind._$inputOf<F>>>;
};
interface Map_T<T extends Kind.Kind> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], unknown[]>): _$map<T, typeof x>;
interface Map_T<F extends Kind.Kind> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], unknown[]>): _$map<F, typeof x>;
}
/**
* `Map` is a type-level function that takes in two inputs:
* a partially-applied type-level function that expects one more argument,
* and a target list of types upon which to perform the map operation.
* It returns a mapped list of types.
* `Map` is a type-level function that maps a type-level function over a list of types.
*
* The type-level function input must be a unary, curried `Kind` type as defined in this library.
* @see {@link https://github.com/poteat/hkt-toolbelt/blob/main/docs/guides/custom-kinds.md} for details on how to create a custom kind.
* @template T - The type-level function to map.
* @template X - The list of types to map over.
* @returns A list of types containing the results of mapping `F` over `X`.
*
* @param F - A type-level function that transforms a unary input and returns the result.
* @param X - A list of types. The target of the map operation.
*
* @example
* For example, we can use `Map` to extract the same property from a list of objects.
*
* ```ts
* import { $, List, Object } from "hkt-toolbelt";
*
* type GetCities = $<$<List.Map, $<Object.At, "city">>, [
* { city: "Los Angeles", country: "USA" },
* { city: "Seoul", country: "Korea" },
* { city: "Paris", country: "France" }
* ]>; // ["Los Angeles", "Seoul", "Paris"]
*
* @example
* We can also use the `$N` applicator to invoke `Map` with a list containing the required arguments
* This improves readability by allowing us to avoid nesting `$` calls.
*
* ```ts
* import { $N, List, Object } from "hkt-toolbelt";
*
* type GetCities = $N<List.Map, [
* $<Object.At, "city">,
* [
* { city: "Los Angeles", country: "USA" },
* { city: "Seoul", country: "Korea" },
* { city: "Paris", country: "France" }
* ]
* ]>; // ["Los Angeles", "Seoul", "Paris"]
* ```
*
* @example
* By partially applying only the first argument to `Map`,
* we can define a type-level function that can apply the same operation to multiple list inputs.
*
* ```ts
* import { $, List, NaturalNumber } from hkt-toolbelt;
*
* type MultiplyByTwo = $<List.Map, $<NaturalNumber.Multiply, 2>>;
* type EvenNums = $<MultiplyByTwo, [1, 2, 3, 4, 5]>; // [2, 4, 6, 8, 10]
* type AllZero = $<MultiplyByTwo, [0, 10, 20, 30, 40]>; // [0, 20, 40, 60, 80]
* ```
*
* @example
* Another use case for a partially-applied `Map` function is to implement
* sophisticated higher-order functionality by passing it into other type-level functions.
*
* ```ts
* import { $, $$, $N, Kind, List, Object, Conditional, String } from "hkt-toolbelt";
*
* type BooleanToBinary = $<Kind.Pipe, [
* $<List.Map,
* $N<Conditional.If, [
* $<Conditional.Extends, true>,
* $<Function.Constant, "1">,
* $<Function.Constant, "0">,
* ]>
* >,
* DigitList.ToString,
* $<String.Prepend, "0b">
* ]>
*
* type MapBooleanToBinary = $N<List.Map, [
* BooleanToBinary,
* [
* [true, true, true, true, false],
* [true, false, true, false, true],
* ]
* ]> // ["0b11110", "0b10101"]
* ```
* type T0 = $<$<List.Map, $<Conditional.Equals, 'foo'>>, ['foo', 'bar']> // [true, false]
* type T1 = $<$<List.Map, $<Function.Constant, 'foo'>>, ['foo', 'bar']> // ['foo', 'foo']
*/

@@ -113,0 +30,0 @@ export interface Map extends Kind.Kind {

import { Type, Kind } from '..';
/**
* `_$pair` is a type-level function that generates a tuple of pairs from a tuple,
* where each element is paired with the next element.
*
* @template T - The tuple to generate pairs from.
* @returns A list of tuples of length 2 that contain sequential elements of `T`.
*
* @example
* type T0 = List._$pair<[1, 2, 3, 4]> // [[1, 2], [2, 3], [3, 4]]
* type T1 = List._$pair<[]> // []
* type T2 = List._$pair<[1]> // []
* type T3 = List._$pair<[1, 2]> // [[1, 2]]
*/
export type _$pair<T extends unknown[], O extends unknown[][] = []> = T extends [infer X1, infer X2, ...infer Rest] ? _$pair<[X2, ...Rest], [...O, [X1, X2]]> : number extends T['length'] ? [T[number], T[number]][] : O;
/**
* `Pair` is a type-level function that generates a tuple of pairs from a tuple,
* where each element is paired with the next element.
*
* @template T - The tuple to generate pairs from.
* @returns A list of tuples of length 2 that contain sequential elements of `T`.
*
* @example
* type T0 = $<List.Pair, [1, 2, 3, 4]> // [[1, 2], [2, 3], [3, 4]]
* type T1 = $<List.Pair, []> // []
* type T2 = $<List.Pair, [1]> // []
* type T3 = $<List.Pair, [1, 2]> // [[1, 2]]
*/
export interface Pair extends Kind.Kind {
f(x: Type._$cast<this[Kind._], unknown[]>): _$pair<typeof x>;
}
import { Type, Kind, Number, NaturalNumber, DigitList, List, Digit } from '..';
type _$popN2<T extends unknown[], N extends DigitList.DigitList, RESULT extends List.List = T extends [...infer Head, unknown] ? N extends [Digit.Zero] ? T : _$popN2<Head, DigitList._$decrement<N>> : []> = RESULT;
/**
* `_$popN` is a type-level function that pops N elements from the tail of a list.
*
* @template T - The list to pop elements from.
* @template N - The number of elements to pop.
* @returns A list of types.
*
* @example
* type T0 = List._$popN<['a', 'b', 'c'], 1> // ['a', 'b']
*/
export type _$popN<T extends unknown[], N extends Number.Number, RESULT extends List.List = Number._$isNatural<N> extends true ? _$popN2<T, NaturalNumber._$toList<N>> : never> = RESULT;

@@ -7,2 +17,12 @@ interface PopN_T<N extends Number.Number> extends Kind.Kind {

}
/**
* `PopN` is a type-level function that pops N elements from the tail of a list.
*
* @template N - The number of elements to pop.
* @template T - The list to pop elements from.
* @returns A list of types.
*
* @example
* type T0 = $<$<List.PopN, 1>, ['a', 'b', 'c']> // ['a', 'b']
*/
export interface PopN extends Kind.Kind {

@@ -9,0 +29,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): PopN_T<typeof x>;

import { Type, Kind } from '..';
/**
* `_$pop` is a type-level function that pops one element from the tail of a list.
*
* @template T - The list to pop the tail element from.
* @returns A list of types.
*
* @example
* type T0 = List._$pop<['a', 'b', 'c']> // ['a', 'b']
*/
export type _$pop<T extends readonly unknown[]> = T extends [

@@ -6,4 +15,13 @@ ...infer Head,

] ? Head : never;
/**
* `Pop` is a type-level function that pops one element from the tail of a list.
*
* @template T - The list to pop the tail element from.
* @returns A list of types.
*
* @example
* type T0 = $<List.Pop, ['a', 'b', 'c']> // ['a', 'b']
*/
export interface Pop extends Kind.Kind {
f(x: Type._$cast<this[Kind._], readonly unknown[]>): _$pop<typeof x>;
}
import { Type, Kind } from '..';
/**
* `_$push` is a type-level function that pushes an element to the end of a tuple.
*
* @template X - The element to push.
* @template T - The tuple to push the element to.
* @returns A list of types.
*
* @example
* type T0 = List._$push<3, [1, 2]> // [1, 2, 3]
* type T1 = List._$push<'foo', []> // ['foo']
*/
export type _$push<X, T extends unknown[]> = [...T, X];

@@ -6,2 +17,13 @@ interface Push_T<X> extends Kind.Kind {

}
/**
* `Push` is a type-level function that pushes an element to the end of a tuple.
*
* @template X - The element to push.
* @template T - The tuple to push the element to.
* @returns A list of types.
*
* @example
* type T0 = $<$<List.Push, 3>, [1, 2]> // [1, 2, 3]
* type T1 = $<$<List.Push, 'foo'>, []> // ['foo']
*/
export interface Push extends Kind.Kind {

@@ -8,0 +30,0 @@ f(x: this[Kind._]): Push_T<typeof x>;

@@ -1,3 +0,29 @@

import { $, Kind, Type, Number, List, NaturalNumber, Conditional } from '..';
type _$range2<START extends Number.Number, STOP extends Number.Number, STEP extends Number.Number, IS_REVERSE extends boolean = Number._$compare<STEP, 0> extends -1 ? true : false, STEP_ABS extends Number.Number = Number._$isInteger<STEP> extends true ? Number._$absolute<STEP> : never, F extends Kind.Kind<(x: never) => Kind.Kind> = IS_REVERSE extends true ? $<NaturalNumber.SubtractBy, STEP_ABS> : $<NaturalNumber.Add, STEP_ABS>, DISTANCE extends Number.Number = NaturalNumber._$subtract<Number._$max<START, STOP>, Number._$min<START, STOP>>, COUNT extends Number.Number = NaturalNumber._$divide<DISTANCE, STEP_ABS>, VALIDATE extends boolean = IS_REVERSE extends true ? NaturalNumber._$compare<START, STOP> extends 1 | 0 ? true : false : NaturalNumber._$compare<START, STOP> extends -1 | 0 ? true : false, RESULT extends Number.Number[] = START extends Kind._$inputOf<F> ? List._$iterate<F, START, COUNT> : never> = 0 extends 1 ? never : VALIDATE extends true ? COUNT extends 0 ? [] : RESULT : never;
import { $, Kind, Type, Number, List, Conditional, DigitList } from '..';
type _$range2<START extends DigitList.DigitList, STOP extends DigitList.DigitList, STEP extends DigitList.DigitList, STEP_SIGN extends '+' | '-', COUNTER extends DigitList.DigitList = START, LIST extends Number.Number[] = [DigitList._$toNumber<START>],
/**
* Whether the current counter value is larger, equal to, or smaller
* than the intended stop value.
*/
COMPARE extends 1 | 0 | -1 = DigitList._$compare<COUNTER, STOP>, NEW_COUNTER extends DigitList.DigitList = STEP_SIGN extends '+' ? DigitList._$add<COUNTER, STEP> : DigitList._$subtract<COUNTER, STEP>, NEW_LIST extends Number.Number[] = [
...LIST,
DigitList._$toNumber<NEW_COUNTER>
],
/**
* Whether we are done iterating; we basically calculate whether we
* should expect the counter to be larger or smaller than the stop
* value, per the sign of the step value.
*/
IS_DONE = STEP_SIGN extends '+' ? COMPARE extends 1 | 0 ? true : false : COMPARE extends -1 | 0 ? true : false, RESULT = List._$pop<LIST>> = 0 extends 1 ? never : IS_DONE extends true ? RESULT : _$range2<START, STOP, STEP, STEP_SIGN, NEW_COUNTER, NEW_LIST>;
/**
* `_$range` is a type-level function that generates a range of numbers.
*
* @template START - The start of the range.
* @template STOP - The end of the range.
* @template STEP - The step size for the range.
* @returns A list of integer types.
*
* @example
* type T0 = List._$range<0, 10, 1> // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
* type T1 = List._$range<10, 0, -2> // [10, 8, 6, 4, 2]
*/
export type _$range<START extends Number.Number, STOP extends Number.Number, STEP extends Number.Number> = List._$every<$<Conditional.Extends, true>, [

@@ -7,3 +33,3 @@ Number._$isNatural<START>,

Number._$isInteger<STEP>
]> extends true ? _$range2<START, STOP, STEP> : never;
]> extends true ? _$range2<DigitList._$fromString<Number._$toString<START>>, DigitList._$fromString<Number._$toString<STOP>>, DigitList._$fromString<Number._$toString<Number._$absolute<STEP>>>, Number._$sign<STEP>> : never;
interface Range_T2<START extends Number.Number, STOP extends Number.Number> extends Kind.Kind {

@@ -15,2 +41,14 @@ f(x: Type._$cast<this[Kind._], Number.Number>): _$range<START, STOP, typeof x>;

}
/**
* `Range` is a type-level function that generates a range of numbers.
*
* @template START - The start of the range.
* @template STOP - The end of the range.
* @template STEP - The step size for the range.
* @returns A list of integer types.
*
* @example
* type T0 = $<$<$<List.Range, 0>, 10>, 1> // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
* type T1 = $<$<$<List.Range, 10>, 0>, -2> // [10, 8, 6, 4, 2]
*/
export interface Range extends Kind.Kind {

@@ -17,0 +55,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Range_T<typeof x>;

@@ -12,6 +12,7 @@ import { $, Kind, Type, Function } from '..';

*
* @param F - A type-level function for a pairwise operation.
* @param X - A list of types. The target of the reduce operation.
* @param O - A type specifying the initial argument that will be taken by `F`.
* @template F - A type-level function for a pairwise operation.
* @template X - A list of types. The target of the reduce operation.
* @template O - A type specifying the initial argument that will be taken by `F`.
* To use the first element of `X` as the initial argument, simply pass in `Function.Identity`.
* @returns An unknown output type of `F`.
*

@@ -21,7 +22,3 @@ * @example

*
* ```ts
* import { List } from "hkt-toolbelt";
*
* type Sum1to10 = List._$reduce<NaturalNumber.Add, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 0>; // 55
* ```
*/

@@ -47,6 +44,7 @@ export type _$reduce<F extends Kind.Kind<(x: never) => Kind.Kind>, X extends unknown[], O> = 0 extends 1 ? never : X extends [infer H, ...infer T] ? $<$<F, Type._$cast<O, Kind._$inputOf<F>>>, Type._$cast<H, Kind._$inputOf<Function._$returnType<(F & {

*
* @param F - A type-level function for a pairwise operation.
* @param O - A type specifying the initial argument that will be taken by `F`.
* @template F - A type-level function for a pairwise operation.
* @template O - A type specifying the initial argument that will be taken by `F`.
* To use first element of `X` as the initial argument, simply pass in `Function.Identity`.
* @param X - A list of types. The target of the reduce operation.
* @template X - A list of types. The target of the reduce operation.
* @returns An unknown output type of `F`.
*

@@ -56,7 +54,3 @@ * @example

*
* ```ts
* import { $, List } from "hkt-toolbelt";
*
* type Sum1to10 = $<$<$<List.Reduce, NaturalNumber.Add>, 0>, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>; // 55
* ```
*

@@ -67,5 +61,2 @@ * @example

*
* ```ts
* import { $N, List } from "hkt-toolbelt";
*
* type IsTrue = $N<List.Reduce, [

@@ -76,3 +67,2 @@ * Boolean.Xor,

* ]>; // true
* ```
*

@@ -83,9 +73,5 @@ * @example

*
* ```ts
* import { $, $N, List, Number } from hkt-toolbelt;
*
* type GetMax = $N<List.Reduce, [Number.Max, Number.MIN_SAFE_INTEGER]>;
* type IsZero = $<GetMax, [-5, -4, -3, -2, -1, 0]; // 0
* type IsHundred = $<GetMax, [1, -1, 10, -10, 100, -100]>; // 100
* ```
*

@@ -96,5 +82,2 @@ * @example

*
* ```ts
* import { $, $N, List, Conditional, Number, String } from "hkt-toolbelt";
*
* type GetMinOrJoin = $N<Conditional.If, [

@@ -108,3 +91,2 @@ * $<Conditional.Extends, number[]>,

* type HelloWorld = $<GetMinOrJoin, ["hello", "world"]>; // "hello, world"
* ```
*/

@@ -111,0 +93,0 @@ export interface Reduce extends Kind.Kind {

@@ -12,15 +12,10 @@ import { Kind, Type, DigitList, Number, List, NaturalNumber } from '..';

*
* @param T - An unknown type.
* @param N - A natural number.
* @template T - An unknown type.
* @template N - A natural number.
* @returns A list of types containing `N` counts of `T`.
*
* If `N` is not a natural number, returns `never`.
*
* ## Basic Usage
*
* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type Result = List._$repeat<"a", 3>; // ["a", "a", "a"]
* ```
*
*/

@@ -31,2 +26,54 @@ export type _$repeat<T extends unknown, N extends Number.Number, RESULT extends List.List = Number._$isNatural<N> extends true ? _$repeat2<T, NaturalNumber._$toList<N>> : never> = RESULT;

}
/**
* `Repeat` is a type-level function that returns a tuple filled with multiple elements of a specified type.
*
* It takes in two arguments:
* `T`, the type to repeat, and `N`, the number of times to repeat `T`.
*
* `Repeat` can handle an output tuple length of up to 2137,
* which is larger than 999, the maximum recursion depth limit of TypeScript.
*
* @template T - An unknown type.
* @template N - A natural number.
* @returns A list of types containing `N` counts of `T`.
*
* If `N` is not a natural number, returns `never`.
*
* @example
* type Result = $<$<List.Repeat, "a">, 3>; // ["a", "a", "a"]
*
* @example
* By partially applying a type to `Repeat` using {@see {@link $}}
* we can define a type-level function that can repeat that type multiple different number of times.
*
* type RepeatA = $<List.Repeat, "A">
* type RepeatATwice = $<RepeatA, 2> // ["A", "A"]
* type RepeatAFiveTimes = $<RepeatA, 5> // ["A", "A", "A", "A", "A"]
*/
/**
* `Repeat` is a type-level function that returns a tuple filled with multiple elements of a specified type.
*
* It takes in two arguments:
* `T`, the type to repeat, and `N`, the number of times to repeat `T`.
*
* `Repeat` can handle an output tuple length of up to 2137,
* which is larger than 999, the maximum recursion depth limit of TypeScript.
*
* @template T - An unknown type.
* @template N - A natural number.
* @returns A list of types containing `N` counts of `T`.
*
* If `N` is not a natural number, returns `never`.
*
* @example
* type Result = $<$<List.Repeat, "a">, 3>; // ["a", "a", "a"]
*
* @example
* By partially applying a type to `Repeat` using {@see {@link $}}
* we can define a type-level function that can repeat that type multiple different number of times.
*
* type RepeatA = $<List.Repeat, "A">
* type RepeatATwice = $<RepeatA, 2> // ["A", "A"]
* type RepeatAFiveTimes = $<RepeatA, 5> // ["A", "A", "A", "A", "A"]
*/
export interface Repeat extends Kind.Kind {

@@ -33,0 +80,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Repeat_T<typeof x>;

@@ -5,4 +5,22 @@ import { Type, Kind } from '..';

infer Last
] ? Init extends [] ? [...O, Last] : _$reverse2<Init, [...O, Last]> : T extends [infer Head, ...unknown[]] ? Head : [...O, ...T];
] ? Init extends [] ? [...O, Last] : _$reverse2<Init, [...O, Last]> : T extends [infer Head, ...unknown[]] ? [Head] : [...O, ...T];
/**
* `_$reverse` is a type-level function that reverses a tuple.
*
* @template T - The tuple to reverse.
* @returns A list of types.
*
* @example
* type T0 = List._$reverse<[1, 2, 3]> // [3, 2, 1]
*/
export type _$reverse<T extends unknown[], O extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? _$reverse<Tail, [Head, ...O]> : T extends [] ? O : [..._$reverse2<T>, ...O];
/**
* `Reverse` is a type-level function that reverses a tuple.
*
* @template T - The tuple to reverse.
* @returns A list of types.
*
* @example
* type T0 = $<List.Reverse, [1, 2, 3]> // [3, 2, 1]
*/
export interface Reverse extends Kind.Kind {

@@ -9,0 +27,0 @@ f(x: Type._$cast<this[Kind._], unknown[]>): _$reverse<typeof x>;

import { Type, Kind, Number, NaturalNumber, DigitList, Digit, List } from '..';
type _$shiftN2<T extends unknown[], N extends DigitList.DigitList, RESULT extends List.List = T extends [unknown, ...infer Tail] ? N extends [Digit.Zero] ? T : _$shiftN2<Tail, DigitList._$decrement<N>> : []> = RESULT;
/**
* `_$shiftN` is a type-level function that shifts N elements from the head of an array.
*
* @template T - The array to shift elements from.
* @template N - The number of elements to shift.
* @returns A list of types.
*
* @example
* type T0 = List._$shiftN<['a', 'b', 'c'], 1> // ['b', 'c']
* type T1 = List._$shiftN<['a', 'b', 'c'], 2> // ['c']
*/
export type _$shiftN<T extends unknown[], N extends Number.Number, RESULT extends List.List = Number._$isNatural<N> extends true ? _$shiftN2<T, NaturalNumber._$toList<N>> : never> = RESULT;

@@ -7,2 +18,13 @@ interface ShiftN_T<N extends Number.Number> extends Kind.Kind {

}
/**
* `ShiftN` is a type-level function that shifts N elements from the head of an array.
*
* @template N - The number of elements to shift.
* @template T - The array to shift elements from.
* @returns A list of types.
*
* @example
* type T0 = $<$<List.ShiftN, 1>, ['a', 'b', 'c']> // ['b', 'c']
* type T1 = $<$<List.ShiftN, 2>, ['a', 'b', 'c']> // ['c']
*/
export interface ShiftN extends Kind.Kind {

@@ -9,0 +31,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): ShiftN_T<typeof x>;

import { Type, Kind } from '..';
/**
* `_$shift` is a type-level function that shifts one element from the head of a list.
*
* @template T - The list to remove the head from.
* @returns A list of types.
*
* @example
* type T0 = List._$shift<['a', 'b', 'c']> // ['b', 'c']
* type T1 = List._$shift<['b', 'c']> // ['c']
*/
export type _$shift<T extends unknown[]> = T extends [unknown, ...infer Tail] ? Tail : never;
/**
* `Shift` is a type-level function that shifts one element from the head of a list.
*
* @template T - The list to remove the head from.
* @returns A list of types.
*
* @example
* type T0 = $<List.Shift, ['a', 'b', 'c']> // ['b', 'c']
* type T1 = $<List.Shift, ['b', 'c']> // ['c']
*/
export interface Shift extends Kind.Kind {
f(x: Type._$cast<this[Kind._], unknown[]>): _$shift<typeof x>;
}

@@ -8,6 +8,8 @@ import { NaturalNumber, Number, DigitList, Digit, Kind, Type, List } from '..';

* Both positive and negative indices are supported, with negative indices being normalized into zero-based indices under the hood.
* ´´
* @param T - A tuple type.
* @param START - An integer type.
* @param END - An integer type.
*
* @template T - A tuple type.
* @template START - An integer type.
* @template END - An integer type.
* @returns A list of types.
*
* A negative index counts back from the end of the input tuple.

@@ -20,16 +22,10 @@ * If `START < 0`, `START + T["length"]` is used.

* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type MyList = ['a', 'b', 'c', 'd', 'e'];
*
* // Slice the first two elements of `MyList`.
* type Result1 = List._$slice<MyList, 0, 2>; // ['a', 'b']
*
* // Slice the last two elements of `MyList`.
* type Result2 = List._$slice<MyList, -2, 0>; // ['d', 'e']
*
* // Slice the middle three elements of `MyList`.
* type Result3 = List._$slice<MyList, 1, -1>; // ['b', 'c', 'd']
* ```
*

@@ -57,8 +53,9 @@ * ## Edge Cases

*
* @param START - An integer type.
* @param END - An integer type.
* @template START - An integer type.
* @template END - An integer type.
* A negative index counts back from the end of the input tuple.
* If `START < 0`, `START + T["length"]` is used.
* If `END < 0`, `END + T["length"]` is used.
* @param T - A tuple type.
* @template T - A tuple type.
* @returns A list of types.
*

@@ -70,16 +67,9 @@ * ## Basic Usage

* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type MyList = ['a', 'b', 'c', 'd', 'e'];
*
* // Slice the first two elements of `MyList`.
* type Result1 = $<$<$<List.Slice, 0>, 2>, MyList>; // ['a', 'b']
*
* // Slice the last two elements of `MyList`.
* type Result2 = $<$<$<List.Slice, -2>, 0>, MyList>; // ['d', 'e']
*
* // Slice the middle three elements of `MyList`.
* type Result3 = $<$<$<List.Slice, 1>, -1>, MyList>; // ['b', 'c', 'd']
* ```
*

@@ -86,0 +76,0 @@ * ## Edge Cases

import { $, Boolean, Type, Kind } from '..';
/**
* `_$some` is a type-level function that checks if some element in a tuple satisfies a predicate.
*
* @template F - The predicate function.
* @template T - The tuple to check.
* @returns A boolean.
*
* @example
* type T0 = List._$some<$<Conditional.Extends, number>, [1, 2, 3, 'x']> // true
* type T1 = List._$some<$<Conditional.Extends, number>, ['x', 'y', 'z']> // false
*/
export type _$some<F extends Kind.Kind<(x: never) => boolean>, T extends unknown[], O extends boolean = false> = 0 extends 1 ? never : T extends [infer Head, ...infer Rest] ? _$some<F, Rest, Boolean._$or<O, $<F, Type._$cast<Head, Kind._$inputOf<F>>>>> : O;

@@ -6,2 +17,13 @@ interface Some_T<T extends Kind.Kind<(x: never) => boolean>> extends Kind.Kind {

}
/**
* `Some` is a type-level function that checks if some element in a tuple satisfies a predicate.
*
* @template F - The predicate function.
* @template T - The tuple to check.
* @returns A boolean.
*
* @example
* type T0 = $<$<List.Some, $<Conditional.Extends, number>>, [1, 2, 3, 'x']> // true
* type T1 = $<$<List.Some, $<Conditional.Extends, number>>, ['x', 'y', 'z']> // false
*/
export interface Some extends Kind.Kind {

@@ -8,0 +30,0 @@ f(x: Type._$cast<this[Kind._], Kind.Kind<(x: never) => boolean>>): Some_T<typeof x>;

@@ -20,23 +20,15 @@ import { NaturalNumber, Number, DigitList, Digit, Kind, Type, List, Boolean } from '..';

*
* @param T - The input tuple.
* @param START - An integer representing the index at which to start splicing.
* @template T - The input tuple.
* @template START - An integer representing the index at which to start splicing.
* A negative index counts back from the end of the input tuple.
* If `START < 0`, `START + T["length"]` is used.
* @param DEL_COUNT - A natural number representing the number of elements to remove from T at the starting index.
* @param INSERTS - An array of elements to insert into T at the starting index.
* @template DEL_COUNT - A natural number representing the number of elements to remove from T at the starting index.
* @template INSERTS - An array of elements to insert into T at the starting index.
* @returns A list of types.
*
* ## Usage
*
* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type MyList = [0, 1, 2, 3, 4]
*
* type Result1 = List._$splice<[0, 1, 2, 3, 4], 1, 2, []>; // [0, 3, 4]
*
* type Result2 = List._$splice<[0, 1, 2, 3, 4], 1, 2, ['a', 'b']>; // [0, 'a', 'b', 3, 4]
*
* type Result3 = List._$splice<[0, 1, 2, 3, 4], -2, 2, ['a', 'b']>; // [0, 1, 'a', 'b', 4]
* ```
*

@@ -72,8 +64,9 @@ * ## Edge Cases

*
* @param T - The input tuple.
* @param START - An integer representing the index at which to start splicing.
* @template T - The input tuple.
* @template START - An integer representing the index at which to start splicing.
* A negative index counts back from the end of the input tuple.
* If `START < 0`, `START + T["length"]` is used.
* @param DEL_COUNT - A natural number representing the number of elements to remove from T at the starting index.
* @param INSERTS - An array of elements to insert into T at the starting index.
* @template DEL_COUNT - A natural number representing the number of elements to remove from T at the starting index.
* @template INSERTS - An array of elements to insert into T at the starting index.
* @returns A list of types.
*

@@ -83,13 +76,6 @@ * ## Usage

* @example
* ```ts
* import { $, List } from 'hkt-toolbelt';
*
* type MyList = [0, 1, 2, 3, 4]
*
* type Result1 = $<$<$<$<List.Splice, 1>, 2>, []>, [0, 1, 2, 3, 4]>; // [0, 3, 4]
*
* type Result2 = $<<$<$<$<List.Splice, 1>, 2>, ['a', 'b']>, [0, 1, 2, 3, 4]>; // [0, 'a', 'b', 3, 4]
*
* type Result3 = $<$<$<$<List.Splice, -2>, 2>, ['a', 'b']>, [0, 1, 2, 3, 4]>; // [0, 1, 'a', 'b', 4]
* ```
*

@@ -102,3 +88,2 @@ * ## Edge Cases

* If `START` is not an integer, or `DEL_COUNT` is not a natural number, returns never.
*
*/

@@ -105,0 +90,0 @@ export interface Splice extends Kind.Kind {

import { Kind, Type, DigitList, Number, List, NaturalNumber } from '..';
type _$times2<COUNTER extends DigitList.DigitList, STATE extends List.List = [], DEC extends DigitList.DigitList = DigitList._$decrement<COUNTER>, DEC_STR extends string = DigitList._$toString<DEC>, DEC_NUM extends Number.Number = Number._$fromString<DEC_STR>> = 0 extends 1 ? never : COUNTER extends ['0'] ? STATE : _$times2<DEC, [DEC_NUM, ...STATE]>;
/**
* `_$times` is a type-level function that generates a list of numbers from 0 to N-1.
*
* @template N - The length of the list to be generated.
* @returns A list of non-negative integer types.
*/
export type _$times<N extends Number.Number> = _$times2<NaturalNumber._$toList<N>>;
/**
* `Times` is a type-level function that generates a list of numbers from 0 to N-1.
*
* @template N - The length of the list to be generated.
* @returns A list of non-negative integer types.
*/
export interface Times extends Kind.Kind {

@@ -5,0 +17,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? _$times<typeof x> : never;

import { Type, Kind } from '..';
/**
* `_$unshift` is a type-level function that prepends an item to a list.
*
* @template X - The item to prepend.
* @template T - The list to prepend to.
* @returns A list of types.
*
* @example
* type T0 = List._$unshift<1, [2, 3, 4]> // [1, 2, 3, 4]
*/
export type _$unshift<X, T extends unknown[]> = [X, ...T];

@@ -6,2 +16,12 @@ interface Unshift_T<X> extends Kind.Kind {

}
/**
* `List.Unshift` is a type-level function that prepends an item to a list.
*
* @template X - The item to prepend.
* @template T - The list to prepend to.
* @returns A list of types.
*
* @example
* type T0 = $<$<List.Unshift, 1>, [2, 3, 4]> // [1, 2, 3, 4]
*/
export interface Unshift extends Kind.Kind {

@@ -8,0 +28,0 @@ f(x: this[Kind._]): Unshift_T<typeof x>;

@@ -10,3 +10,4 @@ import { $, Kind, List, Number, NaturalNumber } from '..';

*
* @param T - An array of types.
* @template T - An array of types.
* @returns A nested list of types.
*

@@ -18,7 +19,3 @@ * @example

*
* ```ts
* import { List } from "hkt-toolbelt";
*
* type Result = List._$zip<[[1, 2, 3], ["a", "b", "c"]]> // [[1, "a"], [2, "b"], [3, "c"]]
* ```
*

@@ -31,7 +28,3 @@ * @example

*
* ```ts
* import { List } from "hkt-toolbelt";
*
* type Result = List._$zip<[[1, 2], ["a", "b", "c"], ["A", "B"]]> // [[1, "a", "A"], [2, "b", "B"]]
* ```
*/

@@ -46,3 +39,4 @@ export type _$zip<T extends List.List, IDX extends Number.Number = 0, ACC extends List.List = [], LENGTHS extends Number.Number[] = List._$map<List.Length, T>, MIN_LENGTH extends Number.Number = List._$reduce<Number.Min, LENGTHS, Number.MAX_SAFE_INTEGER>, CURR = List._$map<$<List.At, IDX>, T>, RESULT extends List.List = MIN_LENGTH extends Number.MAX_SAFE_INTEGER ? [] : IDX extends MIN_LENGTH ? ACC : _$zip<T, NaturalNumber._$increment<IDX>, List._$push<CURR, ACC>>> = RESULT;

*
* @param T - An array of arrays.
* @template T - An array of arrays.
* @returns A nested list of types.
*

@@ -53,8 +47,3 @@ * @example

*
* ```ts
* import { $, List } from "hkt-toolbelt";
import { MAX_SAFE_INTEGER } from '../number/number';
*
* $<List.Zip, [[1, 2], ["a", "b", "c"], ["A", "B"]]>; // [[1, "a", "A"], [2, "b", "B"]]
* ```
* type Result = $<List.Zip, [[1, 2], ["a", "b", "c"], ["A", "B"]]>; // [[1, "a", "A"], [2, "b", "B"]]
*/

@@ -61,0 +50,0 @@ export interface Zip extends Kind.Kind {

@@ -7,4 +7,4 @@ import { $, $N, Kind, NaturalNumber, Conditional, List, Function } from '..';

*
* @param M - The number to divide by.
* @param N - The number to check divisibility for.
* @template M - The number to divide by.
* @template N - The number to check divisibility for.
*

@@ -33,3 +33,3 @@ * This function 'lifts' the modulo parameters (M and N) out of the pipe via

*
* @param N - The number to compute the FizzBuzz result for.
* @template N - The number to compute the FizzBuzz result for.
*

@@ -61,3 +61,3 @@ * @example

*
* @param N - The number of FizzBuzz results to compute.
* @template N - The number of FizzBuzz results to compute.
*

@@ -64,0 +64,0 @@ * @example

import { Type, Number, Kind, DigitList, NaturalNumber } from '..';
/**
* `_$add` is a type-level function that takes in two natural numbers `A` and `B`,
* and returns the sum of the two natural numbers.
*
* @template {Number.Number} A - A natural number to be added to.
* @template {Number.Number} B - A natural number to be added.
* @returns {Number.Number} A natural number.
*
* @example
* For example, we can use `_$add` to add the two natural numbers 123 and 456:
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt"
*
* type Result = NaturalNumber._$add<123, 456> // 579
* ```
*/
export type _$add<A extends Number.Number, B extends Number.Number, A_LIST extends DigitList.DigitList = NaturalNumber._$toList<A>, B_LIST extends DigitList.DigitList = NaturalNumber._$toList<B>, SUM_LIST extends DigitList.DigitList = DigitList._$add<A_LIST, B_LIST>, SUM = DigitList._$toNumber<SUM_LIST>> = SUM;

@@ -6,2 +23,33 @@ interface Add_T<A extends Number.Number> extends Kind.Kind {

}
/**
* `Add` is a type-level function that takes in two natural numbers `A` and `B`,
* and returns the sum of the two natural numbers.
*
* @template {Number.Number} A - A natural number to be added to.
* @template {Number.Number} B - A natural number to be added.
* @returns {Number.Number} A natural number or `never`.
*
* If one or more of the inputs is not zero or a natural number, an error is emitted.
*
* @example
* For example, we can use `Add` to add the two natural numbers 123 and 456:
*
* We apply `Add` to 123 and 456 respectively using
* the `$` type-level applicator:
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt"
*
* type Result = $<$<NaturalNumber.Add, 123>, 456> // 579
* ```
*
* @example
* If one of the inputs is not a natural number, `never` is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsNever = $<NaturalNumber.Add, -42.42>; // never
* ```
*/
export interface Add extends Kind.Kind {

@@ -8,0 +56,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? Add_T<typeof x> : never;

@@ -8,5 +8,7 @@ import { Type, Number, Kind, DigitList, NaturalNumber } from '..';

*
* @param A - A natural number type.
* @param B - A natural number type.
* @template {Number.Number} A - A natural number to compare against.
* @template {Number.Number} B - A natural number to compare.
*
* @returns {-1 | 0 | 1}
*
* @example

@@ -43,5 +45,7 @@ * For example, we can use `_$compare` to compare two natural numbers.

*
* @param A - A natural number type.
* @param B - A natural number type.
* @template {Number.Number} A - A natural number to compare against.
* @template {Number.Number} B - A natural number to compare.
*
* @returns {-1 | 0 | 1}
*
* @example

@@ -48,0 +52,0 @@ * For example, we can use `Compare` to compare two natural numbers.

import { Type, Kind, DigitList, NaturalNumber, Number } from '..';
/**
* `_$decrement` is a type-level function that takes in a natural number `A` and
* returns a new natural number representing the result of decrementing the input
* natural number by 1. If the input is zero, the result will be zero.
*
* @template {Number.Number} A - A natural number to decrement.
* @returns {Number.Number} A natural number.
*
* @example
* For example, we can use `_$decrement` to decrement the number 42 by 1.
* In this example, the 42 is passed as a type argument to the type-level function:
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type Result = NaturalNumber._$decrement<42>; // 41
* ```
*
* @example
* We can also use `_$decrement` with zero as the input.
* In this case, the output will also be zero.
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type Result = NaturalNumber._$decrement<0>; // 0
* ```
*/
export type _$decrement<A extends Number.Number, A_LIST extends DigitList.DigitList = NaturalNumber._$toList<A>, DECREMENT extends DigitList.DigitList = DigitList._$decrement<A_LIST>, RESULT extends Number.Number = Number._$fromString<DigitList._$toString<DECREMENT>>> = RESULT;
/**
* `Decrement` is a type-level function that decrements a natural number type.
* It returns the decremented number.
*
* @template {Number.Number} A - The natural number to decrement.
* @returns {Number.Number} A natural number or `never`.
*
* If the input is not zero or a natural number, `never` is returned.
*
* @example
* For example, we can use `Decrement` to decrement a natural number:
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type Result = $<NaturalNumber.Decrement, 1>; // 0
* ```
*
* @example
* We can also use `Decrement` with zero as the input.
* In this case, the output will also be zero.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type Result = $<NaturalNumber.Decrement, 0>; // 0
* ```
*
* @example
* If one of the inputs is not a natural number, `never` is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsNever = $<NaturalNumber.Decrement, -42.42>; // never
* ```
*/
export interface Decrement extends Kind.Kind {
f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? _$decrement<typeof x> : never;
}

@@ -5,2 +5,35 @@ import { Type, Number, Kind, NaturalNumber } from '..';

}
/**
* `DivideBy` is a type-level function that takes in two natural number types,
* `A` and `B`, and returns the result of dividing `B` by `A`.
*
* @template {Number.Number} A - A natural number to divide by.
* @template {Number.Number} B - A natural number to be divided.
* @returns {Number.Number} A natural number type or `never`.
*
* The parameters are reversed from `Divide`. This is useful for partial
* application, i.e. to test divisibility.
*
* @example
* For example, we can apply `DivideBy` to the type argument 3 using the `$` type-level applicator,
* and evaluate the results of dividing multiple natural numbers by 3.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type DivideByThree = $<NaturalNumber.DivideBy, 3>;
*
* type Result1 = $<DivideByThree, 3>; // 1
* type Result2 = $<DivideByThree, 7>; // 2
* ```
*
* @example
* If one of the inputs is not a natural number, `never` is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsNever = $<NaturalNumber.DivideBy, -42.42>; // never
* ```
*/
export interface DivideBy extends Kind.Kind {

@@ -7,0 +40,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? DivideBy_T<typeof x> : never;

import { Type, Number, Kind, DigitList, NaturalNumber } from '..';
export type _$divide<A extends Number.Number, B extends Number.Number, A_LIST extends DigitList.DigitList = NaturalNumber._$toList<A>, B_LIST extends DigitList.DigitList = NaturalNumber._$toList<B>, QUOTIENT_LIST extends DigitList.DigitList = DigitList._$divide<A_LIST, B_LIST>, QUOTIENT = DigitList._$toNumber<QUOTIENT_LIST>> = QUOTIENT;
/**
* `_$divide` is a type-level function that performs the division operation.
* It takes in two natural numbers `A` and `B` representing the dividend and divisor respectively,
* and returns the result of dividing `A` by `B`.
*
* @template {Number.Number} A - A natural number to divide.
* @template {Number.Number} B - A natural number to divide by.
* @returns {Number.Number} A natural number type.
*
* If `A` is not a multiple of `B`, the quotient is returned and the remainder is thrown away.
*
* @example
* For example, we can use `_$divide` to divide 10 by 2:
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type Result = NaturalNumber._$divide<10, 2>; // 5
* ```
*
* @example
* If `A` is not a multiple of `B`, only the quotient is returned.
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type Result = NaturalNumber._$divide<100, 99>; // 1
* ```
*/
export type _$divide<A extends Number.Number, B extends Number.Number, A_LIST extends DigitList.DigitList = NaturalNumber._$toList<A>, B_LIST extends DigitList.DigitList = NaturalNumber._$toList<B>, QUOTIENT_LIST = DigitList._$divide<A_LIST, B_LIST>, QUOTIENT = DigitList._$toNumber<QUOTIENT_LIST extends DigitList.DigitList ? QUOTIENT_LIST : never>> = QUOTIENT;
interface Divide_T<A extends Number.Number> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? _$divide<A, typeof x> : never;
}
/**
* `Divide` is a type-level function that takes in two natural numbers and performs a division operation.
* It returns the result of the division operation.
*
* @template {Number.Number} A - A natural number to divide.
* @template {Number.Number} B - A natural number to divide by.
* @returns {Number.Number} A natural number type.
*
* If `A` is not a multiple of `B`, the quotient is returned and the remainder is thrown away.
*
* If either input is not a natural number, `never` is returned.
*
* @example
* For example, we can use `Divide` to create a division operation that divides 10 by 2:
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type Result = $<$<NaturalNumber.Divide, 10>, 2>; // 5
* ```
*
* @example
* If `A` is not a multiple of `B`, only the quotient is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type Result = $<$<NaturalNumber.Divide, 100>, 99>; // 1
* ```
*
* @example
* If one of the inputs is not a natural number, `never` is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsNever = $<NaturalNumber.Divide, -42.42>; // never
* ```
*/
export interface Divide extends Kind.Kind {

@@ -7,0 +75,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? Divide_T<typeof x> : never;

import { Type, Kind, DigitList, NaturalNumber, Number } from '..';
/**
* `_$increment` is a type-level function that takes in a natural number `A` and
* returns a new natural number representing the result of incrementing the input
* natural number by 1. If the input is zero, the result will be zero.
*
* @template {Number.Number} A - A natural number to increment.
* @returns {Number.Number} A natural number.
*
* @example
* For example, we can use `_$increment` to increment the number 42 by 1.
* In this example, the 42 is passed as a type argument to the type-level function:
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type Result = NaturalNumber._$increment<42>; // 43
* ```
*
* @example
* We can also use `_$increment` with zero as the input.
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type Result = NaturalNumber._$increment<0>; // 1
* ```
*/
export type _$increment<A extends Number.Number, A_LIST extends DigitList.DigitList = NaturalNumber._$toList<A>, INCREMENT extends DigitList.DigitList = DigitList._$increment<A_LIST>, RESULT extends Number.Number = Number._$fromString<DigitList._$toString<INCREMENT>>> = RESULT;
/**
* `Increment` is a type-level function that increments a natural number type.
* It returns the incremented natural number.
*
* @template {Number.Number} A - A natural number to increment.
* @returns {Number.Number} A natural number or `never`.
*
* If the input is not zero or a natural number, `never` is returned.
*
* @example
* For example, we can use `Increment` to increment a natural number:
*
* ```ts
* import { $, NaturalNumber, Type } from "hkt-toolbelt";
*
* type Result = $<NaturalNumber.Increment, 10>; // 11
* ```
*
* @example
* If the input is not a natural number, `never` is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsNever = $<NaturalNumber.Increment, -42.42>; // never
* ```
*/
export interface Increment extends Kind.Kind {
f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? _$increment<typeof x> : never;
}

@@ -8,3 +8,6 @@ export * from './add';

export * from './is-even';
export * from './is-greater-than';
export * from './is-greater-than-or-equal';
export * from './is-less-than';
export * from './is-less-than-or-equal';
export * from './is-odd';

@@ -11,0 +14,0 @@ export * from './modulo-by';

import { Type, Kind, Number, NaturalNumber, DigitList } from '..';
/**
* `_$isEven` is a type-level function that takes in a natural number type,
* `A`, and returns a boolean indicating whether `A` is an even number
*
* @template {Number.Number} A - A natural number.
* @returns {boolean}
*/
export type _$isEven<T extends Number.Number, LIST extends DigitList.DigitList = NaturalNumber._$toList<T>, RESULT = DigitList._$isEven<LIST>> = RESULT;
/**
* `IsEven` is a type-level function that takes in a natural number type,
* `A`, and returns a boolean indicating whether `A` is an even number
*
* @template {Number.Number} A - A natural number.
* @returns {boolean}
*/
export interface IsEven extends Kind.Kind {
f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? _$isEven<typeof x> : never;
}

@@ -10,4 +10,5 @@ import { Number, NaturalNumber, Kind, Type } from '..';

*
* @param A - The number to compare against.
* @param B - The number to compare.
* @template {Number.Numer} A - A natural number to compare against.
* @template {Number.Numer} B - A natural number to compare.
* @returns {boolean}
*/

@@ -35,4 +36,5 @@ export type _$isLessThan<

*
* @param A - The number to compare against.
* @param B - The number to evaluate.
* @template {Number.Number} A - A natural number to compare against.
* @template {Number.Number} B - A natural number to compare.
* @returns {boolean}
*

@@ -43,4 +45,2 @@ * The parameters are ordered such that `IsLessThan` can be partially applied

*
* ## Usage Examples
*
* @example

@@ -47,0 +47,0 @@ * For example, we can use `IsLessThan` to determine whether a natural number is

import { Type, Kind, DigitList, Number, NaturalNumber } from '..';
/**
* `_$isOdd` is a type-level function that takes in a natural number type,
* `A`, and returns a boolean indicating whether `A` is an odd number
*
* @template {Number.Number} A - A natural number.
* @returns {boolean}
*/
export type _$isOdd<T extends Number.Number, LIST extends DigitList.DigitList = NaturalNumber._$toList<T>, RESULT = DigitList._$isOdd<LIST>> = RESULT;
/**
* `IsOdd` is a type-level function that takes in a natural number type,
* `A`, and returns a boolean indicating whether `A` is an odd number
*
* @template {Number.Number} A - A natural number.
* @returns {boolean}
*/
export interface IsOdd extends Kind.Kind {
f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? _$isOdd<typeof x> : never;
}

@@ -6,4 +6,4 @@ import { NaturalNumber, Type, Number, Kind } from '..';

*
* @param A - The number to divide by to calculate the remainder.
* @param B - The numerator.
* @template A - The number to divide by to calculate the remainder.
* @template B - The numerator.
*

@@ -29,4 +29,4 @@ * The parameters are reversed from `_$modulo`. This is useful for partial

*
* @param A - The number to divide by to calculate the remainder.
* @param B - The numerator.
* @template A - The number to divide by to calculate the remainder.
* @template B - The numerator.
*

@@ -33,0 +33,0 @@ * The parameters are reversed from `Modulo`. This is useful for partial

@@ -6,4 +6,4 @@ import { Type, Number, Kind, DigitList, NaturalNumber } from '..';

*
* @param A - The number to divide.
* @param B - The number to divide by.
* @template A - The number to divide.
* @template B - The number to divide by.
*/

@@ -18,4 +18,4 @@ export type _$modulo<A extends Number.Number, B extends Number.Number, A_LIST extends DigitList.DigitList = NaturalNumber._$toList<A>, B_LIST extends DigitList.DigitList = NaturalNumber._$toList<B>, MODULUS_LIST extends DigitList.DigitList = DigitList._$modulo<A_LIST, B_LIST>, MODULUS = DigitList._$toNumber<MODULUS_LIST>> = MODULUS;

*
* @param A - The number to divide.
* @param B - The number to divide by.
* @template A - The number to divide.
* @template B - The number to divide by.
*

@@ -22,0 +22,0 @@ * ## Usage Examples

import { Type, Number, Kind, DigitList, NaturalNumber } from '..';
/**
* `_$multiply` is a type-level function that multiplies a natural number by another natural number.
* It returns the result of the multiplication operation.
*
* @template {Number.Number} A - A natural number to multiply.
* @template {Number.Number} B - A natural number to multiply by.
* @returns {Number.Number} A natural number.
*
* @example
* For example, we can use `_$multiply` to multiply a natural number 42 by another natural number 12:
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type Is504 = NaturalNumber._$multiply<42, 12>; // 504
* ```
*
* @example
* If one of the inputs is zero, the result will be zero.
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type IsZero = NaturalNumber._$multiply<42, 0>; // 0
* ```
*/
export type _$multiply<A extends Number.Number, B extends Number.Number, A_LIST extends DigitList.DigitList = NaturalNumber._$toList<A>, B_LIST extends DigitList.DigitList = NaturalNumber._$toList<B>, PRODUCT_LIST extends DigitList.DigitList = DigitList._$multiply<A_LIST, B_LIST>, PRODUCT = DigitList._$toNumber<PRODUCT_LIST>> = PRODUCT;

@@ -6,2 +32,39 @@ interface Multiply_T<A extends Number.Number> extends Kind.Kind {

}
/**
* `Multiply` is a type-level function that multiplies a natural number by another natural number.
* It returns the result of the multiplication operation.
*
* @template {Number.Number} A - A natural number to multiply.
* @template {Number.Number} B - A natural number to multiply by.
* @returns {Number.Number} A natural number or `never`.
*
* If one or more of the inputs is not zero or a natural number, an error is emitted.
*
* @example
* For example, we can use `Multiply` to multiply a natural number 42 by another natural number 12:
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type Is504 = $<$<NaturalNumber.Multiply, 12>, 42>; // 504
* ```
*
* @example
* If one of the inputs is zero, the result will be zero.
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type IsZero = $<$<NaturalNumber.Multiply, 0>, 42>; // 0
* ```
*
* @example
* If one of the inputs is not a natural number, `never` is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsNever = $<NaturalNumber.Multiply, -42.42>; // never
* ```
*/
export interface Multiply extends Kind.Kind {

@@ -8,0 +71,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? Multiply_T<typeof x> : never;

@@ -5,2 +5,35 @@ import { Type, Number, Kind, NaturalNumber } from '..';

}
/**
* `SubtractBy` is a type-level function that takes in two natural number types,
* `A` and `B`, and returns the result of subtracting `A` from `B`.
*
* @template {Number.Number} A - A natural number to subtract by.
* @template {Number.Number} B - A natural number to be subtracted from.
* @returns {Number.Number} A natural number type or `never`.
*
* The parameters are reversed from `Subtract`. This is useful for partial
* application, i.e. to test divisibility.
*
* @example
* For example, we can apply `SubtractBy` to the type argument 3 using the `$` type-level applicator,
* and evaluate the results of subtracting multiple natural numbers by 3.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type SubtractByThree = $<NaturalNumber.SubtractBy, 3>;
*
* type Result1 = $<SubtractByThree, 3>; // 0
* type Result2 = $<SubtractByThree, 7>; // 4
* ```
*
* @example
* If one of the inputs is not a natural number, `never` is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsNever = $<NaturalNumber.SubtractBy, -42.42>; // never
* ```
*/
export interface SubtractBy extends Kind.Kind {

@@ -7,0 +40,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? SubtractBy_T<typeof x> : never;

import { Number, NaturalNumber, DigitList, Type, Kind } from '..';
/**
* `_$subtract` is a type-level function that subtracts one natural number from
* another. It returns the result of the subtraction.
*
* @template {Number.Number} A - A natural number to subtract.
* @template {Number.Number} B - A natural number to subtract by.
* @returns {Number.Number} A natural number.
*
* @example
* For example, we can use `_$subtract` to subtract one natural number from another:
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type Result = NaturalNumber._$subtract<125, 121>; // 4
* ```
*
* @example
* If `B` is larger than `A`, zero is returned.
*
* ```ts
* import { NaturalNumber } from "hkt-toolbelt";
*
* type IsZero = NaturalNumber._$subtract<121, 125>; // 0
* ```
*/
export type _$subtract<A extends Number.Number, B extends Number.Number, A_LIST extends DigitList.DigitList = NaturalNumber._$toList<A>, B_LIST extends DigitList.DigitList = NaturalNumber._$toList<B>, SUB_LIST extends DigitList.DigitList = DigitList._$subtract<A_LIST, B_LIST>, RESULT = DigitList._$toNumber<SUB_LIST>> = RESULT;

@@ -6,2 +32,37 @@ interface Subtract_T<X extends Number.Number> extends Kind.Kind {

}
/**
* `Subtract` is a type-level function that subtracts one natural number from
* another. It returns the result of the subtraction.
*
* @template {Number.Number} A - A natural number to subtract.
* @template {Number.Number} B - A natural number to subtract by.
* @returns {Number.Number} A natural number or `never`.
*
* @example
* For example, we can use `Subtract` to subtract one natural number from another:
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type Result = $<$<NaturalNumber.Subtract, 50>, 25>; // 25
* ```
*
* @example
* If `B` is larger than `A`, zero is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsZero = $<$<NaturalNumber.Subtract, 25>, 50>; // 0
* ```
*
* @example
* If one of the inputs is not a natural number, `never` is returned.
*
* ```ts
* import { $, NaturalNumber } from "hkt-toolbelt";
*
* type IsNever = $<NaturalNumber.Subtract, -42.42>; // never
* ```
*/
export interface Subtract extends Kind.Kind {

@@ -8,0 +69,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Number._$isNatural<typeof x> extends true ? Subtract_T<typeof x> : never;

@@ -7,3 +7,3 @@ import { Number, Type, Kind } from '..';

*
* @param T - A number type.
* @template T - A number type.
*

@@ -18,3 +18,3 @@ * @example

*/
export type _$absolute<T extends Number.Number> = `${T}` extends `-${infer U extends number}` ? U : T;
export type _$absolute<T extends Number.Number> = `${T}` extends `-${infer U extends number | bigint}` ? U : T;
/**

@@ -25,3 +25,3 @@ * `Absolute` is a type-level function that takes a number type `T`, and returns its absolute value.

*
* @param T - A number type.
* @template T - A number type.
*

@@ -28,0 +28,0 @@ * @example

@@ -93,4 +93,4 @@ import { Type, Number, Kind, Digit, DigitList, NaturalNumber } from '..';

*
* @param A - A number type.
* @param B - A number type.
* @template A - A number type.
* @template B - A number type.
*

@@ -127,4 +127,4 @@ * @example

*
* @param A - A number type.
* @param B - A number type.
* @template A - A number type.
* @template B - A number type.
*

@@ -131,0 +131,0 @@ * @example

@@ -5,3 +5,7 @@ export * from './absolute';

export * from './is-fractional';
export * from './is-greater-than';
export * from './is-greater-than-or-equal';
export * from './is-integer';
export * from './is-less-than';
export * from './is-less-than-or-equal';
export * from './is-natural';

@@ -8,0 +12,0 @@ export * from './negate';

@@ -7,3 +7,3 @@ import { Number, Type, Kind } from '..';

*
* @param T - A number type.
* @template T - A number type.
*

@@ -18,3 +18,3 @@ * @example

*/
export type _$negate<T extends Number.Number, RESULT extends Number.Number = T extends 0 ? 0 : `${T}` extends `-${infer U extends number}` ? U : Number._$fromString<`-${T}`>> = RESULT;
export type _$negate<T, RESULT = T extends 0 ? 0 : `${T & Number.Number}` extends `-${infer U extends number}` ? U : Number._$fromString<`-${T & Number.Number}`>> = RESULT;
/**

@@ -25,3 +25,3 @@ * `Negate` is a type-level function that takes a number type `T`, and returns its absolute value.

*
* @param T - A number type.
* @template T - A number type.
*

@@ -28,0 +28,0 @@ * @example

@@ -1,4 +0,3 @@

import { Kind, Type } from '..';
import { _$keys } from './keys';
export type _$values<T extends Record<string, unknown>, Keys = _$keys<T>> = {
import { Kind, Type, Object } from '..';
export type _$values<T extends Record<string, unknown>, Keys = Object._$keys<T>> = {
[key in keyof Keys]: T[Type._$cast<Keys[key], keyof T>];

@@ -5,0 +4,0 @@ };

{
"name": "hkt-toolbelt",
"version": "0.22.2",
"version": "0.23.0",
"description": "Functional and composable type utilities",

@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts",

export * from './hundred-number-list';
export * from './hundred-string';
export * from './hundred-tuple';
export * from './hundred-boolean-list';
export * from './ten-number-list';

@@ -10,1 +11,3 @@ export * from './ten-string';

export * from './thousand-tuple';
export * from './thousand-boolean-list';
export * from './ten-boolean';
import { Type, Kind } from '..';
/**
* `String._$append` is a type-level function that appends a suffix to a string.
*
* @template Suffix - The string to append.
* @template S - The original string.
*
* @example
* type T0 = String._$append<'bar', 'foo'> // 'foobar'
* type T1 = String._$append<'', 'foo'> // 'foo'
*/
export type _$append<Suffix extends string, S extends string> = `${S}${Suffix}`;

@@ -6,2 +16,12 @@ interface Append_T<Suffix extends string> extends Kind.Kind {

}
/**
* `String.Append` is a type-level function that appends a suffix to a string.
*
* @template Suffix - The string to append.
* @template S - The original string.
*
* @example
* type T0 = $<$<String.Append, 'bar'>, 'foo'> // 'foobar'
* type T1 = $<$<String.Append, ''>, 'foo'> // 'foo'
*/
export interface Append extends Kind.Kind {

@@ -8,0 +28,0 @@ f(x: Type._$cast<this[Kind._], string>): Append_T<typeof x>;

import { Kind, Type } from '..';
/**
* `String._$capitalize` is a type-level function that capitalizes the first character of a string.
*
* @template S - The string to capitalize.
*
* @example
* type T0 = String._$capitalize<'hello'> // 'Hello'
* type T1 = String._$capitalize<'Hello'> // 'Hello'
* type T2 = String._$capitalize<''> // ''
*/
export type _$capitalize<S extends string> = Capitalize<S>;
/**
* `String.Capitalize` is a type-level function that capitalizes the first character of a string.
*
* @template S - The string to capitalize.
*
* @example
* type T0 = $<String.Capitalize, 'hello'> // 'Hello'
* type T1 = $<String.Capitalize, 'Hello'> // 'Hello'
* type T2 = $<String.Capitalize, ''> // ''
*/
interface _Capitalize extends Kind.Kind {

@@ -4,0 +24,0 @@ f(x: Type._$cast<this[Kind._], string>): _$capitalize<typeof x>;

import { Type, Kind } from '..';
/**
* `String.EndsWith` is a type-level function that checks if a string ends with a given suffix.
*
* @template Suffix - The suffix to check for.
* @template S - The string to check.
*
* @example
* type T0 = String._$endsWith<'bar', 'foobar'> // true
* type T1 = String._$endsWith<'foo', 'foobar'> // false
*/
export type _$endsWith<Suffix extends string, S extends string> = S extends `${string}${Suffix}` ? true : false;

@@ -6,2 +16,12 @@ interface EndsWith_T<T extends string> extends Kind.Kind {

}
/**
* `String.EndsWith` is a type-level function that checks if a string ends with a given suffix.
*
* @template Suffix - The suffix to check for.
* @template S - The string to check.
*
* @example
* type T0 = $<$<String.EndsWith, 'bar'>, 'foobar'> // true
* type T1 = $<$<String.EndsWith, 'foo'>, 'foobar'> // false
*/
export interface EndsWith extends Kind.Kind {

@@ -8,0 +28,0 @@ f(x: Type._$cast<this[Kind._], string>): EndsWith_T<typeof x>;

import { Type, Kind } from '..';
/**
* `String.First` is a type-level function that extracts the first character from a string.
*
* @template S - The string to extract the first character from.
*
* @example
* type T0 = String._$first<'hello'> // 'h'
* type T1 = String._$first<''> // ''
*/
export type _$first<S extends string> = S extends `${infer Head}${string}` ? Head : string extends S ? S : '';
/**
* `String.First` is a type-level function that extracts the first character from a string.
* @template S - The string to extract the first character from.
*
* @example
* type T0 = $<String.First, 'hello'> // 'h'
* type T1 = $<String.First, ''> // ''
*/
export interface First extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$first<typeof x>;
}
import { Type, Kind } from '..';
/**
* `String.FromList` is a type-level function that joins a list of strings into a single string.
*
* @template T - The list of strings to join.
* @template O - The output string, initially empty.
*
* @example
* type T0 = String._$fromList<['hello', ' ', 'world']> // 'hello world'
* type T1 = String._$fromList<[]> // ''
*/
export type _$fromList<T, O extends string = ''> = 0 extends 1 ? never : T extends [infer Head, ...infer Tail] ? _$fromList<Tail, `${O}${Type._$cast<Head, string>}`> : O;
/**
* `String.FromList` is a type-level function that joins a list of strings into a single string.
*
* @example
* type T0 = $<String.FromList, ['hello', ' ', 'world']> // 'hello world'
* type T1 = $<String.FromList, []> // ''
*/
export interface FromList extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string[]>): _$fromList<typeof x>;
}

@@ -1,6 +0,31 @@

import { Type, Kind } from '..';
import { Kind, Type } from '..';
/**
* `String._$includes` is a type-level function that checks if a string includes a given infix.
*
* @template Infix - The infix to check for.
* @template S - The string to check.
*
* @example
* type T0 = String._$includes<'oba', 'foobar'> // true
* type T1 = String._$includes<'qux', 'foobar'> // false
*/
export type _$includes<Infix extends string, S extends string> = S extends `${string}${Infix}${string}` ? true : false;
/**
* `String.Includes_T` is an intermediate interface for currying.
*
* @template Infix - The infix to check for.
*/
interface Includes_T<Infix extends string> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$includes<Infix, typeof x>;
}
/**
* `String.Includes` is a type-level function that checks if a string includes a given infix.
*
* @template Infix - The infix to check for.
* @template S - The string to check.
*
* @example
* type T0 = $<$<String.Includes, 'oba'>, 'foobar'> // true
* type T1 = $<$<String.Includes, 'qux'>, 'foobar'> // false
*/
export interface Includes extends Kind.Kind {

@@ -7,0 +32,0 @@ f(x: Type._$cast<this[Kind._], string>): Includes_T<typeof x>;

import { Type, Kind } from '..';
type _$init2<S extends string, O extends string = ''> = S extends `${infer Head}${infer Tail}` ? Tail extends '' ? O : _$init2<Tail, `${O}${Head}`> : O;
/**
* `String._$init` is a type-level function that extracts every element before the last element of a string.
*
* @template S - The string to extract the init from.
*
* @example
* type T0 = String._$init<'foo'> // 'fo'
* type T1 = String._$init<''> // ''
*/
export type _$init<S extends string> = string extends S ? string : _$init2<S>;
/**
* `String.Init` is a type-level function that extracts every element before the last element of a string.
*
* @template S - The string to extract the init from.
*
* @example
* type T0 = $<String.Init, 'foo'> // 'fo'
* type T1 = $<String.Init, ''> // ''
*/
export interface Init extends Kind.Kind {

@@ -5,0 +23,0 @@ f(x: Type._$cast<this[Kind._], string>): _$init<typeof x>;

import { Kind } from '..';
/**
* `String._$isString` is a type-level function that checks if a type is a string.
*
* @template S - The type to check.
*
* @example
* type T0 = String._$isString<'hello'> // true
* type T1 = String._$isString<123> // false
*/
export type _$isString<S extends unknown> = S extends string ? true : false;
/**
* `String.IsString` is a type-level function that checks if a type is a string.
*
* @template S - The type to check.
*
* @example
* type T0 = $<String.IsString, 'hello'> // true
* type T1 = $<String.IsString, 123> // false
*/
export interface IsString extends Kind.Kind {
f(x: this[Kind._]): _$isString<typeof x>;
}
import { $, Type, Conditional, Kind, List, String } from '..';
/**
* `String._$isTemplate` is a type-level function that checks if a string is a template literal string.
* A template literal string is a string that includes embedded expressions, which will be evaluated and then converted into a resulting string.
*
* @template S - The string to check.
*
* @example
* type T0 = String._$isTemplate<`foo${string}`> // true
* type T1 = String._$isTemplate<string> // false
*/
export type _$isTemplate<S extends string> = string extends S ? false : List._$some<$<Conditional.Equals, string>, String._$toList<S>>;
/**
* `String.IsTemplate` is a type-level function that checks if a string is a template literal string.
* A template literal string is a string that includes embedded expressions, which will be evaluated and then converted into a resulting string.
*
* @template S - The string to check.
*
* @example
* type T0 = $<String.IsTemplate, `foo${string}`> // true
* type T1 = $<String.IsTemplate, string> // false
*/
export interface IsTemplate extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$isTemplate<typeof x>;
}
import { Type, Kind, List } from '..';
/**
* `String._$join` is a type-level function that joins an array of strings into a single string.
*
* @template T - The array of strings to join.
* @template D - The delimiter to use when joining the strings.
* @template O - The output string.
*
* @example
* type T0 = String._$join<['foo', 'bar'], '-', ''> // 'foo-bar'
* type T1 = String._$join<['foo', 'bar'], '', ''> // 'foobar'
*/
export type _$join<T extends (string | unknown)[], D extends string = '', O extends string = ''> = List._$isVariadic<T> extends true ? string : T extends [infer Head, ...infer Tail] ? Tail extends [] ? `${O}${O extends '' ? '' : D}${Type._$cast<Head, string>}` : _$join<Type._$cast<Tail, string[]>, D, `${O}${O extends '' ? '' : D}${Type._$cast<Head, string>}`> : string[] extends T ? `${O}${string}` : O;
/**
* `String.Join_T` is an intermediate interface for currying.
*
* @template D - The delimiter to use when joining the strings.
*/
interface Join_T<D extends string> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], (string | unknown)[]>): _$join<typeof x, D>;
}
/**
* `String.Join` is a type-level function that joins an array of strings into a single string.
*
* @template D - The delimiter to use when joining the strings.
* @template T - The array of strings to join.
*
* @example
* type T0 = $<$<String.Join, ''>, ['foo', 'bar']> // 'foobar'
* type T1 = $<$<String.Join, ' '>, ['foo', 'bar', 'qux']> // 'foo bar qux'
*/
export interface Join extends Kind.Kind {

@@ -7,0 +33,0 @@ f(x: Type._$cast<this[Kind._], string>): Join_T<typeof x>;

import { Type, Kind } from '..';
/**
* `String._$last` is a type-level function that extracts the last character from a string.
*
* @template S - The string to extract the last character from.
*
* @example
* type T0 = String._$last<'foo'> // 'o'
* type T1 = String._$last<''> // ''
*/
export type _$last<S extends string> = S extends `${string}${infer Tail}` ? Tail extends '' ? S : _$last<Tail> : string extends S ? S : '';
/**
* `String.Last` is a type-level function that extracts the last character from a string.
*
* @template S - The string to extract the last character from.
*
* @example
* type T0 = $<String.Last, 'foo'> // 'o'
* type T1 = $<String.Last, ''> // ''
*/
export interface Last extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$last<typeof x>;
}
import { Type, Kind, String } from '..';
/**
* `String._$length` is a type-level function that returns the length of a string.
*
* @template S - The string to get the length of.
*
* @example
* type T0 = String._$length<'hello'> // 5
* type T1 = String._$length<''> // 0
*/
export type _$length<S extends string> = String._$isTemplate<S> extends true ? number : string extends S ? number : String._$toList<S>['length'];
/**
* `String.Length` is a type-level function that returns the length of a string.
*
* @template S - The string to get the length of.
*
* @example
* type T0 = $<String.Length, 'hello'> // 5
* type T1 = $<String.Length, ''> // 0
*/
export interface Length extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$length<typeof x>;
}
import { Type, Kind } from '..';
/**
* `String.Prepend` is a type-level function that prepends a prefix to a string.
*
* @template Prefix - The prefix to prepend.
* @template S - The string to prepend to.
*
* @example
* type T0 = String._$prepend<'foo', 'bar'> // 'foobar'
* type T1 = String._$prepend<'', 'foo'> // 'foo'
*/
export type _$prepend<Prefix extends string, S extends string> = `${Prefix}${S}`;
/**
* `String.Prepend_T` is an intermediate interface for currying.
*/
interface Prepend_T<T extends string> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$prepend<T, typeof x>;
}
/**
* `String.Prepend` is a type-level function that prepends a prefix to a string.
*
* @template Prefix - The prefix to prepend.
* @template S - The string to prepend to.
*
* @example
* type T0 = $<$<String.Prepend, 'foo'>, 'bar'> // 'foobar'
* type T1 = $<$<String.Prepend, ''>, 'foo'> // 'foo'
*/
export interface Prepend extends Kind.Kind {

@@ -7,0 +30,0 @@ f(x: Type._$cast<this[Kind._], string>): Prepend_T<typeof x>;

import { Type, Kind, String } from '..';
/**
* `_$replace2` is a helper type utility for `_$replace`.
*/
type _$replace2<S extends string, From extends string, To extends string, O extends string = ''> = S extends `${infer Head}${From}${infer Tail}` ? _$replace2<Tail, From, To, `${O}${Head}${To}`> : `${O}${S}`;
/**
* `String.Replace` is a type-level function that replaces all instances of a string with another string.
*
* @template S - The string to replace in.
* @template From - The string to replace.
* @template To - The string to replace with.
*
* @example
* type T0 = String._$replace<'foobar', 'foo', 'bar'> // 'barbar'
* type T1 = String._$replace<'foo', 'foo', ''> // ''
*/
export type _$replace<S extends string, From extends string, To extends string> = String._$isTemplate<From> extends true ? string : string extends From ? string : From extends '' ? `${To}${_$replace2<S, From, To>}` : _$replace2<S, From, To>;
/**
* `Replace_T2` is an intermediate interface for currying.
*/
interface Replace_T2<From extends string, To extends string> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$replace<typeof x, From, To>;
}
/**
* `Replace_T` is an intermediate interface for currying.
*/
interface Replace_T<From extends string> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): Replace_T2<From, typeof x>;
}
/**
* `String.Replace` is a type-level function that replaces all instances of a string with another string.
*
* @template From - The string to replace.
* @template To - The string to replace with.
* @template S - The string to replace in.
*
* @example
* type T0 = $<$<$<String.Replace, 'foo'>, 'bar'>, 'foobar'> // 'barbar'
* type T1 = $<$<$<String.Replace, 'foo'>, ''>, 'foo'> // ''
*/
export interface Replace extends Kind.Kind {

@@ -11,0 +42,0 @@ f(x: Type._$cast<this[Kind._], string>): Replace_T<typeof x>;

import { Type, Kind } from '..';
/**
* `String._$reverse` is a type-level function that reverses the order of characters in a string.
*
* @template S - The string to reverse.
*
* @example
* type T0 = String._$reverse<'foo'> // 'oof'
* type T1 = String._$reverse<''> // ''
*/
export type _$reverse<S extends string, O extends string = ''> = S extends `${infer Head}${infer Tail}` ? _$reverse<Tail, `${Head}${O}`> : `${string extends S ? string : ''}${O}`;
/**
* `String.Reverse` is a type-level function that reverses the order of characters in a string.
* @template S - The string to reverse.
*
* @example
* type T0 = $<String.Reverse, 'foo'> // 'oof'
* type T1 = $<String.Reverse, ''> // ''
*/
export interface Reverse extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$reverse<typeof x>;
}

@@ -1,2 +0,12 @@

import { Kind, Type, String, Number, List } from '..';
import { List, Kind, Type, Number, String } from '..';
/**
* `String._$slice` is a type-level function that slices a string from a given index.
*
* @template S - The string to slice.
* @template N - The index from which to start the slice.
*
* @example
* type T0 = String._$slice<'hello', 1> // 'ello'
* type T1 = String._$slice<'hello', 0> // 'hello'
*/
export type _$slice<S extends string, N extends Number.Number> = String._$fromList<List._$shiftN<String._$toList<S>, N>>;

@@ -6,2 +16,12 @@ interface Slice_T<N extends Number.Number> extends Kind.Kind {

}
/**
* `String.Slice` is a type-level function that slices a string from a given index.
*
* @template N - The index from which to start the slice.
* @template S - The string to slice.
*
* @example
* type T0 = $<$<String.Slice, 1>, 'hello'> // 'ello'
* type T1 = $<$<String.Slice, 0>, 'hello'> // 'hello'
*/
export interface Slice extends Kind.Kind {

@@ -8,0 +28,0 @@ f(x: Type._$cast<this[Kind._], Number.Number>): Slice_T<typeof x>;

import { Type, Kind, String } from '..';
/**
* `String.Split` is a type-level function that splits a string into an array of substrings.
*
* @template S - The string to split.
* @template Delimiter - The delimiter to split the string by.
*
* @example
* type T0 = String._$split<'foobar', ''> // ['f', 'o', 'o', 'b', 'a', 'r']
* type T1 = String._$split<'foo bar', ' '> // ['foo', 'bar']
*/
export type _$split<S extends string, Delimiter extends string = '', O extends unknown[] = []> = String._$isTemplate<Delimiter> extends true ? string[] : string extends Delimiter ? string[] : S extends `${infer Head}${Delimiter}${infer Tail}` ? _$split<Tail, Delimiter, [...O, Head]> : S extends Delimiter ? O : [...O, S];

@@ -6,2 +16,12 @@ interface Split_T<Delimiter extends string> extends Kind.Kind {

}
/**
* `String.Split` is a type-level function that splits a string into an array of substrings.
*
* @template S - The string to split.
* @template Delimiter - The delimiter to split the string by.
*
* @example
* type T0 = $<$<String.Split, ''>, 'foobar'> // ['f', 'o', 'o', 'b', 'a', 'r']
* type T1 = $<$<String.Split, ' '>, 'foo bar'> // ['foo', 'bar']
*/
export interface Split extends Kind.Kind {

@@ -8,0 +28,0 @@ f(x: Type._$cast<this[Kind._], string>): Split_T<typeof x>;

import { Type, Kind } from '..';
/**
* `String.StartsWith` is a type-level function that checks if a string starts with a given prefix.
*
* @template Prefix - The prefix to check for.
* @template S - The string to check.
*
* @example
* type T0 = String._$startsWith<'foo', 'foobar'> // true
* type T1 = String._$startsWith<'bar', 'foobar'> // false
*/
export type _$startsWith<Prefix extends string, S extends string> = S extends `${Prefix}${string}` ? true : false;

@@ -6,2 +16,12 @@ interface StartsWith_T<Prefix extends string> extends Kind.Kind {

}
/**
* `String.StartsWith` is a type-level function that checks if a string starts with a given prefix.
*
* @template Prefix - The prefix to check for.
* @template S - The string to check.
*
* @example
* type T0 = $<$<String.StartsWith, 'foo'>, 'foobar'> // true
* type T1 = $<$<String.StartsWith, 'bar'>, 'foobar'> // false
*/
export interface StartsWith extends Kind.Kind {

@@ -8,0 +28,0 @@ f(x: Type._$cast<this[Kind._], string>): StartsWith_T<typeof x>;

import { Type, Kind } from '..';
/**
* `String._$tail` is a type-level function that extracts every element after the first element of a string.
*
* @template S - The string to extract the tail from.
*
* @example
* type T0 = String._$tail<'hello'> // 'ello'
* type T1 = String._$tail<''> // ''
*/
export type _$tail<S extends string> = S extends `${string}${infer Tail}` ? Tail extends '' ? S : Tail : string extends S ? S : '';
/**
* `String.Tail` is a type-level function that extracts every element after the first element of a string.
*
* @template S - The string to extract the tail from.
*
* @example
* type T0 = $<String.Tail, 'hello'> // 'ello'
* type T1 = $<String.Tail, ''> // ''
*/
export interface Tail extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$tail<typeof x>;
}
import { Type, Kind } from '..';
/**
* `String._$toList` is a type-level function that splits a string into a list of its characters.
*
* @template S - The string to split.
*
* @example
* type T0 = String._$toList<'hello'> // ['h', 'e', 'l', 'l', 'o']
* type T1 = String._$toList<''> // []
*/
export type _$toList<S extends string, O extends string[] = []> = 0 extends 1 ? never : string extends S ? [string] : S extends `${infer Head}${infer Tail}` ? _$toList<Tail, [...O, Head]> : O;
/**
* `String.ToList` is a type-level function that splits a string into a list of its characters.
*
* @template S - The string to split.
*
* @example
* type T0 = $<String.ToList, 'hello'> // ['h', 'e', 'l', 'l', 'o']
* type T1 = $<String.ToList, ''> // []
*/
export interface ToList extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$toList<typeof x>;
}
import { Type, Kind } from '..';
/**
* `String.ToLower` is a type-level function that converts a string to lowercase.
*
* @template S - The string to convert to lowercase.
*
* @example
* type T0 = String._$toLower<'HELLO'> // 'hello'
* type T1 = String._$toLower<'WORLD'> // 'world'
*/
export type _$toLower<S extends string> = Lowercase<S>;
/**
* `String.ToLower` is a type-level function that converts a string to lowercase.
*
* @template S - The string to convert to lowercase.
*
* @example
* type T0 = $<String.ToLower, 'HELLO'> // 'hello'
* type T1 = $<String.ToLower, 'WORLD'> // 'world'
*/
export interface ToLower extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$toLower<typeof x>;
}
import { Type, Kind } from '..';
/**
* `String._$toUpper` is a type-level function that converts a string to uppercase.
*
* @template S - The string to convert to uppercase.
*
* @example
* type T0 = String._$toUpper<'foo'> // 'FOO'
* type T1 = String._$toUpper<'bar'> // 'BAR'
*/
export type _$toUpper<S extends string> = Uppercase<S>;
/**
* `String.ToUpper` is a type-level function that converts a string to uppercase.
*
* @template S - The string to convert to uppercase.
*
* @example
* type T0 = $<String.ToUpper, 'foo'> // 'FOO'
* type T1 = $<String.ToUpper, 'bar'> // 'BAR'
*/
export interface ToUpper extends Kind.Kind {
f(x: Type._$cast<this[Kind._], string>): _$toUpper<typeof x>;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc