1.0.0 • Published 9 years ago

tuples v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

tuples

NPM version License Build status

A tiny tuple-like implementation in JavaScript.

Installation

npm install tuples

Usage

const { tuple, fst, snd, swap } = require('tuples')

const t = tuple(1, 2) // => [1, 2]
fst(t)                // => 1
snd(t)                // => 2
swap(t)               // => [2, 1]

API

t = tuple(...any)

Construct a new tuple.

fst(t)

Extract the first component of a pair.

snd(t)

Extract the second component of a pair.

swap(t)

Swap the components of a pair.

License

MIT