Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typescript-tuple

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-tuple - npm Package Compare versions

Comparing version 3.0.0-rc to 3.0.0-rc.0

7

lib/index.d.ts

@@ -119,2 +119,9 @@ import * as utils from './utils';

/**
* Drop `Quantity` first elements of a tuple
* @example Drop<['a', 'b', 'c', 'd', 'e'], 2> → ['c', 'd', 'e']
* @example Drop<['a', 'b', 'c', 'd', 'e', ...string[]], 2> → ['c', 'd', 'e', ...string[]]
* @example Drop<['a', 'b', 'c', 'd', 'e', ...string[]], 10> → string[]
*/
export declare type Drop<Tuple extends any[], Quantity extends number> = utils.Drop<Tuple, Quantity>;
/**
* Slice a tuple

@@ -121,0 +128,0 @@ * @example SliceStartQuantity<[0, 1, 2, 3, 4, 5, 6], 2, 3> → [2, 3, 4]

4

lib/utils.d.ts

@@ -87,2 +87,6 @@ import { Extends, Equal } from 'typescript-compare';

}[TupleSet extends [] ? 'empty' : IsFinite<TupleSet, 'nonEmpty', 'infinite'>];
export declare type Drop<Tuple extends any[], Quantity extends number, Count extends any[] = []> = {
matched: Tuple;
unmatched: ((...args: Tuple) => any) extends ((_: any, ..._1: infer Rest) => any) ? Drop<Rest, Quantity, Prepend<Count, Count['length']>> : never;
}[Tuple extends [] ? 'matched' : Quantity extends Count['length'] ? 'matched' : 'unmatched'];
export declare type SliceStartQuantity<Tuple extends any[], Start extends number, Quantity extends number, Holder extends any[] = [], Count extends any[] = []> = {

@@ -89,0 +93,0 @@ before: SliceStartQuantity<Tail<Tuple>, Start, Quantity, Holder, Prepend<Count, Count['length']>>;

2

package.json
{
"name": "typescript-tuple",
"version": "3.0.0-rc",
"version": "3.0.0-rc.0",
"description": "Generics to work with tuples in TypeScript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -246,2 +246,20 @@ # TypeScript Tuple

### `Drop`
```typescript
import { Drop } from 'typescript-tuple'
type Foo = Drop<[0, 1, 2, 3, 4], 2> // Expect [2, 3, 4]
const foo: Foo = [2, 3, 4]
type Bar = Drop<[0, 1, 2, 3, 4, ...number[]], 2> // Expect [2, 3, 4, ...number[]]
const bar: Bar = [2, 3, 4]
type Baz = Drop<[0, 1, 2, 3, 4], 10> // Expect []
const baz: Baz = [2, 3, 4]
type Qux = Drop<[0, 1, 2, 3, 4, ...number[]], 10> // Expect number[]
const qux: Qux = [2, 3, 4]
```
### `SliceStartQuantity`

@@ -248,0 +266,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc