Socket
Socket
Sign inDemoInstall

carrying

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

carrying

A functional JavaScript library that carries you towards happier and better code.


Version published
Weekly downloads
17
increased by750%
Maintainers
1
Weekly downloads
 
Created
Source

Carrying

Build Status

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)) // => [[1], [2, 3, 4, 5, 6, 7, 8, 9, 10]]
uncons([1, 2, 3]) //=> [[1], [2, 3]]
uncons([]) //=> undefined

uncons('abc') //=> [['a'], ['b', 'c']]
uncons('ze') // => [['z'], ['e']]
uncons('q') // => ['q']
uncons('') //=> undefined

range(1, 3) // => [1, 2]
range(5, 11) // => [5, 6, 7, 8, 9, 10]

range(10, 9) // => []
range(2, 2) // => []

range(1, 10, 2) // => [1, 3, 5, 7, 9]

transpose([[1, 2, 3], [4, 5, 6]]) // => [[1, 4], [2, 5], [3, 6]]
transpose([[10, 11], [20], [], [30, 31, 32]]) // => [[10, 20, 30], [11, 31], [32]]

concat(intersperse(' ', ['intersperse', 'is', 'a', 'fun', 'function', '!'])) // => '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]) // => [1, 2]

Documentation

Documentation is available online at: http://drager.github.io/carrying/

Keywords

FAQs

Package last updated on 06 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc