tuples

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i tuples

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • gummesson