tuple.flow

0.1.0 • Public • Published

tuple.flow

travis package downloads styled with prettier

Helper functions for working with tuples in flow typed code.

Usage

import * as tuple from "tuple.flow"

Transforms

mapFirst

tuple.mapFirst(a => a + 1, [1]) //? [2]
tuple.mapFirst(a => a + 1, [1, 2]) //? [2, 2]
tuple.mapFirst(a => a + 1, [1, 2, 3, 4, 5]) //? [2, 2, 3, 4, 5]

mapSecond

tuple.mapSecond(a => a + 1, [1, 2]) //? [1, 3]
tuple.mapSecond(a => a + 1, [1, 2, 3, 4, 5]) //? [1, 3, 3, 4, 5]

Accessors

first

tuple.first([1]) //? 1
tuple.first([1, 2]) //? 1
tuple.first([1, 2, 3, 4, 5, 7, 8]) //? 1

second

tuple.second([1, 2]) //? 2
tuple.second([1, 2, 3, 4, 5, 7, 8]) //? 2

third / fourth / fifth / sixth / seventh / eighth

tuple.third([1, 2, 3, 4, 5, 7, 8]) //? 3
tuple.fourth([1, 2, 3, 4, 5, 7, 8]) //? 4
tuple.fifth([1, 2, 3, 4, 5, 7, 8]) //? 5
tuple.sixth([1, 2, 3, 4, 5, 7, 8]) //? 6
tuple.seventh([1, 2, 3, 4, 5, 7, 8]) //? 7
tuple.eighth([1, 2, 3, 4, 5, 7, 8]) //? 8

Constructors

unit / tuple0

tuple.unit() //? []
tuple.tuple0() //? []

singleton / tuple1

tuple.singlton(1) //? [1]
tuple.tuple1(1) //? [1]

tuple / tuple2

tuple.tuple(1, 2) //? [1, 2]
tuple.tuple2(1, 2) //? [1, 2]

triple / tuple3

tuple.triple(1, 2, 3) //? [1, 2, 3]
tuple.tuple3(1, 2, 3) //? [1, 2, 3]

quadruple / tuple4

tuple.quadruple(1, 2, 3, 4) //? [1, 2, 3, 4]
tuple.tuple4(1, 2, 3, 4) //? [1, 2, 3, 4]

quintuple / tuple5

tuple.quintuple(1, 2, 3, 4, 5) //? [1, 2, 3, 4, 5]
tuple.tuple5(1, 2, 3, 4, 5) //? [1, 2, 3, 4, 5]

sextuple / tuple6

tuple.sextuple(1, 2, 3, 4, 5, 6) //? [1, 2, 3, 4, 5, 6]
tuple.tuple6(1, 2, 3, 4, 5, 6) //? [1, 2, 3, 4, 5, 6]

septuple / tuple7

tuple.septuple(1, 2, 3, 4, 5, 6, 7) //? [1, 2, 3, 4, 5, 6, 7]
tuple.tuple7(1, 2, 3, 4, 5, 6, 7) //? [1, 2, 3, 4, 5, 6, 7]

octuple / tuple8

tuple.octuple(1, 2, 3, 4, 5, 6, 7, 8) //? [1, 2, 3, 4, 5, 6, 7, 8]
tuple.tuple7(1, 2, 3, 4, 5, 6, 7, 8) //? [1, 2, 3, 4, 5, 6, 7, 8]

Install

npm install tuple.flow

Readme

Keywords

Package Sidebar

Install

npm i tuple.flow

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

49.3 kB

Total Files

20

Last publish

Collaborators

  • gozala