{"name":"typescript-tuple","version":"5.0.0","description":"Generics to work with tuples in TypeScript","main":"index.js","scripts":{"build":"pnpm run lint && tsc","clean":"clean-typescript-build .","lint":"tslint -p .","lint:fix":"pnpm run lint -- --fix","test:types":"tsc --noEmit","prepublishOnly":"pnpm run build","postpublish":"pnpm run clean","test":"pnpm run lint && pnpm run test:types"},"repository":{"type":"git","url":"git+https://github.com/ksxnodemodules/typescript-tuple.git"},"keywords":["generic","tuple","typescript"],"author":{"name":"Hoàng Văn Khải","email":"hvksmr1996@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/ksxnodemodules/typescript-tuple/issues"},"homepage":"https://github.com/ksxnodemodules/typescript-tuple#readme","dependencies":{"typescript-compare":"^0.0.2"},"devDependencies":{"typescript":"~4.1.2","tslint":"^6.1.3","tslint-config-standard":"^9.0.0","static-type-assert":"^4.0.1","toolcheck":"^0.1.4","clean-typescript-build":"^0.1.5"},"gitHead":"e33aad12d1ac0db4ae7b67f5d5693e2ec499c19a","_id":"typescript-tuple@5.0.0","_nodeVersion":"15.2.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-aphr8IRlcPIDwdUg4ONQuLLaojd4F47ADYoBqKAJ2bpqqKrD8w4tznBOZ5Nqjm+WWqLvj9YBxnWeFYpohMyCvg==","shasum":"d3c7d72f4212acd190705c8c40b1bae7ae040af6","tarball":"http://registry-npm.ywwl.com/typescript-tuple/download/typescript-tuple-5.0.0.tgz","fileCount":11,"unpackedSize":42435,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfvvhICRA9TVsSAnZWagAAKAwQAIgj0gOUjS+k5CIoA+Lf\nvoDR8wpq31S9NSQdKkHmcO3ivOcZjGUSzoAzQ7PqIqb9uCW9gGeOwc3wnjTQ\nTSIv8nhJAwYGIAMkLtbwi7q5UvFHr7p12mQdppNw9Zc0E2m+YDxEWnEBEB/D\njR597WzL0tYx3SJR9jp7vrFjIb4Y7wDbRp2lvz6We6RqEkHtRkm7sPNNld5k\nt+uEB0OhZa8s9l+yFQsIDqywCCbbB/TArYWC+1JMgvNNplF7yTGjWy5rvj5u\nA/d5fqtPBjgCS1glSgWSyrf6OQ1JfKYzKHdXgAJWTnk/J6LMofpg6uQqi0uw\nq+n2NXoGkZYaZ3K0E4Q7S4IbCDN28PLAxWM7xjWlWJW660dN56DrFcxww1V6\nFvprMWnsPNY6zniGypkMkYl1hzH6EBL29oMcXCaIyBenBcvx/0GWw3OxEFVz\ndq9GYZ8zGtEnWgy7RsExhIUK9dBIxuIK9sCNLLZCEGYzXmLVCNIQWsK+g49p\nEyrACbRddP5c6FqTCfbtwdauCzlWKPAVIFR8ncnu6j1baFXJ6EDSZBSLA6KW\n2Y0pd8atiOKt/+yh1zTRXfNNvOak4EVhRRn0X5UWWdgAuQbUnzIbbmCvcNiF\n4Xq1pBu2bTioLd1L3HpgMRv0ry53i391PB95QJSsH/Fo4yRZGYKW2WbeccJw\nGfJE\r\n=Zqeb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGA8RciM1jCXCon1E1RGn0hqIlJzFSwuxzHTM3eRIPXyAiEA7YX7DwEigemtupz4toOGgkci9TwGpwlU7uCXuv88KDY="}],"size":14598,"noattachment":false,"key":"/typescript-tuple/-/typescript-tuple-5.0.0.tgz"},"_npmUser":{"name":"khai96_","email":"hvksmr1996@gmail.com"},"directories":{},"maintainers":[{"name":"khai96_","email":"hvksmr1996@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typescript-tuple_5.0.0_1606350920039_0.4939886391306225"},"_hasShrinkwrap":false,"readme":"# TypeScript Tuple\n\nGenerics to work with tuples in TypeScript\n\n## Requirements\n\n* TypeScript ≥ 4.1.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### `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### `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### `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### `FilterTuple`\n\n```typescript\nimport { FilterTuple } from 'typescript-tuple'\n\ntype Foo = FilterTuple<[1, '1'], number> // Expect: [1]\nconst foo: Foo = [1]\n\ntype Bar = FilterTuple<[1, '1', null, true], 1 | '1' | true> // Expect: [1, '1', true]\nconst bar: Bar = [1, '1', true]\n```\n\n## License\n\n[MIT](https://git.io/fA2d9) @ [Hoàng Văn Khải](https://github.com/KSXGitHub)\n","publish_time":1606350920211,"_cnpm_publish_time":1606350920211,"dist-tags":{"latest":"5.0.1","prerelease":"5.0.0-rc.0","rc":"5.0.0-rc.0"}}