Carrying
A functional JavaScript library that carries you towards happier and better code.
Why?
Because JavaScript (as is at the moment) lacks some great functions built into the language.
A lot of other languages provides similar functions that this library provides.
Mainly functional languages, which this library has taken it's inspiration from. So this is simply a
functional JavaScript library which provides some useful functions that JavaScript currently lacks.
Installation
npm install --save carrying
Usage
Just import the functions you want to use:
import {concat, intersperse, uncons, range, transpose} from 'carrying'
uncons(range(1, 11))
uncons([1, 2, 3])
uncons([])
uncons('abc')
uncons('ze')
uncons('q')
uncons('')
range(1, 3)
range(5, 11)
range(10, 9)
range(2, 2)
range(1, 10, 2)
transpose([[1, 2, 3], [4, 5, 6]])
transpose([[10, 11], [20], [], [30, 31, 32]])
concat(intersperse(' ', ['intersperse', 'is', 'a', 'fun', 'function', '!']))
Any carrying module can be imported individually if you prefer that:
import {takeWhile} from 'carrying/lib/takeWhile'
takeWhile(a => a < 3, [1, 2, 3, 4, 1, 2, 3, 4])
Documentation
Documentation is available online at: http://drager.github.io/carrying/