{"bugs":{"url":"https://github.com/ksxnodemodules/typescript-tuple/issues"},"dist":{"shasum":"b58bec6a3cbc029d451f433dec7d62de4661d782","tarball":"https://registry.npmjs.org/typescript-tuple/-/typescript-tuple-3.0.0-rc.0.tgz","fileCount":9,"integrity":"sha512-IfoXOpaar7sa18IRm4dUI/GvfSGR6ZSNW2jqKvXZMlYDk94APxSKIZNXa9SVt/YVnRO2jWTEDeOWleofK4o2ug==","signatures":[{"sig":"MEUCIFNQVRic/hTD/Cyig936Maz22Y8Zf/1d66PRHqzxuubdAiEAn9FXzXY9u+afn4n6AkEmNMNjueO15n4RSHJo4+V4Qdc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":32260,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcf37pCRA9TVsSAnZWagAAJGYQAJjrJJXw9DyHgDZyRybi\nIv3S75VLystTB9lyJ9gy7oLdHMEdofUR+7itHKtumkVm4N6Oy8Ns5k987q5n\nqdIPjSVy0O5GG2Dk48uj3wyZD8/f84J9YnsBsPuNagNS2Zmt/6vakU6wDz9J\nBV6h6nrxmjVVsdTFKsr362gzoiAmkka+iCKPOuFyNP4XKB7Emn7p75YTNWcB\nHq14kQ83BhPLVMWL2dsFnwpjt9kp2cuEKC4nEp49gPGl3BBwfLWVLbCMsINj\npUbsRaeF2NW/HILIw4M6NNfelTgLjZagyghHSZRJ9l57w53Xkpl56ytG/GkC\nLfLbwNW7IUr0rxoLEuzStqIeifTkE2kWVefId4PUSBdyliEMAqxXegNH8WD5\nZU+Cyh2PYOQ5cinbGceMH0lbth4m3NzEAP6g58Jqm4PEH+ZsHO8DGgctnCAC\nCommUin9W8jDqcS+q3PNGlmVgL/SmISXV4FbVIrkV6mQAnsayieF+sfFWUq+\nKPAKqM8jS5mw3C3dJRiAK0wAy86vsqGX88I3qgcqoCGLSo6OZ2WHMNqV4BmM\nHSmmPwAwW0kyDhOOBFc5EuTX7IslX82EGhoxHNzHo+Qam0ZdxvhJXZXZSz7C\nAIJxXaV7CgQOmaB1C49rzfVNfx0zBFt1ES+1xoMj1fvEdFqBar0wFscbSHHm\nDnKY\r\n=ktsh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","name":"typescript-tuple","author":{"name":"Hoàng Văn Khải","email":"hvksmr1996@gmail.com"},"readme":"# TypeScript Tuple\n\nGenerics to work with tuples in TypeScript\n\n## Requirements\n\n* TypeScript ≥ 3.0.0\n\n## Usage\n\n### `IsFinite`\n\n```typescript\nimport { IsFinite } from 'typescript-tuple'\n\ntype Foo = IsFinite<[0, 1, 2]> // Expect: true\nconst foo: Foo = true\n\ntype Bar = IsFinite<[0, 1, 2, ...number[]]> // Expect: false\nconst bar: Bar = false\n\ntype Baz = IsFinite<[0, 1, 2], 'finite', 'infinite'> // Expect: 'finite'\nconst baz: Baz = 'finite'\n```\n\n### `SplitInfiniteTuple`\n\n```typescript\nimport { SplitInfiniteTuple } from 'typescript-tuple'\ntype Foo = SplitInfiniteTuple<[0, 1, 2, ...number[]]> // Expect: [[0, 1, 2], number[]]\ntype FinitePart = Foo[0] // Expect: [0, 1, 2]\ntype InfinitePart = Foo[1] // Expect: number[]\nconst foo: Foo = [[0, 1, 2], Array<number>()]\nconst finitePart: FinitePart = [0, 1, 2]\nconst infinitePart: InfinitePart = Array<number>()\n```\n\n### `First`\n\n```typescript\nimport { First } from 'typescript-tuple'\ntype Foo = First<['a', 'b', 'c']> // Expect: 'a'\nconst foo: Foo = 'a'\n```\n\n### `Last`\n\n```typescript\nimport { Last } from 'typescript-tuple'\ntype Foo = Last<['a', 'b', 'c']> // Expect: 'c'\nconst foo: Foo = 'c'\n```\n\n### `Tail`\n\n```typescript\nimport { Tail } from 'typescript-tuple'\ntype Foo = Tail<['a', 'b', 'c']> // Expect: ['b', 'c']\nconst foo: Foo = ['b', 'c']\n```\n\n### `FirstIndexEqual`\n\n```typescript\nimport { FirstIndexEqual } from 'typescript-tuple'\n\ntype Foo = FirstIndexEqual<'x', ['a', 'x', 'b', 'x']> // Expect: 1\nconst foo: Foo = 1\n\ntype Bar = FirstIndexEqual<'x', ['a', 'b']> // Expect: never\n\ntype Baz = FirstIndexEqual<'x', ['a', 'b'], 'not found'> // Expect: 'not found'\nconst baz: Baz = 'not found'\n```\n\n### `FirstIndexSubset`\n\n```typescript\nimport { FirstIndexSubset } from 'typescript-tuple'\n\ntype Foo = FirstIndexSubset<string, [0, 'a', 1, 'b']> // Expect: 1\nconst foo: Foo = 1\n\ntype Bar = FirstIndexSubset<string, [0, 1]> // Expect: never\n\ntype Baz = FirstIndexSubset<string, [0, 1], 'not found'> // Expect: 'not found'\nconst baz: Baz = 'not found'\n```\n\n### `FirstIndexSuperset`\n\n```typescript\nimport { FirstIndexSuperset } from 'typescript-tuple'\n\ntype Foo = FirstIndexSuperset<'x', [number, string, 0 | 1, 'x' | 'y']> // Expect: 1\nconst foo: Foo = 1\n\ntype Bar = FirstIndexSuperset<'x', [number, 0 | 1]> // Expect: never\n\ntype Baz = FirstIndexSuperset<'x', [number, 0 | 1], 'not found'> // Expect: 'not found'\nconst baz: Baz = 'not found'\n```\n\n### `LastIndexEqual`\n\n```typescript\nimport { LastIndexEqual } from 'typescript-tuple'\n\ntype Foo = LastIndexEqual<'x', ['a', 'x', 'b', 'x']> // Expect: 3\nconst foo: Foo = 3\n\ntype Bar = LastIndexEqual<'x', ['a', 'b']> // Expect: never\n\ntype Baz = LastIndexEqual<'x', ['a', 'b'], 'not found'> // Expect: 'not found'\nconst baz: Baz = 'not found'\n```\n\n### `LastIndexSubset`\n\n```typescript\nimport { LastIndexSubset } from 'typescript-tuple'\n\ntype Foo = LastIndexSubset<string, [0, 'a', 1, 'b']> // Expect: 3\nconst foo: Foo = 3\n\ntype Bar = LastIndexSubset<string, [0, 1]> // Expect: never\n\ntype Baz = LastIndexSubset<string, [0, 1], 'not found'> // Expect: 'not found'\nconst baz: Baz = 'not found'\n```\n\n### `LastIndexSuperset`\n\n```typescript\nimport { LastIndexSuperset } from 'typescript-tuple'\n\ntype Foo = LastIndexSuperset<'x', [number, string, 0 | 1, 'x' | 'y']> // Expect: 3\nconst foo: Foo = 3\n\ntype Bar = LastIndexSuperset<'x', [number, 0 | 1]> // Expect: never\n\ntype Baz = LastIndexSuperset<'x', [number, 0 | 1], 'not found'> // Expect: 'not found'\nconst baz: Baz = 'not found'\n```\n\n### `AllIndexesEqual`\n\n```typescript\nimport { AllIndexesEqual } from 'typescript-tuple'\n\ntype Foo = AllIndexesEqual<'x', ['a', 'x', 'b', 'x']> // Expect: [1, 3]\nconst foo: Foo = [1, 3]\n\ntype Bar = AllIndexesEqual<'x', ['a', 'x', 'b', ...'x'[]]> // Expect: [1, ...3[]]\nconst bar: Bar = [1, 3, 3, 3, 3]\n```\n\n### `AllIndexesSubset`\n\n```typescript\nimport { AllIndexesSubset } from 'typescript-tuple'\n\ntype Foo = AllIndexesSubset<string, [0, 'a', 1, 'b']> // Expect: [1, 3]\nconst foo: Foo = [1, 3]\n\ntype Bar = AllIndexesSubset<string, [0, 'a', 1, ...'b'[]]> // Expect: [1, ...3[]]\nconst bar: Bar = [1, 3, 3, 3, 3]\n```\n\n### `AllIndexesSuper`\n\n```typescript\nimport { AllIndexesSuper } from 'typescript-tuple'\n\ntype Foo = AllIndexesSuper<'x', [number, string, 0 | 1, 'x' | 'y']> // Expect: [1, 3]\nconst foo: Foo = [1, 3]\n\ntype Bar = AllIndexesSuper<'x', [number, string, 0 | 1, ...'x'[]]> // Expect: [1, ...3[]]\nconst bar: Bar = [1, 3, 3, 3, 3]\n```\n\n### `Append`\n\n```typescript\nimport { Append } from 'typescript-tuple'\ntype Foo = Append<['a', 'b', 'c'], 'x'> // Expect: ['a', 'b', 'c', 'x']\nconst foo: Foo = ['a', 'b', 'c', 'x']\n```\n\n### `Prepend`\n\n```typescript\nimport { Prepend } from 'typescript-tuple'\ntype Foo = Prepend<['a', 'b', 'c'], 'x'> // Expect: ['x', 'a', 'b', 'c']\nconst foo: Foo = ['x', 'a', 'b', 'c']\n```\n\n### `Reverse`\n\n```typescript\nimport { Reverse } from 'typescript-tuple'\ntype Foo = Reverse<['a', 'b', 'c']> // Expect: ['c', 'b', 'a']\nconst foo: Foo = ['c', 'b', 'a']\n```\n\n### `Concat`\n\n```typescript\nimport { Concat } from 'typescript-tuple'\ntype Foo = Concat<['a', 'b', 'c'], [0, 1, 2]> // Expect ['a', 'b', 'c', 0, 1, 2]\nconst foo: Foo = ['a', 'b', 'c', 0, 1, 2]\n```\n\n### `Repeat`\n\n```typescript\nimport { Repeat } from 'typescript-tuple'\n\n// Basic\ntype Foo = Repeat<'x', 5> // Expect ['x', 'x', 'x', 'x', 'x']\nconst foo: Foo = ['x', 'x', 'x', 'x', 'x']\n\n// Using union\ntype Bar = Repeat<'x', 1 | 3 | 4> // Expect ['x'] | ['x', 'x', 'x'] | ['x', 'x', 'x', 'x']\nconst bar1: Bar = ['x']\nconst bar3: Bar = ['x', 'x', 'x']\nconst bar4: Bar = ['x', 'x', 'x', 'x']\n\n// Using ambiguous 'number' type\ntype Baz = Repeat<'x', number> // Expect 'x'[]\nconst baz: Baz = Array<number>()\n```\n\n**NOTES:**\n\n* Due to TypeScript design limitations, using floating point numbers and negative numbers might lead to infinite loop within TSC compiler, avoid doing this.\n\n### `ConcatMultiple`\n\n```typescript\nimport { ConcatMultiple } from 'typescript-tuple'\ntype Foo = ConcatMultiple<[[], ['a'], ['b', 'c']]> // Expect ['a', 'b', 'c']\nconst foo: Foo = ['a', 'b', 'c']\n```\n\n### `Drop`\n\n```typescript\nimport { Drop } from 'typescript-tuple'\n\ntype Foo = Drop<[0, 1, 2, 3, 4], 2> // Expect [2, 3, 4]\nconst foo: Foo = [2, 3, 4]\n\ntype Bar = Drop<[0, 1, 2, 3, 4, ...number[]], 2> // Expect [2, 3, 4, ...number[]]\nconst bar: Bar = [2, 3, 4]\n\ntype Baz = Drop<[0, 1, 2, 3, 4], 10> // Expect []\nconst baz: Baz = [2, 3, 4]\n\ntype Qux = Drop<[0, 1, 2, 3, 4, ...number[]], 10> // Expect number[]\nconst qux: Qux = [2, 3, 4]\n```\n\n### `SliceStartQuantity`\n\n```typescript\nimport { SliceStartQuantity } from 'typescript-tuple'\ntype Foo = SliceStartQuantity<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 2, 4> // Expect [2, 3, 4, 5]\nconst foo: Foo = [2, 3, 4, 5]\n```\n\n### `SingleTupleSet`\n\n```typescript\nimport { SingleTupleSet } from 'typescript-tuple'\n\ntype Foo = SingleTupleSet<[0, 1, 2]> // Expect [[0], [1], [2]]\nconst foo: Foo = [[0], [1], [2]]\n\ntype Bar = SingleTupleSet<'x'[]> // Expect ['x'][]\nconst bar: Bar = Array<['x']>()\n```\n\n### `FillTuple`\n\n```typescript\nimport { FillTuple } from 'typescript-tuple'\ntype Foo = FillTuple<[0, 1, 2, 3], 'r'>\nconst foo: Foo = ['r', 'r', 'r', 'r']\n```\n\n### `CompareLength`\n\n```typescript\nimport { CompareLength } from 'typescript-tuple'\n\ntype Foo = CompareLength<[0, 1, 2], ['a', 'b', 'c']> // Expect: 'equal'\nconst foo: Foo = 'equal'\n\ntype Bar = CompareLength<[0, 1], ['a', 'b', 'c', 'd']> // Expect: 'shorterLeft'\nconst bar: Bar = 'shorterLeft'\n\ntype Baz = CompareLength<[0, 1, 2, 3], ['a', 'b']> // Expect: 'shorterRight'\nconst baz: Baz = 'shorterRight'\n```\n\n### `SortTwoTuple`\n\n```typescript\nimport { SortTwoTuple } from 'typescript-tuple'\n\ntype Foo = SortTwoTuple<[0, 1], ['a', 'b', 'c', 'd']> // Expect: [[0, 1], ['a', 'b', 'c', 'd']]\nconst foo: Foo = [[0, 1], ['a', 'b', 'c', 'd']]\n\ntype Bar = SortTwoTuple<[0, 1, 2, 3], ['a', 'b']> // Expect: [['a', 'b'], [0, 1, 2, 3]]\nconst bar: Bar = [['a', 'b'], [0, 1, 2, 3]]\n\ntype Baz = SortTwoTuple<[0, 1, 2], ['a', 'b', 'c', 'd']> // Expect: [[0, 1, 2], ['a', 'b', 'c']]\nconst baz: Baz = [[0, 1], 3, ['a', 'b', 'c']]\n\ntype Qux = SortTwoTuple<[0, 1, 2], ['a', 'b', 'c', 'd'], 'EQUAL'> // Expect: 'EQUAL'\nconst qux: Qux = 'EQUAL'\n```\n\n### `ShortestTuple`\n\n```typescript\nimport { ShortestTuple } from 'typescript-tuple'\n\ntype Foo = ShortestTuple<[[0, 1, 2], [false, true], ['a', 'b', 'c', 'd']]> // Expect: [false, true]\nconst foo: Foo = [false, true]\n\ntype Bar = ShortestTuple<[[0, 1, 2], ['a', 'b', 'c'], ...[false, true][]]> // Expect: [false, true]\nconst bar: Bar = [false, true]\n```\n\n### `LongestTuple`\n\n```typescript\nimport { LongestTuple } from 'typescript-tuple'\n\ntype Foo = LongestTuple<[[0, 1, 2, 3], [false, true], ['a']]> // Expect: [0, 1, 2, 3]\nconst foo: Foo = [0, 1, 2, 3]\n\ntype Bar = LongestTuple<[[], [false, true], ...[0, 1, 2][]]> // Expect: [0, 1, 2]\nconst bar: Bar = [0, 1, 2]\n```\n\n## License\n\n[MIT](https://git.io/fA2d9) @ [Hoàng Văn Khải](https://github.com/KSXGitHub)\n","gitHead":"7e976afc29a23bd4fc0d9e8c0d22bb7fe9384ede","license":"MIT","scripts":{"lint":"tslint -p .","test":"pnpm run lint && pnpm run test:types","build":"pnpm run lint && tsc","clean":"clean-typescript-build .","lint:fix":"pnpm run lint -- --fix","test:types":"tsc --noEmit","postpublish":"pnpm run clean","prepublishOnly":"pnpm run build"},"_npmUser":{"name":"khai96_","email":"hvksmr1996@gmail.com"},"homepage":"https://github.com/ksxnodemodules/typescript-tuple#readme","keywords":["generic","tuple","typescript"],"repository":{"url":"git+https://github.com/ksxnodemodules/typescript-tuple.git","type":"git"},"_npmVersion":"6.7.0","description":"Generics to work with tuples in TypeScript","directories":{},"maintainers":[{"name":"khai96_","email":"hvksmr1996@gmail.com"}],"_nodeVersion":"11.10.1","dependencies":{"typescript-compare":"^0.0.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tslint":"^5.11.0","toolcheck":"^0.0.5","typescript":"^3.1.1","static-type-assert":"^3.0.0","clean-typescript-build":"^0.1.0","tslint-config-standard":"^8.0.1"},"_npmOperationalInternal":{"tmp":"tmp/typescript-tuple_3.0.0-rc.0_1551859432855_0.3532406691401597","host":"s3://npm-registry-packages"},"_id":"typescript-tuple@3.0.0-rc.0","version":"3.0.0-rc.0"}