Skip to content

Commit

Permalink
Apply linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Nov 26, 2023
1 parent d340f10 commit 02e7e80
Show file tree
Hide file tree
Showing 46 changed files with 197 additions and 191 deletions.
20 changes: 10 additions & 10 deletions src/digit-list/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,16 @@ type _$compare3<
RESULT extends 1 | 0 | -1 = IS_SAME_LENGTH extends false
? _$compare3<A_LENGTH, B_LENGTH>
: A extends []
? B extends []
? 0
: -1
: B extends []
? 1
: BOTH_SINGLE_DIGIT extends true
? COMP
: COMP extends 0
? _$compare3<A_NEXT, B_NEXT>
: COMP
? B extends []
? 0
: -1
: B extends []
? 1
: BOTH_SINGLE_DIGIT extends true
? COMP
: COMP extends 0
? _$compare3<A_NEXT, B_NEXT>
: COMP
> = RESULT

type _$compare2<
Expand Down
4 changes: 2 additions & 2 deletions src/digit-list/decrement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ type _$decrement2<
> = A extends '0'[]
? FINAL_RESULT
: CARRY extends '0'
? SHORT_CIRCUIT
: _$decrement2<NEXT_A, NEXT_CARRY, NEXT_OUTPUT>
? SHORT_CIRCUIT
: _$decrement2<NEXT_A, NEXT_CARRY, NEXT_OUTPUT>

