$
This commit is contained in:
21
node_modules/curri/LICENSE
generated
vendored
Normal file
21
node_modules/curri/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Gianluca Guarini
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
52
node_modules/curri/README.md
generated
vendored
Normal file
52
node_modules/curri/README.md
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# curri
|
||||
|
||||
<img alt="curri.js" src="https://cdn.rawgit.com/GianlucaGuarini/curri/master/curri.gif" width="50%"/>
|
||||
|
||||
> `curri` in some Italian :it: dialects means `run`
|
||||
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
|
||||
[![NPM version][npm-version-image]][npm-url]
|
||||
[![NPM downloads][npm-downloads-image]][npm-url]
|
||||
[![MIT License][license-image]][license-url]
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import curry from 'curri'
|
||||
|
||||
const add = (a, b) => a + b
|
||||
const add3 = curry(add)(3)
|
||||
|
||||
console.log(add3(5)) // 8
|
||||
```
|
||||
|
||||
[travis-image]: https://img.shields.io/travis/GianlucaGuarini/curri.svg?style=flat-square
|
||||
|
||||
[travis-url]: https://travis-ci.org/GianlucaGuarini/curri
|
||||
|
||||
[license-image]: http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
|
||||
|
||||
[license-url]: LICENSE
|
||||
|
||||
[npm-version-image]: http://img.shields.io/npm/v/curri.svg?style=flat-square
|
||||
|
||||
[npm-downloads-image]: http://img.shields.io/npm/dm/curri.svg?style=flat-square
|
||||
|
||||
[npm-url]: https://npmjs.org/package/curri
|
||||
|
||||
## API
|
||||
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### curry
|
||||
|
||||
Function to curry any javascript method
|
||||
|
||||
**Parameters**
|
||||
|
||||
- `fn` **[Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** the target function we want to curry
|
||||
- `acc` **...\[args]** initial arguments
|
||||
|
||||
Returns **([Function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function) | any)** it will return a function until the target function
|
||||
will receive all of its arguments
|
26
node_modules/curri/curri.js
generated
vendored
Normal file
26
node_modules/curri/curri.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = global || self, global.curri = factory());
|
||||
}(this, function () { 'use strict';
|
||||
|
||||
/**
|
||||
* Function to curry any javascript method
|
||||
* @param {Function} fn - the target function we want to curry
|
||||
* @param {...[args]} acc - initial arguments
|
||||
* @returns {Function|*} it will return a function until the target function
|
||||
* will receive all of its arguments
|
||||
*/
|
||||
function curry(fn, ...acc) {
|
||||
return (...args) => {
|
||||
args = [...acc, ...args];
|
||||
|
||||
return args.length < fn.length ?
|
||||
curry(fn, ...args) :
|
||||
fn(...args)
|
||||
}
|
||||
}
|
||||
|
||||
return curry;
|
||||
|
||||
}));
|
16
node_modules/curri/index.next.js
generated
vendored
Normal file
16
node_modules/curri/index.next.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Function to curry any javascript method
|
||||
* @param {Function} fn - the target function we want to curry
|
||||
* @param {...[args]} acc - initial arguments
|
||||
* @returns {Function|*} it will return a function until the target function
|
||||
* will receive all of its arguments
|
||||
*/
|
||||
export default function curry(fn, ...acc) {
|
||||
return (...args) => {
|
||||
args = [...acc, ...args]
|
||||
|
||||
return args.length < fn.length ?
|
||||
curry(fn, ...args) :
|
||||
fn(...args)
|
||||
}
|
||||
}
|
39
node_modules/curri/package.json
generated
vendored
Normal file
39
node_modules/curri/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "curri",
|
||||
"version": "1.0.1",
|
||||
"description": "Minimal curry implementation",
|
||||
"main": "curri.js",
|
||||
"jsnext:main": "index.next.js",
|
||||
"module": "index.next.js",
|
||||
"scripts": {
|
||||
"prepare": "npm run build && npm test",
|
||||
"lint": "eslint index.next.js test.js rollup.config.js",
|
||||
"build": "rollup -c",
|
||||
"doc": "documentation readme index.next.js -s API",
|
||||
"test": "npm run lint && mocha test.js"
|
||||
},
|
||||
"files": [
|
||||
"index.next.js"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/GianlucaGuarini/curri.git"
|
||||
},
|
||||
"keywords": [
|
||||
"curry",
|
||||
"currying",
|
||||
"functional"
|
||||
],
|
||||
"author": "Gianluca Guarini <gianluca.guarini@gmail.com> (http://gianlucaguarini.com)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/GianlucaGuarini/curri/issues"
|
||||
},
|
||||
"homepage": "https://github.com/GianlucaGuarini/curri#readme",
|
||||
"devDependencies": {
|
||||
"@gianlucaguarini/eslint-config": "^2.0.0",
|
||||
"eslint": "^5.16.0",
|
||||
"mocha": "^6.0.2",
|
||||
"rollup": "^1.7.4"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user