Installations
npm install @ngard/tiny-curry
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
10.14.1
NPM Version
6.5.0
Score
68.4
Supply Chain
93
Quality
75.1
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
NickGard
Download Statistics
Total Downloads
822
Last Day
2
Last Week
2
Last Month
4
Last Year
107
GitHub Statistics
1 Stars
4 Commits
1 Watching
1 Branches
1 Contributors
Bundle Size
365.00 B
Minified
257.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.0.1
Package Id
@ngard/tiny-curry@1.0.1
Unpacked Size
16.91 kB
Size
6.17 kB
File Count
7
NPM Version
6.5.0
Node Version
10.14.1
Total Downloads
Cumulative downloads
Total Downloads
822
Last day
0%
2
Compared to previous day
Last week
100%
2
Compared to previous week
Last month
33.3%
4
Compared to previous month
Last year
-46.8%
107
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
tiny-curry
A minimal utility similar to lodash.curry
. For when every byte counts!
Returns a series of functions that consume the original function's arguments one at a time until the original function's arity (or the passed arity) is met.
Install
1npm install @ngard/tiny-curry
Syntax
1curry(/* function [, arity] */);
Parameters
function
- A function that will be called once the parameters are gathered through currying.
arity
- The number of curry functions to create before returning the result of the passed function called with the arguments. Defaults to function.length
.
Returns
A series of functions that each take a single argument and apply those arguments to the supplied function once they have all been gathered. Each intermediate function also has a value
method that may be invoked to apply the currently gathered arguments to the function.
Examples
1import { curry } from '@ngard/tiny-curry'; 2 3function add(a, b) { return a + b; } 4// add.length = 2, the number of arguments it expects 5 6const curriedAdd = curry(add); 7const addTwo = curriedAdd(2); 8 9console.log(addTwo(5)); // logs '7'
1import { curry } from '@ngard/tiny-curry'; 2 3function greet(name, title = 'Your Lordship') { 4 return `Good day, ${name}, ${title}`; 5} 6// greet.length = 1, because defaulted arguments are not 'expected' 7 8const curriedGreet = curry(greet, 2); 9const greetBob = curriedGreet('Bob'); 10 11console.log(greetBob('my friend')); // logs 'Good day, Bob, my friend' 12console.log(greetBob()); // logs 'Good day, Bob, Your Lordship'
1import { curry } from '@ngard/tiny-curry'; 2 3function sum(...numbers) { 4 return numbers.reduce((total, number) => total + number); 5} 6// sum.length = 0, because rest arguments are not 'expected' 7 8const curriedSum = curry(sum, Infinity); 9 10// call `.value()` on an infinitely curried function to call the 11// original function with the gathered arguments 12const total = curriedSum(1)(2)(3)(4).value(); 13 14console.log(total); // logs '10'
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
6 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-675m-85rw-j3w4
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg
Reason
Found 0/4 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.3
/10
Last Scanned on 2025-01-13
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More