Socket
Book a DemoInstallSign in
Socket

curryable

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

curryable

decorate a function so it will curry if not given enough arguments

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

curryable

decorate a function so it will curry if not given enough arguments. See why curry helps for a good explanation of the concept.

Installation

With component, packin or npm

$ {package mananger} install jkroso/curryable

then in your app:

var curryable = require('curryable')

API

  • curryable()

curryable(fn:function, [arity]:Number)

make fn curryable

var add = curryable(function(a, b){
  return a + b
})
var add1 = add(1)
add1(1) == add(1, 1) == 2 // => true

The optional arity argument allows you to specify how many arguments are optional

var add = curryable(function(a, b, c){
  return a + b + (c || 0)
}, -1)
add(1)(2) == add(1)(2, 0) // => true

Running the tests

Just run make. It will install and start a development server leaving the tests waiting for you at

Keywords

curry

FAQs

Package last updated on 13 Jul 2013

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