# flow-type-list

> Type-level lists for Flow

Latest version **4.1.0** (published 2017-07-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install flow-type-list
pnpm add flow-type-list
yarn add flow-type-list
bun add flow-type-list
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2017-07-06 |
| First published | 2017-02-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tim Kuminecz |
| Maintainers | tkuminecz |

## Links

- npm: https://www.npmjs.com/package/flow-type-list
- Repository: https://github.com/tkuminecz/flow-type-list
- Homepage: https://github.com/tkuminecz/flow-type-list#readme
- Issues: https://github.com/tkuminecz/flow-type-list/issues
- npm.io page: https://npm.io/package/flow-type-list

## Recent versions

- 4.1.0 (latest) — 2017-07-06
- 4.0.0 — 2017-07-06
- 3.0.0 — 2017-02-15
- 2.0.0 — 2017-02-07
- 1.0.0 — 2017-02-04

## README

flow-type-list
==============

Type-level lists for `Flow`.

[![Build Status](https://travis-ci.org/tkuminecz/flow-type-list.svg?branch=master)](https://travis-ci.org/tkuminecz/flow-type-list)

# Getting Started
Install with npm
```
$ npm install --save-dev flow-type-list
```
or yarn
```
$ yarn add flow-type-list
```

and use it in your project.

```js
import { ... } from 'flow-type-list';
```

# API

## Types

### `Nil`
Represents an empty type list.

### `Cons<A, B>`
Represents the joining of a head type and tail `List`.

### `List<A, B>`
A `List<A, B>` is either `Nil` or `Cons<A, B>`.

### `$Head<L>`
Utility type that returns the type of the head element of the given type list.

### `$Tail<L>`
Utility type that returns the type of the tail type list of the given type list.

### `Cons1<A>`
Represents a list with one type.

### `Cons2<A, B>`
Represents a list with two types.

### `Cons3<A, B, C>`
Represents a list with three types.

### `Cons4<A, B, C, D>`
Represents a list with four types.

### `Cons5<A, B, C, D, E>`
Represents a list with five types.

### `Cons6<A, B, C, D, E, F>`
Represents a list with six types.

### `$A<L>` / `$First<L>`
Utility type that returns the first type in the given type `List`.

### `$B<L>` / `$Second<L>`
Utility type that returns the second type in the given type `List`.

### `$C<L>` / `$Third<L>`
Utility type that returns the third type in the given type `List`.

### `$D<L>` / `$Fourth<L>`
Utility type that returns the fourth type in the given type `List`.

### `$E<L>` / `$Fifth<L>`
Utility type that returns the fifth type in the given type `List`.

### `$F<L>` / `$Sixth<L>`
Utility type that returns the sixth type in the given type `List`.

### `$SwapA<L, A>`
Utility type that swaps the given type into the first position of the given `List`.

### `$SwapB<L, B>`
Utility type that swaps the given type into the second position of the given `List`.

### `$SwapC<L, C>`
Utility type that swaps the given type into the third position of the given `List`.

### `$SwapD<L, D>`
Utility type that swaps the given type into the fourth position of the given `List`.

### `$SwapE<L, E>`
Utility type that swaps the given type into the fifth position of the given `List`.

### `$SwapF<L, F>`
Utility type that swaps the given type into the sixth position of the given `List`.

## Functions

### `cons(a, b)`
```js
<A, B: List<any, any>>(a: A, b: B) => Cons<A, B>
```
Joins the given value and `List` into a new `List`.

### `uncons(cons)`
```js
<A, B: List<any, any>>(cons: Cons<A, B>) => [A, B]
```
Separates the head value and tail `List` of the given `List`.

### `head(cons)`
```js
<A>(cons: Cons<A, any>) => A
```
Returns the head value of the given `List`.

### `tail(cons)`
```js
<B: List<any, any>>(cons: Cons<any, B>) => B
```
Returns the tail `List` of the given `List`.

### `first(list) / a(list)`
```js
<A>(list: List<A, any>) => A
```
Returns the first value in the given `List`.

### `second(list) / b(list)`
```js
<B>(list: List<any, List<B, any>>) => B
```
Returns the second value in the given `List`.

### `third(list) / c(list)`
```js
<C>(list: List<any, List<any, List<C, any>>>) => C
```
Returns the third value in the given `List`.

### `fourth(list) / d(list)`
```js
<D>(list: List<any, List<any, List<any, List<D, any>>>>) => D
```
Returns the fourth value in the given `List`.

### `fifth(list) / e(list)`
```js
<E>(list: List<any, List<any, List<any, List<any, List<E, any>>>>>) => E
```
Returns the fifth value in the given `List`.

### `sixth(list) / f(list)`
```js
<F>(list: List<any, List<any, List<any, List<any, List<any, List<F, any>>>>>>) => F
```
Returns the sixth value in the given `List`.

### `cons1(a)`
```js
<A>(a: A) => Cons<A, Nil>
```
Creates a list with one value.

### `uncons1(list)`
```js
<A>(list: Cons<A, any>) => [A]
```
Deconstructs a `List` with one value.

### `cons2(a, b)`
```js
<A, B>(a: A, b: B) => Cons<A, Cons<B, Nil>>
```
Creates a list with two values.

### `uncons2(list)`
```js
<A, B>(list: Cons<A, Cons<B, any>>) => [A, B]
```
Deconstructs a `List` with two values.

### `cons3(a, b, c)`
```js
<A, B, C>(a: a, b: B, c: C) => Cons<A, Cons<B, Cons<C, Nil>>>
```
Creates a list with three values.

### `uncons3(list)`
```js
<A, B>(list: Cons<A, Cons<B, any>>) => [A, B]
```
Deconstructs a `List` with three values.

### `cons4(a, b, c, d)`
```js
<A, B, C, D>(a: a, b: B, c: C, d: D) => Cons<A, Cons<B, Cons<C, Cons<D, Nil>>>>
```
Creates a list with four values.

### `uncons4(list)`
```js
<A, B, C, D>(list: Cons<A, Cons<B, Cons<C, Cons<D, any>>>>) => [A, B, C, D]
```
Deconstructs a `List` with four values.

### `cons5(a, b, c, d, e)`
```js
<A, B, C, D, E>(a: a, b: B, c: C, d: D, e: E) => Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Nil>>>>>
```
Creates a list with five values.

### `uncons5(list)`
```js
<A, B, C, D, E>(list: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, any>>>>>) => [A, B, C, D, E]
```
Deconstructs a `List` with five values.

### `cons6(a, b, c, d, e, f)`
```js
<A, B, C, D, E, F>(a: a, b: B, c: C, d: D, e: E, f: F) => Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Nil>>>>>>
```
Creates a list with six values.

### `uncons6(list)`
```js
<A, B, C, D, E, F>(list: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, any>>>>>>) => [A, B, C, D, E, F]
```
Deconstructs a `List` with six values.

---
_Source: https://npm.io/package/flow-type-list · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