/**
* `_$decrement` is a type-level function that takes in a digit list `A` and
Expand Down
8 changes: 4 additions & 4 deletions src/digit-list/divide-by-subtraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ export type _$divideBySubtraction<
> = B extends [Digit.Zero]
? [Digit.Zero]
: B extends ['1']
? OPERATION extends 'DIVIDE'
? A
: [Digit.Zero]
: _$divideBySubtraction2<A, B, OPERATION>
? OPERATION extends 'DIVIDE'
? A
: [Digit.Zero]
: _$divideBySubtraction2<A, B, OPERATION>

interface DivideBySubtraction_T<A extends DigitList.DigitList>
extends Kind.Kind {
Expand Down
8 changes: 4 additions & 4 deletions src/digit-list/divide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ export type _$divide<
> = B extends [Digit.Zero]
? [Digit.Zero]
: B extends ['1']
? OPERATION extends 'DIVIDE'
? A
: [Digit.Zero]
: _$divide2<A, B, OPERATION>
? OPERATION extends 'DIVIDE'
? A
: [Digit.Zero]
: _$divide2<A, B, OPERATION>

interface Divide_T<A extends DigitList.DigitList> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], DigitList.DigitList>): _$divide<A, typeof x>
Expand Down
4 changes: 2 additions & 2 deletions src/digit-list/first.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { Digit, DigitList, Kind, Type } from '../'
export type _$first<T extends DigitList.DigitList> = T extends []
? Digit.Zero
: T extends [infer X, ...unknown[]]
? X
: Digit.Zero
? X
: Digit.Zero

/**
* `First` is a type-level function that returns the first digit of a digit list.
Expand Down
4 changes: 2 additions & 2 deletions src/digit-list/increment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export type _$increment<
> = A extends []
? FINAL_RESULT
: CARRY extends '0'
? SHORT_CIRCUIT
: _$increment<NEXT_A, NEXT_CARRY, NEXT_OUTPUT>
? SHORT_CIRCUIT
: _$increment<NEXT_A, NEXT_CARRY, NEXT_OUTPUT>

/**
* `Increment` is a type-level function that increments a digit list.
Expand Down
4 changes: 2 additions & 2 deletions src/digit-list/last.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { Type, Kind, Digit, DigitList } from '..'
export type _$last<T extends DigitList.DigitList> = T extends []
? Digit.Zero
: T extends [...unknown[], infer X]
? X
: Digit.Zero
? X
: Digit.Zero

/**
* `Last` is a type-level function that gets the last digit of a digit list.
Expand Down
4 changes: 2 additions & 2 deletions src/digit-list/pop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import { Type, Kind, DigitList } from '..'
export type _$pop<T extends DigitList.DigitList> = T extends []
? []
: T extends [...infer X, unknown]
? X
: []
? X
: []

/**
* `Pop` is a type-level function that removes the last digit from a digit list.
Expand Down
4 changes: 2 additions & 2 deletions src/digit-list/shift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { Type, Kind, DigitList } from '..'
export type _$shift<T extends DigitList.DigitList> = T extends []
? []
: T extends [unknown, ...infer X]
? X
: []
? X
: []

/**
* `Shift` is a type-level function that removes the first digit from a digit list.
Expand Down
4 changes: 2 additions & 2 deletions src/list/accumulate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export type _$accumulate<
RESULT extends Kind._$inputOf<F>[] = X extends []
? M
: ACC extends Kind._$inputOf<F>
? _$accumulate<F, REST, ACC, List._$push<ACC, M>>
: never
? _$accumulate<F, REST, ACC, List._$push<ACC, M>>
: never
> = 0 extends 1 ? never : RESULT

interface Accumulate_T2<
Expand Down
4 changes: 2 additions & 2 deletions src/list/at.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export type _$at<
? POS_ABS
: never
: DigitList._$compare<T_LENGTH, POS_ABS> extends -1
? never
: DigitList._$subtract<T_LENGTH, POS_ABS>,
? never
: DigitList._$subtract<T_LENGTH, POS_ABS>,
INDEX extends number = DigitList._$toNumber<POS_NORM>
> = POS_NORM extends never ? never : T[INDEX]

Expand Down
18 changes: 9 additions & 9 deletions src/list/iterate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export type _$iterate<
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
? _$iterate<
F,
O,
N,
NaturalNumber._$decrement<COUNT>,
List._$push<ACC, M>,
ACC
>
: never
> = 0 extends 1 ? never : RESULT

interface Iterate_T2<F extends Kind.Kind, N extends Number.Number>
Expand Down
8 changes: 4 additions & 4 deletions src/list/last.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { Type, Kind } from '..'
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<Tail>
: T extends [...unknown[], infer X]
? X
: T[number]

/**
* `Last` is a type-level function that returns the last element of a tuple.
Expand Down
4 changes: 2 additions & 2 deletions src/list/pair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export type _$pair<
> = T extends [infer X1, infer X2, ...infer Rest]
? _$pair<[X2, ...Rest], [...O, [X1, X2]]>
: number extends T['length']
? [T[number], T[number]][]
: O
? [T[number], T[number]][]
: O

/**
* `Pair` is a type-level function that generates a tuple of pairs from a tuple,
Expand Down
12 changes: 6 additions & 6 deletions src/list/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ type _$range2<
? true
: false
: NaturalNumber._$compare<START, STOP> extends -1 | 0
? true
: false,
? 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
? COUNT extends 0
? []
: RESULT
: never

/**
* `_$range` is a type-level function that generates a range of numbers.
Expand Down
26 changes: 14 additions & 12 deletions src/list/reduce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ export type _$reduce<
> = 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 & { readonly [Kind._]: Type._$cast<O, Kind._$inputOf<F>> })['f']
? $<
$<F, Type._$cast<O, Kind._$inputOf<F>>>,
Type._$cast<
H,
Kind._$inputOf<
Function._$returnType<
(F & {
readonly [Kind._]: Type._$cast<O, Kind._$inputOf<F>>
})['f']
>
>
>
>
> extends infer R
? _$reduce<F, T, R>
: never
: O
> extends infer R
? _$reduce<F, T, R>
: never
: O

interface Reduce_T2<F extends Kind.Kind<(x: never) => Kind.Kind>, X>
extends Kind.Kind {
Expand Down
8 changes: 4 additions & 4 deletions src/list/reverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ type _$reverse2<T extends unknown[], O extends unknown[] = []> = T extends [
? [...O, Last]
: _$reverse2<Init, [...O, Last]>
: T extends [infer Head, ...unknown[]]
? Head
: [...O, ...T]
? Head
: [...O, ...T]

/**
* `_$reverse` is a type-level function that reverses a tuple.
Expand All @@ -26,8 +26,8 @@ export type _$reverse<
> = T extends [infer Head, ...infer Tail]
? _$reverse<Tail, [Head, ...O]>
: T extends []
? O
: [..._$reverse2<T>, ...O]
? O
: [..._$reverse2<T>, ...O]

/**
* `Reverse` is a type-level function that reverses a tuple.
Expand Down
4 changes: 2 additions & 2 deletions src/list/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export type _$slice<
DigitList.DigitList = Number._$isNatural<START> extends true
? START_ABS
: DigitList._$compare<T_LENGTH, START_ABS> extends -1
? [Digit.Zero]
: DigitList._$subtract<T_LENGTH, START_ABS>,
? [Digit.Zero]
: DigitList._$subtract<T_LENGTH, START_ABS>,
POP_NORM extends DigitList.DigitList = Number._$isNatural<END> extends true
? DigitList._$compare<T_LENGTH, END_ABS> extends -1
? [Digit.Zero]
Expand Down
8 changes: 6 additions & 2 deletions src/list/some.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ export type _$some<
> = 0 extends 1
? never
: T extends [infer Head, ...infer Rest]
? _$some<F, Rest, Boolean._$or<O, $<F, Type._$cast<Head, Kind._$inputOf<F>>>>>
: O
? _$some<
F,
Rest,
Boolean._$or<O, $<F, Type._$cast<Head, Kind._$inputOf<F>>>>
>
: O

interface Some_T<T extends Kind.Kind<(x: never) => boolean>> extends Kind.Kind {
f(x: Type._$cast<this[Kind._], Kind._$inputOf<T>[]>): _$some<T, typeof x>
Expand Down
52 changes: 26 additions & 26 deletions src/list/splice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,38 @@ type _$splice2<
DigitList.DigitList = Number._$isNatural<START> extends true
? START_ABS
: DigitList._$compare<T_LENGTH, START_ABS> extends -1
? [Digit.Zero]
: DigitList._$subtract<T_LENGTH, START_ABS>,
? [Digit.Zero]
: DigitList._$subtract<T_LENGTH, START_ABS>,
RESULT extends List.List = DigitList._$compare<
START_NORM,
NaturalNumber._$toList<T['length']>
> extends 1 | 0
? List._$concat<INSERTS, T>
: DEL_COUNT extends [Digit.Zero]
? START_NORM extends [Digit.Zero]
? [...PRE, ...INSERTS, ...POST]
: _$splice2<
T,
DigitList._$toNumber<DigitList._$decrement<START_NORM>>,
[Digit.Zero],
INSERTS,
List._$push<POST[0], PRE>,
List._$shift<POST>
>
: START_NORM extends [Digit.Zero]
? [
...PRE,
...INSERTS,
...List._$shiftN<POST, DigitList._$toNumber<DEL_COUNT>>
]
: _$splice2<
T,
DigitList._$toNumber<DigitList._$decrement<START_NORM>>,
DEL_COUNT,
INSERTS,
List._$push<POST[0], PRE>,
List._$shift<POST>
>
? START_NORM extends [Digit.Zero]
? [...PRE, ...INSERTS, ...POST]
: _$splice2<
T,
DigitList._$toNumber<DigitList._$decrement<START_NORM>>,
[Digit.Zero],
INSERTS,
List._$push<POST[0], PRE>,
List._$shift<POST>
>
: START_NORM extends [Digit.Zero]
? [
...PRE,
...INSERTS,
...List._$shiftN<POST, DigitList._$toNumber<DEL_COUNT>>
]
: _$splice2<
T,
DigitList._$toNumber<DigitList._$decrement<START_NORM>>,
DEL_COUNT,
INSERTS,
List._$push<POST[0], PRE>,
List._$shift<POST>
>
> = RESULT

/**
Expand Down
4 changes: 2 additions & 2 deletions src/list/times.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type _$times2<
> = 0 extends 1
? never
: COUNTER extends ['0']
? STATE
: _$times2<DEC, [DEC_NUM, ...STATE]>
? STATE
: _$times2<DEC, [DEC_NUM, ...STATE]>

/**
* `_$times` is a type-level function that generates a list of numbers from 0 to N-1.
Expand Down
4 changes: 2 additions & 2 deletions src/list/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export type _$zip<
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>>
? ACC
: _$zip<T, NaturalNumber._$increment<IDX>, List._$push<CURR, ACC>>
> = RESULT

/**
Expand Down
Loading

0 comments on commit 02e7e80

Please sign in to comment.