Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

partial

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

partial

partial function application - transform f into its partial by partial(f)

latest
Source
npmnpm
Version
0.0.7
Version published
Weekly downloads
255
64.52%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Coverage Status

partial

is simple to use

var partial = require('partial');
var foo = function(x,y,z) { return (x*y) + z }

var bar = partial(foo);

and we're done! Now we can simply say

bar(2,3)(4); // 10
bar(2)(3,4); // 10

var fix = bar(2,3);
fix(4); // 10

usage

Simply pass any function to partial, and if you wish, any arguments you want to fix.

var bar = partial(foo);
var baz = bar(2,3);

is identical to

var baz2 = partial(foo,2,3);

both can be used like so:

baz(4); // 10
baz2(4); // 10

Right side partial function application is through .rapply i.e.

var bar = partial.rapply(foo);
var baz = bar(3,7); // y = 3, z = 7

baz(2); // (2*3) + 7 = 13

FAQs

Package last updated on 23 Dec 2018

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