main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
640 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { IterationMap } from './Iteration';
|
---|
| 2 | /**
|
---|
| 3 | * Transform a number into an [[Iteration]]
|
---|
| 4 | * (to use [[Prev]], [[Next]], & [[Pos]])
|
---|
| 5 | * @param N to transform
|
---|
| 6 | * @returns [[Iteration]]
|
---|
| 7 | * @example
|
---|
| 8 | * ```ts
|
---|
| 9 | * import {I} from 'ts-toolbelt'
|
---|
| 10 | *
|
---|
| 11 | * type i = I.IterationOf<0> // ["-1", "1", "0", 0, "0"]
|
---|
| 12 | *
|
---|
| 13 | * type next = I.Next<i> // ["0", "2", "1", 1, "+"]
|
---|
| 14 | * type prev = I.Prev<i> // ["-2", "0", "-1", -1, "-"]
|
---|
| 15 | *
|
---|
| 16 | * type nnext = I.Pos<next> // +1
|
---|
| 17 | * type nprev = I.Pos<prev> // -1
|
---|
| 18 | * ```
|
---|
| 19 | */
|
---|
| 20 | export declare type IterationOf<N extends number> = `${N}` extends keyof IterationMap ? IterationMap[`${N}`] : IterationMap['__'];
|
---|
Note:
See
TracBrowser
for help on using the repository browser.