rambda
Version:
Lightweight faster alternative to Ramda
112 lines (109 loc) • 4.15 kB
text/typescript
import {Number} from '../Number/Number'
/** Describes a map of number relationships
* (Generated with "./_Internal/IterationOfGenerator")
*/
export type IterationMap = {
'-40': ['__', '-39', '-40', -40, '-'],
'-39': ['-40', '-38', '-39', -39, '-'],
'-38': ['-39', '-37', '-38', -38, '-'],
'-37': ['-38', '-36', '-37', -37, '-'],
'-36': ['-37', '-35', '-36', -36, '-'],
'-35': ['-36', '-34', '-35', -35, '-'],
'-34': ['-35', '-33', '-34', -34, '-'],
'-33': ['-34', '-32', '-33', -33, '-'],
'-32': ['-33', '-31', '-32', -32, '-'],
'-31': ['-32', '-30', '-31', -31, '-'],
'-30': ['-31', '-29', '-30', -30, '-'],
'-29': ['-30', '-28', '-29', -29, '-'],
'-28': ['-29', '-27', '-28', -28, '-'],
'-27': ['-28', '-26', '-27', -27, '-'],
'-26': ['-27', '-25', '-26', -26, '-'],
'-25': ['-26', '-24', '-25', -25, '-'],
'-24': ['-25', '-23', '-24', -24, '-'],
'-23': ['-24', '-22', '-23', -23, '-'],
'-22': ['-23', '-21', '-22', -22, '-'],
'-21': ['-22', '-20', '-21', -21, '-'],
'-20': ['-21', '-19', '-20', -20, '-'],
'-19': ['-20', '-18', '-19', -19, '-'],
'-18': ['-19', '-17', '-18', -18, '-'],
'-17': ['-18', '-16', '-17', -17, '-'],
'-16': ['-17', '-15', '-16', -16, '-'],
'-15': ['-16', '-14', '-15', -15, '-'],
'-14': ['-15', '-13', '-14', -14, '-'],
'-13': ['-14', '-12', '-13', -13, '-'],
'-12': ['-13', '-11', '-12', -12, '-'],
'-11': ['-12', '-10', '-11', -11, '-'],
'-10': ['-11', '-9', '-10', -10, '-'],
'-9' : ['-10', '-8', '-9', -9, '-'],
'-8' : ['-9', '-7', '-8', -8, '-'],
'-7' : ['-8', '-6', '-7', -7, '-'],
'-6' : ['-7', '-5', '-6', -6, '-'],
'-5' : ['-6', '-4', '-5', -5, '-'],
'-4' : ['-5', '-3', '-4', -4, '-'],
'-3' : ['-4', '-2', '-3', -3, '-'],
'-2' : ['-3', '-1', '-2', -2, '-'],
'-1' : ['-2', '0', '-1', -1, '-'],
'0' : ['-1', '1', '0', 0, '0']
'1' : ['0', '2', '1', 1, '+'],
'2' : ['1', '3', '2', 2, '+'],
'3' : ['2', '4', '3', 3, '+'],
'4' : ['3', '5', '4', 4, '+'],
'5' : ['4', '6', '5', 5, '+'],
'6' : ['5', '7', '6', 6, '+'],
'7' : ['6', '8', '7', 7, '+'],
'8' : ['7', '9', '8', 8, '+'],
'9' : ['8', '10', '9', 9, '+'],
'10' : ['9', '11', '10', 10, '+'],
'11' : ['10', '12', '11', 11, '+'],
'12' : ['11', '13', '12', 12, '+'],
'13' : ['12', '14', '13', 13, '+'],
'14' : ['13', '15', '14', 14, '+'],
'15' : ['14', '16', '15', 15, '+'],
'16' : ['15', '17', '16', 16, '+'],
'17' : ['16', '18', '17', 17, '+'],
'18' : ['17', '19', '18', 18, '+'],
'19' : ['18', '20', '19', 19, '+'],
'20' : ['19', '21', '20', 20, '+'],
'21' : ['20', '22', '21', 21, '+'],
'22' : ['21', '23', '22', 22, '+'],
'23' : ['22', '24', '23', 23, '+'],
'24' : ['23', '25', '24', 24, '+'],
'25' : ['24', '26', '25', 25, '+'],
'26' : ['25', '27', '26', 26, '+'],
'27' : ['26', '28', '27', 27, '+'],
'28' : ['27', '29', '28', 28, '+'],
'29' : ['28', '30', '29', 29, '+'],
'30' : ['29', '31', '30', 30, '+'],
'31' : ['30', '32', '31', 31, '+'],
'32' : ['31', '33', '32', 32, '+'],
'33' : ['32', '34', '33', 33, '+'],
'34' : ['33', '35', '34', 34, '+'],
'35' : ['34', '36', '35', 35, '+'],
'36' : ['35', '37', '36', 36, '+'],
'37' : ['36', '38', '37', 37, '+'],
'38' : ['37', '39', '38', 38, '+'],
'39' : ['38', '40', '39', 39, '+'],
'40' : ['39', '__', '40', 40, '+'],
'__' : ['__', '__', string, number, '-' | '0' | '+']
}
/** Transform a number into an **`Iteration`**
* (to use **`Prev`**, **`Next`**, & **`Pos`**)
* @param N to transform
* @returns **`Iteration`**
* @example
* ```ts
* import {I} from 'ts-toolbelt'
*
* type i = I.IterationOf<'0'> // ["-1", "1", "0", 0, "0"]
*
* type next = I.Next<i> // ["0", "2", "1", 1, "+"]
* type prev = I.Prev<i> // ["-2", "0", "-1", -1, "-"]
*
* type nnext = I.Pos<next> // +1
* type nprev = I.Pos<prev> // -1
* ```
*/
export type IterationOf<N extends Number> =
N extends keyof IterationMap
? IterationMap[N]
: IterationMap['__']