Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chickencurry

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chickencurry

Add some chicken curry to your functions

  • 1.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
776
increased by20.5%
Maintainers
1
Weekly downloads
 
Created
Source

:curry: Chickencurry

Build Status npm version

Add some chickencurry to your functions

Installation

npm install chickencurry

Usage

Basic usage

var curry = require('chickencurry');

function add(a, b) {
  return a + b;
}
var add1 = curry(add)(1);

add1(3); // => 4
add1(4); // => 5

Curry n arguments

var curryN = require('chickencurry/N');

function join() {
  return Array.prototype.slice.call(arguments).join();
}

curryN(join, 3)(1)(2)(3) // => '1,2,3'

Partial applications

var curryN = require('chickencurry/N');

function join() {
  return Array.prototype.slice.call(arguments).join();
}

curryN(join, 3, 'Fish', 'Chicken')('...'); // => 'Fish,Chicken,...')
curryN(join, 3)('Fish', 'Chicken')('...'); // => 'Fish,Chicken,...')

Placeholder

You can curry a function using placeholders, if you want to set the i.e 3rd argument.

function join(a, b, sep) {
  return a + sep + b;
};

var __ = require('chickencurry/__');

var join_ = curry(join, __, __, '_'); 
// or var join_ = curry(join, undefined, undefined, '_'); 

join_('chicken', 'curry'); // => 'chicken_curry'


var joinCurry = curry(join); 
var joinDash = joinCurry(__, __, '-');

joinDash('chicken', 'curry'); // => 'chicken-curry'

Keywords

FAQs

Package last updated on 08 Feb 2015

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