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

unlimited-curry

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unlimited-curry - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

2

package.json
{
"name": "unlimited-curry",
"version": "1.1.5",
"version": "1.1.6",
"description": "Unlimited curry",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -37,22 +37,15 @@ <!--- destination qa rewrite begin -->

In this example, you can see the library if you do callback needs to have two of them the first receives the error code
that is 0 at the moment only, in the future it can change and the second that is all the parameters you chained trough.
From this you cannot return anything, instead, do something with them. The second callback returns a value you calculate
via a promise as you see. The empty closing parenthesis makes sure your first call is evaluated in a sync way. If you need
a return value, you have to use your promise mojo to get it back.
that is 0 at the moment only, in the future it will change and the second that is all the parameters you chained trough.
```javascript 1.8
const unlimitedCurry = require('unlimited-curry')
async function () {
const fn = unlimitedCurry(
(e, parameters) => {
//will not return anything, will be execited anyways
},
parameters=>`${parameters.data.returnArray[0]}${parameters.data.returnArray[1]}${parameters.data.returnArray[2]}`
)
const returnValue = await fn('a')('b')('c')()
console.log(returnValue)
expect(returnValue).to.be.equal('abc')
} ()
const fn = unlimitedCurry(
(e, parameters) => {
//will not return anything, will be execited anyways
},
parameters=>`${parameters.data.returnArray[0]}${parameters.data.returnArray[1]}${parameters.data.returnArray[2]}`
)
const returnValue = await fn('a')('b')('c')()
console.log(returnValue)
expect(returnValue).to.be.equal('abc')
```

@@ -70,8 +63,6 @@

(e, parameters) => {
//will not return anything, will be execited anyways
},
parameters=>parameters.data.returnArray[0]
+ parameters.data.returnArray[1]
+ parameters.data.returnArray[2]
)
return parameters.data.returnArray[0]
+ parameters.data.returnArray[1]
+ parameters.data.returnArray[2]
})
const returnValue = await fn('a')('b')('c').p().then(data=>data)

@@ -82,2 +73,3 @@ console.log(returnValue)

```
If you don't use the promise the `p()` function, as it is a detached execution you will not be able to get back anything.

@@ -88,26 +80,26 @@ ## split call example

```javascript 1.8
async function () {
const getMyCurry = () => unlimitedCurry(
(e, parameters) => {
},
parameters=>parameters.data.returnArray[0]
+ parameters.data.returnArray[1]
+ parameters.data.returnArray[2]
)
let fn = getMyCurry()
fn('a')
let returnValue = await fn('b', 'c')()
expect(returnValue).to.be.equal('abc')
const getMyCurry = () => unlimitedCurry(
(e, parameters) => {
},
parameters=>parameters.data.returnArray[0]
+ parameters.data.returnArray[1]
+ parameters.data.returnArray[2]
)
let fn = getMyCurry()
fn('a')
let returnValue = fn('b', 'c')()
expect(returnValue).to.be.equal('abc')
fn = getMyCurry()
fn('a', 'b')
returnValue = await fn('c')()
expect(returnValue).to.be.equal('abc')
fn = getMyCurry()
fn('a', 'b')
returnValue = fn('c')()
expect(returnValue).to.be.equal('abc')
fn = getMyCurry()
fn('a')
fn('b')
returnValue = await fn('c')()
expect(returnValue).to.be.equal('abc')
}
fn = getMyCurry()
fn('a')
fn('b')
returnValue = fn('c')()
expect(returnValue).to.be.equal('abc')
```
of course it will work with the promis version too.

@@ -58,3 +58,3 @@ const getFrom = function (from, dataArgument) {

clearTimeout(timeoutSate);
callback(0, data)
return callback(0, data)
}

@@ -61,0 +61,0 @@ return caller.p()

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