hkt-toolbelt
Advanced tools
Comparing version 0.13.2 to 0.14.0
import { Kind } from ".."; | ||
export declare type $<F extends Kind.Kind, X extends Kind._$inputOf<F>> = ReturnType<(F & { | ||
export type $<F extends Kind.Kind, X extends Kind._$inputOf<F>> = ReturnType<(F & { | ||
readonly [Kind._]: X; | ||
})["f"]>; |
import { Kind, List } from ".."; | ||
export declare type $$<FX extends Kind.Kind[], X extends FX extends [] ? unknown : Kind._$inputOf<List._$first<FX>>> = Kind._$pipe<FX, X>; | ||
export type $$<FX extends Kind.Kind[], X extends FX extends [] ? unknown : Kind._$inputOf<List._$first<FX>>> = Kind._$pipe<FX, X>; |
import { Kind, Type } from ".."; | ||
export declare type _$and<T extends boolean, U extends boolean> = [T, U] extends [ | ||
export type _$and<T extends boolean, U extends boolean> = [T, U] extends [ | ||
true, | ||
@@ -4,0 +4,0 @@ true |
import { Type, Kind } from ".."; | ||
export declare type _$not<T extends boolean> = T extends true ? false : true; | ||
export type _$not<T extends boolean> = T extends true ? false : true; | ||
export declare abstract class Not extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], boolean>) => _$not<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$or<T extends boolean, U extends boolean> = [T, U] extends [ | ||
export type _$or<T extends boolean, U extends boolean> = [T, U] extends [ | ||
false, | ||
@@ -4,0 +4,0 @@ false |
import { Kind } from ".."; | ||
export declare type _$equals<T, U> = [T, U] extends [U, T] ? true : false; | ||
export type _$equals<T, U> = [T, U] extends [U, T] ? true : false; | ||
export declare abstract class Equals<T> extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$equals<T, typeof x>; | ||
} |
import { Kind } from ".."; | ||
export declare type _$extends<Super, X> = (X extends unknown ? X : never) extends Super ? true : false; | ||
export type _$extends<Super, X> = (X extends unknown ? X : never) extends Super ? true : false; | ||
export declare abstract class Extends<Super> extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$extends<Super, typeof x>; | ||
} |
import { $, Type, Function, Kind } from ".."; | ||
export declare 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>>>; | ||
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>>>; | ||
export declare abstract class If<Predicate extends Kind.Kind<(x: never) => boolean>, Then extends Kind.Kind, Else extends Kind.Kind = Function.Constant<never>> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Kind._$inputOf<Predicate>>) => _$if<Predicate, Then, Else, typeof x>; | ||
} |
import { Digit, DigitList, Kind, Type } from ".."; | ||
declare type _$add2< | ||
type _$add2< | ||
/** | ||
@@ -95,3 +95,3 @@ * The first digit list to add. | ||
> = DONE extends true ? RESULT : _$add2<A_NEXT, B_NEXT, CARRY_NEXT, OUTPUT_NEXT>; | ||
export declare type _$add<A extends DigitList.DigitList, B extends DigitList.DigitList, SUM = _$add2<A, B>, | ||
export type _$add<A extends DigitList.DigitList, B extends DigitList.DigitList, SUM = _$add2<A, B>, | ||
/** | ||
@@ -98,0 +98,0 @@ * In the case that we inputted two empty digit lists, we return the standard |
import { Type, Kind, Digit, DigitList } from ".."; | ||
export declare type _$decrement2< | ||
export type _$decrement2< | ||
/** | ||
@@ -52,5 +52,5 @@ * The digit-list to decrement. | ||
SHORT_CIRCUIT = A extends "0"[] ? OUTPUT : [...A, ...OUTPUT]> = A extends "0"[] ? FINAL_RESULT : CARRY extends "0" ? SHORT_CIRCUIT : _$decrement2<NEXT_A, NEXT_CARRY, NEXT_OUTPUT>; | ||
export declare type _$decrement<A extends DigitList.DigitList> = DigitList._$trim<A extends "0"[] ? ["0"] : _$decrement2<A>>; | ||
export type _$decrement<A extends DigitList.DigitList> = DigitList._$trim<A extends "0"[] ? ["0"] : _$decrement2<A>>; | ||
export declare abstract class Decrement extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], DigitList.DigitList>) => _$decrement<typeof x>; | ||
} |
import { Digit } from ".."; | ||
export declare type DigitList = readonly Digit.Digit[]; | ||
export type DigitList = readonly Digit.Digit[]; |
import { Type, Kind, Digit, DigitList } from ".."; | ||
export declare type _$increment< | ||
export type _$increment< | ||
/** | ||
@@ -4,0 +4,0 @@ * The digit-list to increment. |
@@ -6,2 +6,4 @@ export * from "./add"; | ||
export * from "./last"; | ||
export * from "./multiply-digit"; | ||
export * from "./multiply"; | ||
export * from "./pop"; | ||
@@ -8,0 +10,0 @@ export * from "./subtract"; |
import { Type, Kind, Digit, DigitList } from ".."; | ||
export declare type _$last<T extends DigitList.DigitList> = T extends [] ? Digit.Zero : T extends [...unknown[], infer X] ? X : Digit.Zero; | ||
export type _$last<T extends DigitList.DigitList> = T extends [] ? Digit.Zero : T extends [...unknown[], infer X] ? X : Digit.Zero; | ||
export declare abstract class Last extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], DigitList.DigitList>) => _$last<typeof x>; | ||
} |
import { Type, Kind, DigitList } from ".."; | ||
export declare type _$pop<T extends DigitList.DigitList> = T extends [] ? [] : T extends [...infer X, unknown] ? X : []; | ||
export type _$pop<T extends DigitList.DigitList> = T extends [] ? [] : T extends [...infer X, unknown] ? X : []; | ||
export declare abstract class Pop extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], DigitList.DigitList>) => _$pop<typeof x>; | ||
} |
import { Digit, DigitList, Kind, Type } from ".."; | ||
declare type _$subtract2<A extends DigitList.DigitList, B extends DigitList.DigitList, CARRY extends Digit.Digit = "0", OUTPUT extends DigitList.DigitList = [], A_LAST extends Digit.Digit = DigitList._$last<A>, B_LAST extends Digit.Digit = DigitList._$last<B>, A_NEXT extends DigitList.DigitList = DigitList._$pop<A>, B_NEXT extends DigitList.DigitList = DigitList._$pop<B>, SUB extends Digit.Digit = Digit._$subtract<A_LAST, B_LAST>, SUB_TENS extends Digit.Digit = Digit._$subtractTens<A_LAST, B_LAST>, SUB_CARRY extends Digit.Digit = Digit._$subtract<SUB, CARRY>, SUB_CARRY_TENS extends Digit.Digit = Digit._$subtractTens<SUB, SUB_CARRY>, CARRY_NEXT extends Digit.Digit = SUB_TENS extends "1" ? "1" : SUB_CARRY_TENS, OUTPUT_NEXT extends DigitList.DigitList = [SUB_CARRY, ...OUTPUT], DONE = A extends [] ? (B extends [] ? true : false) : false, RESULT = CARRY extends "1" ? ["0"] : OUTPUT> = DONE extends true ? RESULT : _$subtract2<A_NEXT, B_NEXT, CARRY_NEXT, OUTPUT_NEXT>; | ||
export declare type _$subtract<A extends DigitList.DigitList, B extends DigitList.DigitList> = DigitList._$trim<_$subtract2<A, B>>; | ||
type _$subtract2<A extends DigitList.DigitList, B extends DigitList.DigitList, CARRY extends Digit.Digit = "0", OUTPUT extends DigitList.DigitList = [], A_LAST extends Digit.Digit = DigitList._$last<A>, B_LAST extends Digit.Digit = DigitList._$last<B>, A_NEXT extends DigitList.DigitList = DigitList._$pop<A>, B_NEXT extends DigitList.DigitList = DigitList._$pop<B>, SUB extends Digit.Digit = Digit._$subtract<A_LAST, B_LAST>, SUB_TENS extends Digit.Digit = Digit._$subtractTens<A_LAST, B_LAST>, SUB_CARRY extends Digit.Digit = Digit._$subtract<SUB, CARRY>, SUB_CARRY_TENS extends Digit.Digit = Digit._$subtractTens<SUB, SUB_CARRY>, CARRY_NEXT extends Digit.Digit = SUB_TENS extends "1" ? "1" : SUB_CARRY_TENS, OUTPUT_NEXT extends DigitList.DigitList = [SUB_CARRY, ...OUTPUT], DONE = A extends [] ? (B extends [] ? true : false) : false, RESULT = CARRY extends "1" ? ["0"] : OUTPUT> = DONE extends true ? RESULT : _$subtract2<A_NEXT, B_NEXT, CARRY_NEXT, OUTPUT_NEXT>; | ||
export type _$subtract<A extends DigitList.DigitList, B extends DigitList.DigitList> = DigitList._$trim<_$subtract2<A, B>>; | ||
declare abstract class Subtract_T<X extends DigitList.DigitList> extends Kind.Kind { | ||
@@ -5,0 +5,0 @@ abstract f: (x: Type._$cast<this[Kind._], DigitList.DigitList>) => _$subtract<X, typeof x>; |
import { Type, Kind, DigitList } from ".."; | ||
declare type _$toString2<T extends DigitList.DigitList, O extends string = ""> = T extends [] ? O : _$toString2<DigitList._$pop<T>, `${DigitList._$last<T>}${O}`>; | ||
export declare type _$toString<T extends DigitList.DigitList, JOIN = _$toString2<T>, RESULT = JOIN extends "" ? "0" : JOIN> = RESULT; | ||
type _$toString2<T extends DigitList.DigitList, O extends string = ""> = T extends [] ? O : _$toString2<DigitList._$pop<T>, `${DigitList._$last<T>}${O}`>; | ||
export type _$toString<T extends DigitList.DigitList, JOIN = _$toString2<T>, RESULT = JOIN extends "" ? "0" : JOIN> = RESULT; | ||
export declare abstract class ToString extends Kind.Kind { | ||
@@ -5,0 +5,0 @@ abstract f: (x: Type._$cast<this[Kind._], DigitList.DigitList>) => _$toString<typeof x>; |
import { Type, Kind, DigitList } from ".."; | ||
declare type _$trim2<A extends DigitList.DigitList> = A extends [ | ||
type _$trim2<A extends DigitList.DigitList> = A extends [ | ||
"0", | ||
...infer Rest extends DigitList.DigitList | ||
] ? _$trim2<Rest> : A; | ||
export declare type _$trim<A extends DigitList.DigitList, TRIM extends DigitList.DigitList = _$trim2<A>, OUTPUT extends DigitList.DigitList = TRIM extends [] ? ["0"] : TRIM> = OUTPUT; | ||
export type _$trim<A extends DigitList.DigitList, TRIM extends DigitList.DigitList = _$trim2<A>, OUTPUT extends DigitList.DigitList = TRIM extends [] ? ["0"] : TRIM> = OUTPUT; | ||
export declare abstract class Trim extends Kind.Kind { | ||
@@ -8,0 +8,0 @@ abstract f: (x: Type._$cast<this[Kind._], DigitList.DigitList>) => _$trim<typeof x>; |
import { Type, Digit, Kind } from ".."; | ||
declare type _$addTens_LUT = [ | ||
type _$addTens_LUT = [ | ||
[ | ||
@@ -124,3 +124,3 @@ "0", | ||
]; | ||
export declare type _$addTens<A extends Digit.Digit, B extends Digit.Digit> = _$addTens_LUT[A][B]; | ||
export type _$addTens<A extends Digit.Digit, B extends Digit.Digit> = _$addTens_LUT[A][B]; | ||
export declare abstract class AddTens_T<A extends Digit.Digit> extends Kind.Kind { | ||
@@ -127,0 +127,0 @@ abstract f: (x: Type._$cast<this[Kind._], Digit.Digit>) => _$addTens<A, typeof x>; |
import { Type, Digit, Kind } from ".."; | ||
declare type _$add_LUT = [ | ||
type _$add_LUT = [ | ||
[ | ||
@@ -124,3 +124,3 @@ "0", | ||
]; | ||
export declare type _$add<A extends Digit.Digit, B extends Digit.Digit> = _$add_LUT[A][B]; | ||
export type _$add<A extends Digit.Digit, B extends Digit.Digit> = _$add_LUT[A][B]; | ||
declare abstract class Add_T<A extends Digit.Digit> extends Kind.Kind { | ||
@@ -127,0 +127,0 @@ abstract f: (x: Type._$cast<this[Kind._], Digit.Digit>) => _$add<A, typeof x>; |
import { Type, Digit, Kind } from ".."; | ||
declare type _$decrementTens_LUT = ["1", "0", "0", "0", "0", "0", "0", "0", "0", "0"]; | ||
export declare type _$decrementTens<A extends Digit.Digit> = _$decrementTens_LUT[A]; | ||
type _$decrementTens_LUT = ["1", "0", "0", "0", "0", "0", "0", "0", "0", "0"]; | ||
export type _$decrementTens<A extends Digit.Digit> = _$decrementTens_LUT[A]; | ||
export declare abstract class DecrementTens extends Kind.Kind { | ||
@@ -5,0 +5,0 @@ abstract f: (x: Type._$cast<this[Kind._], Digit.Digit>) => _$decrementTens<typeof x>; |
import { Type, Digit, Kind } from ".."; | ||
declare type _$decrement_LUT = ["9", "0", "1", "2", "3", "4", "5", "6", "7", "8"]; | ||
export declare type _$decrement<A extends Digit.Digit> = _$decrement_LUT[A]; | ||
type _$decrement_LUT = ["9", "0", "1", "2", "3", "4", "5", "6", "7", "8"]; | ||
export type _$decrement<A extends Digit.Digit> = _$decrement_LUT[A]; | ||
export declare abstract class Decrement extends Kind.Kind { | ||
@@ -5,0 +5,0 @@ abstract f: (x: Type._$cast<this[Kind._], Digit.Digit>) => _$decrement<typeof x>; |
@@ -1,1 +0,1 @@ | ||
export declare type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; | ||
export type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"; |
import { Type, Digit, Kind } from ".."; | ||
declare type _$incrementTens_LUT = ["0", "0", "0", "0", "0", "0", "0", "0", "0", "1"]; | ||
export declare type _$incrementTens<A extends Digit.Digit> = _$incrementTens_LUT[A]; | ||
type _$incrementTens_LUT = ["0", "0", "0", "0", "0", "0", "0", "0", "0", "1"]; | ||
export type _$incrementTens<A extends Digit.Digit> = _$incrementTens_LUT[A]; | ||
export declare abstract class IncrementTens extends Kind.Kind { | ||
@@ -5,0 +5,0 @@ abstract f: (x: Type._$cast<this[Kind._], Digit.Digit>) => _$incrementTens<typeof x>; |
import { Type, Digit, Kind } from ".."; | ||
declare type _$increment_LUT = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]; | ||
export declare type _$increment<A extends Digit.Digit> = _$increment_LUT[A]; | ||
type _$increment_LUT = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]; | ||
export type _$increment<A extends Digit.Digit> = _$increment_LUT[A]; | ||
export declare abstract class Increment extends Kind.Kind { | ||
@@ -5,0 +5,0 @@ abstract f: (x: Type._$cast<this[Kind._], Digit.Digit>) => _$increment<typeof x>; |
@@ -8,4 +8,6 @@ export * from "./add-tens"; | ||
export * from "./increment"; | ||
export * from "./multiply-tens"; | ||
export * from "./multiply"; | ||
export * from "./subtract-tens"; | ||
export * from "./subtract"; | ||
export * from "./zero"; |
import { Type, Digit, Kind } from ".."; | ||
declare type _$subtractTens_LUT = [ | ||
type _$subtractTens_LUT = [ | ||
[ | ||
@@ -124,3 +124,3 @@ "0", | ||
]; | ||
export declare type _$subtractTens<A extends Digit.Digit, B extends Digit.Digit> = _$subtractTens_LUT[A][B]; | ||
export type _$subtractTens<A extends Digit.Digit, B extends Digit.Digit> = _$subtractTens_LUT[A][B]; | ||
declare abstract class SubtractTens_T<A extends Digit.Digit> extends Kind.Kind { | ||
@@ -127,0 +127,0 @@ abstract f: (x: Type._$cast<this[Kind._], Digit.Digit>) => _$subtractTens<A, typeof x>; |
import { Type, Digit, Kind } from ".."; | ||
declare type _$subtract_LUT = [ | ||
type _$subtract_LUT = [ | ||
[ | ||
@@ -124,3 +124,3 @@ "0", | ||
]; | ||
export declare type _$subtract<A extends Digit.Digit, B extends Digit.Digit> = _$subtract_LUT[A][B]; | ||
export type _$subtract<A extends Digit.Digit, B extends Digit.Digit> = _$subtract_LUT[A][B]; | ||
declare abstract class Subtract_T<A extends Digit.Digit> extends Kind.Kind { | ||
@@ -127,0 +127,0 @@ abstract f: (x: Type._$cast<this[Kind._], Digit.Digit>) => _$subtract<A, typeof x>; |
@@ -1,1 +0,1 @@ | ||
export declare type Zero = "0"; | ||
export type Zero = "0"; |
@@ -1,1 +0,1 @@ | ||
export declare type Function = (...x: never[]) => unknown; | ||
export type Function = (...x: never[]) => unknown; |
@@ -33,84 +33,18 @@ export { $, $$ } from "./$"; | ||
declare const _default: { | ||
Length: typeof Union.Length; | ||
ToIntersection: typeof Union.ToIntersection; | ||
ToList: typeof Union.ToList; | ||
Cast: typeof Type.Cast; | ||
Display: typeof Type.Display; | ||
IsNever: typeof Type.IsNever; | ||
ValueOf: typeof Type.ValueOf; | ||
_: typeof Test._; | ||
Append: typeof String.Append; | ||
EndsWith: typeof String.EndsWith; | ||
First: typeof String.First; | ||
Includes: typeof String.Includes; | ||
Init: typeof String.Init; | ||
IsString: typeof String.IsString; | ||
IsTemplate: typeof String.IsTemplate; | ||
Join: typeof String.Join; | ||
Last: typeof String.Last; | ||
Prepend: typeof String.Prepend; | ||
Replace: typeof String.Replace; | ||
Reverse: typeof String.Reverse; | ||
Split: typeof String.Split; | ||
StartsWith: typeof String.StartsWith; | ||
Tail: typeof String.Tail; | ||
ToLower: typeof String.ToLower; | ||
ToUpper: typeof String.ToUpper; | ||
AtPath: typeof Object.AtPath; | ||
At: typeof Object.At; | ||
DeepInputOf: typeof Object.DeepInputOf; | ||
DeepMapValues: typeof Object.DeepMapValues; | ||
Keys: typeof Object.Keys; | ||
MapKeys: typeof Object.MapKeys; | ||
MapValues: typeof Object.MapValues; | ||
Paths: typeof Object.Paths; | ||
Values: typeof Object.Values; | ||
FromString: typeof Number.FromString; | ||
IsFractional: typeof Number.IsFractional; | ||
IsInteger: typeof Number.IsInteger; | ||
IsNatural: typeof Number.IsNatural; | ||
Sign: typeof Number.Sign; | ||
ToString: typeof Number.ToString; | ||
Add: typeof NaturalNumber.Add; | ||
Decrement: typeof NaturalNumber.Decrement; | ||
Increment: typeof NaturalNumber.Increment; | ||
Subtract: typeof NaturalNumber.Subtract; | ||
Every: typeof List.Every; | ||
Filter: typeof List.Filter; | ||
Find: typeof List.Find; | ||
IsVariadic: typeof List.IsVariadic; | ||
Map: typeof List.Map; | ||
Pair: typeof List.Pair; | ||
Pop: typeof List.Pop; | ||
Push: typeof List.Push; | ||
Reduce: typeof List.Reduce; | ||
Shift: typeof List.Shift; | ||
Some: typeof List.Some; | ||
Unshift: typeof List.Unshift; | ||
Apply: typeof Kind.Apply; | ||
ComposablePair: typeof Kind.ComposablePair; | ||
Composable: typeof Kind.Composable; | ||
Compose: typeof Kind.Compose; | ||
InputOf: typeof Kind.InputOf; | ||
Kind: typeof Kind.Kind; | ||
OutputOf: typeof Kind.OutputOf; | ||
Pipe: typeof Kind.Pipe; | ||
Constant: typeof Function.Constant; | ||
Identity: typeof Function.Identity; | ||
AddTens_T: typeof Digit.AddTens_T; | ||
AddTens: typeof Digit.AddTens; | ||
DecrementTens: typeof Digit.DecrementTens; | ||
IncrementTens: typeof Digit.IncrementTens; | ||
SubtractTens: typeof Digit.SubtractTens; | ||
Trim: typeof DigitList.Trim; | ||
Equals: typeof Conditional.Equals; | ||
Extends: typeof Conditional.Extends; | ||
If: typeof Conditional.If; | ||
ApplySelf: typeof Combinator.ApplySelf; | ||
RecursiveKind: typeof Combinator.RecursiveKind; | ||
Self: typeof Combinator.Self; | ||
And: typeof Boolean.And; | ||
Not: typeof Boolean.Not; | ||
Or: typeof Boolean.Or; | ||
Boolean: typeof Boolean; | ||
Combinator: typeof Combinator; | ||
Conditional: typeof Conditional; | ||
DigitList: typeof DigitList; | ||
Digit: typeof Digit; | ||
Function: typeof Function; | ||
Kind: typeof Kind; | ||
List: typeof List; | ||
NaturalNumber: typeof NaturalNumber; | ||
Number: typeof Number; | ||
Object: typeof Object; | ||
String: typeof String; | ||
Test: typeof Test; | ||
Type: typeof Type; | ||
Union: typeof Union; | ||
}; | ||
export default _default; |
import { Type, Kind } from ".."; | ||
declare type _$composablePair<F extends [Kind.Kind, Kind.Kind]> = Kind._$outputOf<F[1]> extends Kind._$inputOf<F[0]> ? true : false; | ||
type _$composablePair<F extends [Kind.Kind, Kind.Kind]> = Kind._$outputOf<F[1]> extends Kind._$inputOf<F[0]> ? true : false; | ||
export declare abstract class ComposablePair extends Kind.Kind { | ||
@@ -4,0 +4,0 @@ abstract f: (x: Type._$cast<this[Kind._], [Kind.Kind, Kind.Kind]>) => _$composablePair<typeof x>; |
import { Type, List, Kind } from ".."; | ||
export declare type _$composable<FX extends Kind.Kind[]> = List._$every<Kind.ComposablePair, List._$pair<FX>>; | ||
export type _$composable<FX extends Kind.Kind[]> = List._$every<Kind.ComposablePair, List._$pair<FX>>; | ||
export declare abstract class Composable extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Kind.Kind[]>) => _$composable<typeof x>; | ||
} |
import { $, Type, List, Kind } from ".."; | ||
export declare type _$compose<FX extends Kind.Kind[], X> = FX extends [ | ||
export type _$compose<FX extends Kind.Kind[], X> = FX extends [ | ||
...infer Init, | ||
@@ -4,0 +4,0 @@ infer Last |
import { Type, Kind } from ".."; | ||
export declare type _$inputOf<F extends Kind.Kind> = F extends { | ||
export type _$inputOf<F extends Kind.Kind> = F extends { | ||
f: (x: infer X) => unknown; | ||
@@ -4,0 +4,0 @@ } ? X : unknown; |
import { Function } from ".."; | ||
export declare const _: unique symbol; | ||
export declare type _ = typeof _; | ||
export type _ = typeof _; | ||
export declare abstract class Kind<F extends Function.Function = Function.Function> { | ||
@@ -5,0 +5,0 @@ abstract readonly [_]: unknown; |
import { Type, Kind } from ".."; | ||
export declare type _$outputOf<F extends Kind.Kind> = F extends { | ||
export type _$outputOf<F extends Kind.Kind> = F extends { | ||
f: (x: never) => infer X; | ||
@@ -4,0 +4,0 @@ } ? X : unknown; |
import { Type, List, Kind } from ".."; | ||
export declare type _$pipe<FX extends Kind.Kind[], X> = Kind._$compose<List._$reverse<FX>, X>; | ||
export type _$pipe<FX extends Kind.Kind[], X> = Kind._$compose<List._$reverse<FX>, X>; | ||
export declare abstract class Pipe<FX extends Kind._$composable<List._$reverse<FX>> extends true ? Kind.Kind[] : never> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], FX extends [] ? unknown : Kind._$inputOf<List._$first<FX>>>) => _$pipe<FX, typeof x>; | ||
} |
import { $, Boolean, Type, Kind } from ".."; | ||
export declare 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; | ||
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; | ||
export declare abstract class Every<F extends Kind.Kind<(x: never) => boolean>> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Kind._$inputOf<F>[]>) => _$every<F, typeof x>; | ||
} |
import { $, Type, Kind } from ".."; | ||
export declare 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; | ||
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; | ||
export declare abstract class Filter<F extends Kind.Kind<(x: never) => boolean>> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Kind._$inputOf<F>[]>) => _$filter<F, typeof x>; | ||
} |
import { $, Type, Kind } from ".."; | ||
export declare type _$find<F extends Kind.Kind, X extends unknown[]> = X extends [ | ||
export type _$find<F extends Kind.Kind, X extends unknown[]> = X extends [ | ||
infer Head, | ||
@@ -4,0 +4,0 @@ ...infer Tail |
import { Type, Kind } from ".."; | ||
export declare type _$first<T extends unknown[]> = T extends [] ? never : T[0]; | ||
export type _$first<T extends unknown[]> = T extends [] ? never : T[0]; | ||
export declare abstract class First extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], unknown[]>) => _$first<typeof x>; | ||
} |
import { $, Type, Kind } from ".."; | ||
export declare type _$includes<F extends Kind.Kind, X extends unknown[]> = X extends [ | ||
export type _$includes<F extends Kind.Kind, X extends unknown[]> = X extends [ | ||
infer Head, | ||
@@ -4,0 +4,0 @@ ...infer Tail |
import { Type, Kind } from ".."; | ||
export declare type _$isVariadic<T extends unknown[]> = number extends T["length"] ? true : false; | ||
export type _$isVariadic<T extends unknown[]> = number extends T["length"] ? true : false; | ||
export declare abstract class IsVariadic extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], unknown[]>) => _$isVariadic<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare 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]; | ||
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]; | ||
export declare abstract class Last extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], readonly unknown[]>) => _$last<typeof x>; | ||
} |
import { $, Type, Kind } from ".."; | ||
export declare type _$map<F extends Kind.Kind, X extends unknown[]> = { | ||
export type _$map<F extends Kind.Kind, X extends unknown[]> = { | ||
[key in keyof X]: $<F, Type._$cast<X[key], Kind._$inputOf<F>>>; | ||
@@ -4,0 +4,0 @@ }; |
import { Type, Kind } from ".."; | ||
export declare 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; | ||
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; | ||
export declare abstract class Pair extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], unknown[]>) => _$pair<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$pop<T extends readonly unknown[]> = T extends [ | ||
export type _$pop<T extends readonly unknown[]> = T extends [ | ||
...infer Head, | ||
@@ -4,0 +4,0 @@ unknown |
import { Type, Kind } from ".."; | ||
export declare type _$push<X, T extends unknown[]> = [...T, X]; | ||
export type _$push<X, T extends unknown[]> = [...T, X]; | ||
export declare abstract class Push<X> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], unknown[]>) => _$push<X, typeof x>; | ||
} |
import { $, Kind, Type } from ".."; | ||
export declare type _$reduce<F extends Kind.Kind<(x: never) => Kind.Kind>, X extends unknown[], O> = 1 extends 0 ? never : X extends [infer H, ...infer T] ? $<$<F, Type._$cast<O, Kind._$inputOf<F>>>, Type._$cast<H, Kind._$inputOf<ReturnType<(F & { | ||
export type _$reduce<F extends Kind.Kind<(x: never) => Kind.Kind>, X extends unknown[], O> = 1 extends 0 ? never : X extends [infer H, ...infer T] ? $<$<F, Type._$cast<O, Kind._$inputOf<F>>>, Type._$cast<H, Kind._$inputOf<ReturnType<(F & { | ||
readonly [Kind._]: Type._$cast<O, Kind._$inputOf<F>>; | ||
@@ -4,0 +4,0 @@ })["f"]>>>> extends infer R ? _$reduce<F, T, R> : never : O; |
import { Type, Kind } from ".."; | ||
declare type _$reverse2<T extends unknown[], O extends unknown[] = []> = T extends [ | ||
type _$reverse2<T extends unknown[], O extends unknown[] = []> = T extends [ | ||
...infer Init, | ||
infer Last | ||
] ? Init extends [] ? [...O, Last] : _$reverse2<Init, [...O, Last]> : T extends [infer Head, ...unknown[]] ? Head : [...O, ...T]; | ||
export declare type _$reverse<T extends unknown[], O extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? _$reverse<Tail, [Head, ...O]> : T extends [] ? O : [..._$reverse2<T>, ...O]; | ||
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]; | ||
export declare abstract class Reverse extends Kind.Kind { | ||
@@ -8,0 +8,0 @@ abstract f: (x: Type._$cast<this[Kind._], unknown[]>) => _$reverse<typeof x>; |
import { Type, Kind } from ".."; | ||
export declare type _$shift<T extends unknown[]> = T extends [unknown, ...infer Tail] ? Tail : never; | ||
export type _$shift<T extends unknown[]> = T extends [unknown, ...infer Tail] ? Tail : never; | ||
export declare abstract class Shift extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], unknown[]>) => _$shift<typeof x>; | ||
} |
import { $, Boolean, Type, Kind } from ".."; | ||
export declare type _$some<F extends Kind.Kind<(x: never) => boolean>, T extends unknown[], O extends boolean = false> = T extends [infer Head, ...infer Rest] ? _$some<F, Rest, Boolean._$or<O, $<F, Type._$cast<Head, Kind._$inputOf<F>>>>> : O; | ||
export type _$some<F extends Kind.Kind<(x: never) => boolean>, T extends unknown[], O extends boolean = false> = T extends [infer Head, ...infer Rest] ? _$some<F, Rest, Boolean._$or<O, $<F, Type._$cast<Head, Kind._$inputOf<F>>>>> : O; | ||
export declare abstract class Some<F extends Kind.Kind<(x: never) => boolean>> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Kind._$inputOf<F>[]>) => _$some<F, typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$unshift<X, T extends unknown[]> = [X, ...T]; | ||
export type _$unshift<X, T extends unknown[]> = [X, ...T]; | ||
export declare abstract class Unshift<X> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], unknown[]>) => _$unshift<X, typeof x>; | ||
} |
import { Type, Number, Kind, DigitList, NaturalNumber } from ".."; | ||
export declare 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._$toString<SUM_LIST>> = SUM; | ||
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 = Number._$fromString<DigitList._$toString<SUM_LIST>>> = SUM; | ||
declare abstract class Add_T<A extends Number.Number> extends Kind.Kind { | ||
@@ -4,0 +4,0 @@ abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => Number._$isNatural<typeof x> extends true ? _$add<A, typeof x> : never; |
import { Type, Kind, DigitList, NaturalNumber, Number } from ".."; | ||
export declare 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 = DigitList._$toString<DECREMENT>> = RESULT; | ||
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; | ||
export declare abstract class Decrement extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => Number._$isNatural<typeof x> extends true ? _$decrement<typeof x> : never; | ||
} |
import { Type, Kind, DigitList, NaturalNumber, Number } from ".."; | ||
export declare 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 = DigitList._$toString<INCREMENT>> = RESULT; | ||
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; | ||
export declare abstract class Increment extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => Number._$isNatural<typeof x> extends true ? _$increment<typeof x> : never; | ||
} |
export * from "./add"; | ||
export * from "./decrement"; | ||
export * from "./increment"; | ||
export * from "./multiply"; | ||
export * from "./subtract"; | ||
export * from "./to-list"; |
import { Number, NaturalNumber, DigitList, Type, Kind } from ".."; | ||
export declare 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._$toString<SUB_LIST>> = RESULT; | ||
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 = Number._$fromString<DigitList._$toString<SUB_LIST>>> = RESULT; | ||
declare abstract class Subtract_T<X extends Number.Number> extends Kind.Kind { | ||
@@ -4,0 +4,0 @@ abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => Number._$isNatural<typeof x> extends true ? _$subtract<X, typeof x> : never; |
import { Type, Number, DigitList, Kind } from ".."; | ||
export declare type _$toList<S extends Number.Number, O extends string[] = []> = Number._$toString<S> extends `${infer Head}${infer Tail}` ? _$toList<Tail, [...O, Head]> : O extends DigitList.DigitList ? O : ["0"]; | ||
export type _$toList<S extends Number.Number, O extends string[] = []> = Number._$toString<S> extends `${infer Head}${infer Tail}` ? _$toList<Tail, [...O, Head]> : O extends DigitList.DigitList ? O : ["0"]; | ||
export declare abstract class ToList extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => Number._$isNatural<typeof x> extends true ? _$toList<typeof x> : never; | ||
} |
import { Kind, Type } from "hkt-toolbelt"; | ||
export declare type _$fromString<T extends string> = T extends `${infer T extends number | bigint}` ? T : never; | ||
export type _$fromString<T extends string> = T extends `${infer T extends number | bigint}` ? T : never; | ||
export declare abstract class FromString extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$fromString<typeof x>; | ||
} |
import { Number, Kind, Type } from ".."; | ||
export declare type _$isFractional<T extends Number.Number, IS_INTEGER = Number._$isInteger<T>> = number extends T ? false : IS_INTEGER extends true ? false : true; | ||
export type _$isFractional<T extends Number.Number, IS_INTEGER = Number._$isInteger<T>> = number extends T ? false : IS_INTEGER extends true ? false : true; | ||
export declare abstract class IsFractional extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => _$isFractional<typeof x>; | ||
} |
import { Type, Kind, Number } from ".."; | ||
export declare type _$isInteger<T extends Number.Number> = `${T}` extends `${bigint}` ? T extends `0x${string}` ? false : true : false; | ||
export type _$isInteger<T extends Number.Number> = `${T}` extends `${bigint}` ? T extends `0x${string}` ? false : true : false; | ||
export declare abstract class IsInteger extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => _$isInteger<typeof x>; | ||
} |
import { Number, Type, Kind } from ".."; | ||
export declare type _$isNatural<T extends Number.Number> = Number._$isInteger<T> extends true ? Number._$sign<T> extends "+" ? true : false : false; | ||
export type _$isNatural<T extends Number.Number> = Number._$isInteger<T> extends true ? Number._$sign<T> extends "+" ? true : false : false; | ||
export declare abstract class IsNatural extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => _$isNatural<typeof x>; | ||
} |
@@ -1,1 +0,1 @@ | ||
export declare type Number = string | number | bigint; | ||
export type Number = string | number | bigint; |
import { Type, Kind, Number } from ".."; | ||
export declare type _$sign<T extends Number.Number> = number extends T ? "+" | "-" : `${T}` extends `-${string}` ? "-" : "+"; | ||
export type _$sign<T extends Number.Number> = number extends T ? "+" | "-" : `${T}` extends `-${string}` ? "-" : "+"; | ||
export declare abstract class Sign extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => _$sign<typeof x>; | ||
} |
import { Kind, Type, Number } from ".."; | ||
export declare type _$toString<N extends Number.Number> = `${N}`; | ||
export type _$toString<N extends Number.Number> = `${N}`; | ||
export declare abstract class ToString extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Number.Number>) => _$toString<typeof x>; | ||
} |
import { Kind, Type } from ".."; | ||
export declare type _$atPath<Path extends (string | symbol)[], T> = Path extends [ | ||
export type _$atPath<Path extends (string | symbol)[], T> = Path extends [ | ||
infer Head, | ||
@@ -4,0 +4,0 @@ ...infer Tail |
import { Kind, Type } from ".."; | ||
export declare type _$at<K extends keyof T, T extends Record<string, unknown>> = T[K]; | ||
export type _$at<K extends keyof T, T extends Record<string, unknown>> = T[K]; | ||
export declare abstract class At<K extends string | symbol> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Record<K, unknown>>) => _$at<K, typeof x>; | ||
} |
import { Kind, Type } from ".."; | ||
export declare type _$deepInputOf<F extends Kind.Kind> = Kind._$inputOf<F> | { | ||
export type _$deepInputOf<F extends Kind.Kind> = Kind._$inputOf<F> | { | ||
[key: string]: _$deepInputOf<F>; | ||
@@ -4,0 +4,0 @@ }; |
import { $, Kind, Type } from ".."; | ||
import { _$deepInputOf } from "./deep-input-of"; | ||
export declare type _$deepMapValues<F extends Kind.Kind, O> = { | ||
export type _$deepMapValues<F extends Kind.Kind, O> = { | ||
[key in keyof O]: Type._$display<O[key] extends Record<string, unknown> ? _$deepMapValues<F, O[key]> : $<F, Type._$cast<O[key], Kind._$inputOf<F>>>>; | ||
@@ -5,0 +5,0 @@ }; |
import { Kind, Type, Union } from ".."; | ||
export declare type _$keys<T extends Record<string, unknown>> = Union._$toList<keyof T>; | ||
export type _$keys<T extends Record<string, unknown>> = Union._$toList<keyof T>; | ||
export declare abstract class Keys extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], Record<string, unknown>>) => _$keys<typeof x>; | ||
} |
import { $, Kind, Type } from ".."; | ||
export declare type _$mapKeys<T extends Record<string, unknown>, F extends Kind.Kind> = { | ||
export type _$mapKeys<T extends Record<string, unknown>, F extends Kind.Kind> = { | ||
[key in keyof T as $<F, Type._$cast<key, Kind._$inputOf<F>>>]: T[key]; | ||
@@ -4,0 +4,0 @@ }; |
import { $, Kind, Type } from ".."; | ||
export declare type _$mapValues<T extends Record<string, unknown>, F extends Kind.Kind> = { | ||
export type _$mapValues<T extends Record<string, unknown>, F extends Kind.Kind> = { | ||
[key in keyof T]: $<F, Type._$cast<T[key], Kind._$inputOf<F>>>; | ||
@@ -4,0 +4,0 @@ }; |
import { Kind, Type, Union } from ".."; | ||
declare type _$paths2<T, O extends unknown[] = []> = { | ||
type _$paths2<T, O extends unknown[] = []> = { | ||
[K in keyof T]: T[K] extends Record<string, unknown> ? _$paths2<T[K], [...O, K]> : [...O, K]; | ||
}[keyof T] | O; | ||
export declare type _$paths<T, U = _$paths2<T>> = Union._$toList<U extends [] ? never : U>; | ||
export type _$paths<T, U = _$paths2<T>> = Union._$toList<U extends [] ? never : U>; | ||
export declare abstract class Paths extends Kind.Kind { | ||
@@ -7,0 +7,0 @@ abstract f: (x: Type._$cast<this[Kind._], Record<string, unknown>>) => _$paths<typeof x>; |
import { Kind, Type } from ".."; | ||
import { _$keys } from "./keys"; | ||
export declare type _$values<T extends Record<string, unknown>, Keys = _$keys<T>> = { | ||
export type _$values<T extends Record<string, unknown>, Keys = _$keys<T>> = { | ||
[key in keyof Keys]: T[Type._$cast<Keys[key], keyof T>]; | ||
@@ -5,0 +5,0 @@ }; |
{ | ||
"name": "hkt-toolbelt", | ||
"version": "0.13.2", | ||
"version": "0.14.0", | ||
"description": "Functional and composable type utilities", | ||
@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts", |
import { Type, Kind } from ".."; | ||
export declare type _$append<Suffix extends string, S extends string> = `${S}${Suffix}`; | ||
export type _$append<Suffix extends string, S extends string> = `${S}${Suffix}`; | ||
export declare abstract class Append<Suffix extends string> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$append<Suffix, typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$endsWith<Suffix extends string, S extends string> = S extends `${string}${Suffix}` ? true : false; | ||
export type _$endsWith<Suffix extends string, S extends string> = S extends `${string}${Suffix}` ? true : false; | ||
export declare abstract class EndsWith<Suffix extends string> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$endsWith<Suffix, typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$first<S extends string> = S extends `${infer Head}${string}` ? Head : string extends S ? S : ""; | ||
export type _$first<S extends string> = S extends `${infer Head}${string}` ? Head : string extends S ? S : ""; | ||
export declare abstract class First extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$first<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$includes<Infix extends string, S extends string> = S extends `${string}${Infix}${string}` ? true : false; | ||
export type _$includes<Infix extends string, S extends string> = S extends `${string}${Infix}${string}` ? true : false; | ||
export declare abstract class Includes<Infix extends string> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$includes<Infix, typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
declare type _$init2<S extends string, O extends string = ""> = S extends `${infer Head}${infer Tail}` ? Tail extends "" ? O : _$init2<Tail, `${O}${Head}`> : O; | ||
export declare type _$init<S extends string> = string extends S ? string : _$init2<S>; | ||
type _$init2<S extends string, O extends string = ""> = S extends `${infer Head}${infer Tail}` ? Tail extends "" ? O : _$init2<Tail, `${O}${Head}`> : O; | ||
export type _$init<S extends string> = string extends S ? string : _$init2<S>; | ||
export declare abstract class Init extends Kind.Kind { | ||
@@ -5,0 +5,0 @@ abstract f: (x: Type._$cast<this[Kind._], string>) => _$init<typeof x>; |
import { Kind } from ".."; | ||
export declare type _$isString<S extends unknown> = S extends string ? true : false; | ||
export type _$isString<S extends unknown> = S extends string ? true : false; | ||
export declare abstract class IsString extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$isString<typeof x>; | ||
} |
import { Type, Conditional, Kind, List, String } from ".."; | ||
export declare type _$isTemplate<S extends string> = string extends S ? false : List._$some<Conditional.Equals<string>, String._$toList<S>>; | ||
export type _$isTemplate<S extends string> = string extends S ? false : List._$some<Conditional.Equals<string>, String._$toList<S>>; | ||
export declare abstract class IsTemplate extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$isTemplate<typeof x>; | ||
} |
import { Type, Kind, List } from ".."; | ||
export declare type _$join<T extends string[], D extends string = "", O extends string = ""> = List._$isVariadic<T> extends true ? string : T extends [infer Head, ...infer Tail] ? Tail extends [] ? `${O}${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; | ||
export type _$join<T extends string[], D extends string = "", O extends string = ""> = List._$isVariadic<T> extends true ? string : T extends [infer Head, ...infer Tail] ? Tail extends [] ? `${O}${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; | ||
export declare abstract class Join<D extends string = ""> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string[]>) => _$join<typeof x, D>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$last<S extends string> = S extends `${string}${infer Tail}` ? Tail extends "" ? S : _$last<Tail> : string extends S ? S : ""; | ||
export type _$last<S extends string> = S extends `${string}${infer Tail}` ? Tail extends "" ? S : _$last<Tail> : string extends S ? S : ""; | ||
export declare abstract class Last extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$last<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$prepend<Prefix extends string, S extends string> = `${Prefix}${S}`; | ||
export type _$prepend<Prefix extends string, S extends string> = `${Prefix}${S}`; | ||
export declare abstract class Prepend<Prefix extends string> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$prepend<Prefix, typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
import { _$isTemplate } from "./is-template"; | ||
declare 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}`; | ||
export declare type _$replace<S extends string, From extends string, To extends string> = _$isTemplate<From> extends true ? string : string extends From ? string : From extends "" ? `${To}${_$replace2<S, From, To>}` : _$replace2<S, From, To>; | ||
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}`; | ||
export type _$replace<S extends string, From extends string, To extends string> = _$isTemplate<From> extends true ? string : string extends From ? string : From extends "" ? `${To}${_$replace2<S, From, To>}` : _$replace2<S, From, To>; | ||
export declare abstract class Replace<From extends string, To extends string> extends Kind.Kind { | ||
@@ -6,0 +6,0 @@ abstract f: (x: Type._$cast<this[Kind._], string>) => _$replace<typeof x, From, To>; |
import { Type, Kind } from ".."; | ||
export declare type _$reverse<S extends string, O extends string = ""> = S extends `${infer Head}${infer Tail}` ? _$reverse<Tail, `${Head}${O}`> : `${string extends S ? string : ""}${O}`; | ||
export type _$reverse<S extends string, O extends string = ""> = S extends `${infer Head}${infer Tail}` ? _$reverse<Tail, `${Head}${O}`> : `${string extends S ? string : ""}${O}`; | ||
export declare abstract class Reverse extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$reverse<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
import { _$isTemplate } from "./is-template"; | ||
export declare type _$split<S extends string, Delimiter extends string = "", O extends unknown[] = []> = _$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]; | ||
export type _$split<S extends string, Delimiter extends string = "", O extends unknown[] = []> = _$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]; | ||
export declare abstract class Split<Delimiter extends string = ""> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$split<typeof x, Delimiter>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$startsWith<Prefix extends string, S extends string> = S extends `${Prefix}${string}` ? true : false; | ||
export type _$startsWith<Prefix extends string, S extends string> = S extends `${Prefix}${string}` ? true : false; | ||
export declare abstract class StartsWith<Prefix extends string> extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$startsWith<Prefix, typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$tail<S extends string> = S extends `${string}${infer Tail}` ? Tail extends "" ? S : Tail : string extends S ? S : ""; | ||
export type _$tail<S extends string> = S extends `${string}${infer Tail}` ? Tail extends "" ? S : Tail : string extends S ? S : ""; | ||
export declare abstract class Tail extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$tail<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$toList<S extends string, O extends string[] = []> = string extends S ? [string] : S extends `${infer Head}${infer Tail}` ? _$toList<Tail, [...O, Head]> : O; | ||
export type _$toList<S extends string, O extends string[] = []> = string extends S ? [string] : S extends `${infer Head}${infer Tail}` ? _$toList<Tail, [...O, Head]> : O; | ||
export declare abstract class ToList extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$toList<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$toLower<S extends string> = Lowercase<S>; | ||
export type _$toLower<S extends string> = Lowercase<S>; | ||
export declare abstract class ToLower extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$toLower<typeof x>; | ||
} |
import { Type, Kind } from ".."; | ||
export declare type _$toUpper<S extends string> = Uppercase<S>; | ||
export type _$toUpper<S extends string> = Uppercase<S>; | ||
export declare abstract class ToUpper extends Kind.Kind { | ||
abstract f: (x: Type._$cast<this[Kind._], string>) => _$toUpper<typeof x>; | ||
} |
import { Conditional, Test, Type } from ".."; | ||
export declare type ExpectNot<X extends Conditional._$equals<X, V> extends true ? V : V & Test._, V = false> = Type._$isNever<V> extends true ? X : Type._$isNever<X> extends true ? ExpectNot<X, V> : X; | ||
export type ExpectNot<X extends Conditional._$equals<X, V> extends true ? V : V & Test._, V = false> = Type._$isNever<V> extends true ? X : Type._$isNever<X> extends true ? ExpectNot<X, V> : X; |
@@ -5,2 +5,2 @@ import { Conditional, Type } from ".."; | ||
} | ||
export declare type Expect<X extends Conditional._$equals<X, V> extends true ? V : V & _, V = true> = Type._$isNever<V> extends true ? X : Type._$isNever<X> extends true ? Expect<X, V> : X; | ||
export type Expect<X extends Conditional._$equals<X, V> extends true ? V : V & _, V = true> = Type._$isNever<V> extends true ? X : Type._$isNever<X> extends true ? Expect<X, V> : X; |
import { Kind } from ".."; | ||
export declare type _$cast<T, U> = T extends U ? T : U; | ||
export type _$cast<T, U> = T extends U ? T : U; | ||
export declare abstract class Cast<T> extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$cast<typeof x, T>; | ||
} |
import { Kind } from ".."; | ||
export declare type _$display<T> = T extends (...args: never[]) => unknown ? T : T extends abstract new (...args: never[]) => unknown ? T : { | ||
export type _$display<T> = T extends (...args: never[]) => unknown ? T : T extends abstract new (...args: never[]) => unknown ? T : { | ||
[key in keyof T]: T[key]; | ||
@@ -4,0 +4,0 @@ }; |
import { Conditional, Kind } from ".."; | ||
export declare type _$isNever<X> = Conditional._$equals<X, never>; | ||
export type _$isNever<X> = Conditional._$equals<X, never>; | ||
export declare abstract class IsNever extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$isNever<typeof x>; | ||
} |
import { Kind } from ".."; | ||
export declare type _$valueOf<T> = T extends unknown[] ? T[number] : T[keyof T]; | ||
export type _$valueOf<T> = T extends unknown[] ? T[number] : T[keyof T]; | ||
export declare abstract class ValueOf extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$valueOf<typeof x>; | ||
} |
import { Kind, Union, Type } from ".."; | ||
export declare type _$length<T> = Type._$isNever<T> extends true ? 0 : Union._$toList<T> extends infer X extends unknown[] ? X["length"] : never; | ||
export type _$length<T> = Type._$isNever<T> extends true ? 0 : Union._$toList<T> extends infer X extends unknown[] ? X["length"] : never; | ||
export declare abstract class Length extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$length<typeof x>; | ||
} |
import { Kind } from ".."; | ||
export declare type _$toIntersection2<T> = (T extends unknown ? (x: T) => unknown : never) extends (x: infer X) => void ? X : never; | ||
export declare type _$toIntersection<T> = boolean extends T ? boolean & _$toIntersection2<Exclude<T, boolean>> : _$toIntersection2<T>; | ||
export type _$toIntersection2<T> = (T extends unknown ? (x: T) => unknown : never) extends (x: infer X) => void ? X : never; | ||
export type _$toIntersection<T> = boolean extends T ? boolean & _$toIntersection2<Exclude<T, boolean>> : _$toIntersection2<T>; | ||
export declare abstract class ToIntersection extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$toIntersection<this[Kind._]>; | ||
} |
import { Kind } from ".."; | ||
import { _$toIntersection } from "./to-intersection"; | ||
export declare type _$toList<T, O extends unknown[] = []> = _$toIntersection<T extends unknown ? (t: T) => T : never> extends (x: never) => infer X ? _$toList<Exclude<T, X>, [X, ...O]> : O; | ||
export type _$toList<T, O extends unknown[] = []> = _$toIntersection<T extends unknown ? (t: T) => T : never> extends (x: never) => infer X ? _$toList<Exclude<T, X>, [X, ...O]> : O; | ||
export declare abstract class ToList extends Kind.Kind { | ||
abstract f: (x: this[Kind._]) => _$toList<this[Kind._]>; | ||
} |
63900
146
1766