Skip to content

NaturalNumber

Michael Poteat edited this page Feb 27, 2023 · 3 revisions

hkt-toolbelt / NaturalNumber

Namespace: NaturalNumber

Interfaces

Type Aliases

_$add

Ƭ _$add<A, B, A_LIST, B_LIST, SUM_LIST, SUM>: SUM

Type parameters

Name Type
A extends Number
B extends Number
A_LIST extends DigitList = _$toList<A>
B_LIST extends DigitList = _$toList<B>
SUM_LIST extends DigitList = _$add<A_LIST, B_LIST>
SUM _$fromString<_$toString<SUM_LIST>>

Defined in

natural-number/add.ts:3


_$compare

Ƭ _$compare<A, B, A_LIST, B_LIST, RESULT>: RESULT

Type parameters

Name Type
A extends Number
B extends Number
A_LIST extends DigitList = _$toList<A>
B_LIST extends DigitList = _$toList<B>
RESULT extends -1 | 0 | 1 = _$compare<A_LIST, B_LIST>

Defined in

natural-number/compare.ts:3


_$decrement

Ƭ _$decrement<A, A_LIST, DECREMENT, RESULT>: RESULT

Type parameters

Name Type
A extends Number
A_LIST extends DigitList = _$toList<A>
DECREMENT extends DigitList = _$decrement<A_LIST>
RESULT extends Number = _$fromString<_$toString<DECREMENT>>

Defined in

natural-number/decrement.ts:3


_$divide

Ƭ _$divide<A, B, A_LIST, B_LIST, QUOTIENT_LIST, QUOTIENT>: QUOTIENT

Type parameters

Name Type
A extends Number
B extends Number
A_LIST extends DigitList = _$toList<A>
B_LIST extends DigitList = _$toList<B>
QUOTIENT_LIST extends DigitList = _$divide<A_LIST, B_LIST>
QUOTIENT _$fromString<_$toString<QUOTIENT_LIST>>

Defined in

natural-number/divide.ts:3


_$increment

Ƭ _$increment<A, A_LIST, INCREMENT, RESULT>: RESULT

Type parameters

Name Type
A extends Number
A_LIST extends DigitList = _$toList<A>
INCREMENT extends DigitList = _$increment<A_LIST>
RESULT extends Number = _$fromString<_$toString<INCREMENT>>

Defined in

natural-number/increment.ts:3


_$isEven

Ƭ _$isEven<T, LIST, RESULT>: RESULT

Type parameters

Name Type
T extends Number
LIST extends DigitList = _$toList<T>
RESULT _$isEven<LIST>

Defined in

natural-number/is-even.ts:3


_$isOdd

Ƭ _$isOdd<T, LIST, RESULT>: RESULT

Type parameters

Name Type
T extends Number
LIST extends DigitList = _$toList<T>
RESULT _$isOdd<LIST>

Defined in

natural-number/is-odd.ts:3


_$modulo

Ƭ _$modulo<A, B, A_LIST, B_LIST, MODULUS_LIST, MODULUS>: MODULUS

Type parameters

Name Type
A extends Number
B extends Number
A_LIST extends DigitList = _$toList<A>
B_LIST extends DigitList = _$toList<B>
MODULUS_LIST extends DigitList = _$modulo<A_LIST, B_LIST>
MODULUS _$fromString<_$toString<MODULUS_LIST>>

Defined in

natural-number/modulo.ts:3


_$multiply

Ƭ _$multiply<A, B, A_LIST, B_LIST, PRODUCT_LIST, PRODUCT>: PRODUCT

Type parameters

Name Type
A extends Number
B extends Number
A_LIST extends DigitList = _$toList<A>
B_LIST extends DigitList = _$toList<B>
PRODUCT_LIST extends DigitList = _$multiply<A_LIST, B_LIST>
PRODUCT _$fromString<_$toString<PRODUCT_LIST>>

Defined in

natural-number/multiply.ts:3


_$subtract

Ƭ _$subtract<A, B, A_LIST, B_LIST, SUB_LIST, RESULT>: RESULT

Type parameters

Name Type
A extends Number
B extends Number
A_LIST extends DigitList = _$toList<A>
B_LIST extends DigitList = _$toList<B>
SUB_LIST extends DigitList = _$subtract<A_LIST, B_LIST>
RESULT _$fromString<_$toString<SUB_LIST>>

Defined in

natural-number/subtract.ts:3


_$toList

Ƭ _$toList<S, O>: _$toString<S> extends `${infer Head}${infer Tail}` ? _$toList<Tail, [...O, Head]> : O extends DigitList ? O : ["0"]

Type parameters

Name Type
S extends Number
O extends string[] = []

Defined in

natural-number/to-list.ts:3

Clone this wiki locally