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

p-pipe

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-pipe - npm Package Compare versions

Comparing version 3.1.0 to 4.0.0

157

index.d.ts

@@ -1,10 +0,9 @@

declare namespace pPipe {
type UnaryFunction<ValueType, ReturnType> = (
value: ValueType
) => ReturnType | PromiseLike<ReturnType>;
/* eslint-disable import/export */
export type UnaryFunction<ValueType, ReturnType> = (
value: ValueType
) => ReturnType | PromiseLike<ReturnType>;
type Pipeline<ValueType, ReturnType> = (
value?: ValueType
) => Promise<ReturnType>;
}
export type Pipeline<ValueType, ReturnType> = (
value?: ValueType
) => Promise<ReturnType>;

@@ -19,3 +18,3 @@ /**

```
import pPipe = require('p-pipe');
import pPipe from 'p-pipe';

@@ -27,21 +26,19 @@ const addUnicorn = async string => `${string} Unicorn`;

(async () => {
console.log(await pipeline('❤️'));
//=> '❤️ Unicorn Rainbow'
})();
console.log(await pipeline('❤️'));
//=> '❤️ Unicorn Rainbow'
```
*/
declare function pPipe<ValueType, ReturnType>(
f1: pPipe.UnaryFunction<ValueType, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
declare function pPipe<ValueType, ResultValue1, ReturnType>(
f1: pPipe.UnaryFunction<ValueType, ResultValue1>,
f2: pPipe.UnaryFunction<ResultValue1, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
declare function pPipe<ValueType, ResultValue1, ResultValue2, ReturnType>(
f1: pPipe.UnaryFunction<ValueType, ResultValue1>,
f2: pPipe.UnaryFunction<ResultValue1, ResultValue2>,
f3: pPipe.UnaryFunction<ResultValue2, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
declare function pPipe<
export default function pPipe<ValueType, ReturnType>(
f1: UnaryFunction<ValueType, ReturnType>
): Pipeline<ValueType, ReturnType>;
export default function pPipe<ValueType, ResultValue1, ReturnType>(
f1: UnaryFunction<ValueType, ResultValue1>,
f2: UnaryFunction<ResultValue1, ReturnType>
): Pipeline<ValueType, ReturnType>;
export default function pPipe<ValueType, ResultValue1, ResultValue2, ReturnType>(
f1: UnaryFunction<ValueType, ResultValue1>,
f2: UnaryFunction<ResultValue1, ResultValue2>,
f3: UnaryFunction<ResultValue2, ReturnType>
): Pipeline<ValueType, ReturnType>;
export default function pPipe<
ValueType,

@@ -53,8 +50,8 @@ ResultValue1,

>(
f1: pPipe.UnaryFunction<ValueType, ResultValue1>,
f2: pPipe.UnaryFunction<ResultValue1, ResultValue2>,
f3: pPipe.UnaryFunction<ResultValue2, ResultValue3>,
f4: pPipe.UnaryFunction<ResultValue3, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
declare function pPipe<
f1: UnaryFunction<ValueType, ResultValue1>,
f2: UnaryFunction<ResultValue1, ResultValue2>,
f3: UnaryFunction<ResultValue2, ResultValue3>,
f4: UnaryFunction<ResultValue3, ReturnType>
): Pipeline<ValueType, ReturnType>;
export default function pPipe<
ValueType,

@@ -67,9 +64,9 @@ ResultValue1,

>(
f1: pPipe.UnaryFunction<ValueType, ResultValue1>,
f2: pPipe.UnaryFunction<ResultValue1, ResultValue2>,
f3: pPipe.UnaryFunction<ResultValue2, ResultValue3>,
f4: pPipe.UnaryFunction<ResultValue3, ResultValue4>,
f5: pPipe.UnaryFunction<ResultValue4, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
declare function pPipe<
f1: UnaryFunction<ValueType, ResultValue1>,
f2: UnaryFunction<ResultValue1, ResultValue2>,
f3: UnaryFunction<ResultValue2, ResultValue3>,
f4: UnaryFunction<ResultValue3, ResultValue4>,
f5: UnaryFunction<ResultValue4, ReturnType>
): Pipeline<ValueType, ReturnType>;
export default function pPipe<
ValueType,

@@ -83,10 +80,10 @@ ResultValue1,

>(
f1: pPipe.UnaryFunction<ValueType, ResultValue1>,
f2: pPipe.UnaryFunction<ResultValue1, ResultValue2>,
f3: pPipe.UnaryFunction<ResultValue2, ResultValue3>,
f4: pPipe.UnaryFunction<ResultValue3, ResultValue4>,
f5: pPipe.UnaryFunction<ResultValue4, ResultValue5>,
f6: pPipe.UnaryFunction<ResultValue5, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
declare function pPipe<
f1: UnaryFunction<ValueType, ResultValue1>,
f2: UnaryFunction<ResultValue1, ResultValue2>,
f3: UnaryFunction<ResultValue2, ResultValue3>,
f4: UnaryFunction<ResultValue3, ResultValue4>,
f5: UnaryFunction<ResultValue4, ResultValue5>,
f6: UnaryFunction<ResultValue5, ReturnType>
): Pipeline<ValueType, ReturnType>;
export default function pPipe<
ValueType,

@@ -101,11 +98,11 @@ ResultValue1,

>(
f1: pPipe.UnaryFunction<ValueType, ResultValue1>,
f2: pPipe.UnaryFunction<ResultValue1, ResultValue2>,
f3: pPipe.UnaryFunction<ResultValue2, ResultValue3>,
f4: pPipe.UnaryFunction<ResultValue3, ResultValue4>,
f5: pPipe.UnaryFunction<ResultValue4, ResultValue5>,
f6: pPipe.UnaryFunction<ResultValue5, ResultValue6>,
f7: pPipe.UnaryFunction<ResultValue6, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
declare function pPipe<
f1: UnaryFunction<ValueType, ResultValue1>,
f2: UnaryFunction<ResultValue1, ResultValue2>,
f3: UnaryFunction<ResultValue2, ResultValue3>,
f4: UnaryFunction<ResultValue3, ResultValue4>,
f5: UnaryFunction<ResultValue4, ResultValue5>,
f6: UnaryFunction<ResultValue5, ResultValue6>,
f7: UnaryFunction<ResultValue6, ReturnType>
): Pipeline<ValueType, ReturnType>;
export default function pPipe<
ValueType,

@@ -121,12 +118,12 @@ ResultValue1,

>(
f1: pPipe.UnaryFunction<ValueType, ResultValue1>,
f2: pPipe.UnaryFunction<ResultValue1, ResultValue2>,
f3: pPipe.UnaryFunction<ResultValue2, ResultValue3>,
f4: pPipe.UnaryFunction<ResultValue3, ResultValue4>,
f5: pPipe.UnaryFunction<ResultValue4, ResultValue5>,
f6: pPipe.UnaryFunction<ResultValue5, ResultValue6>,
f7: pPipe.UnaryFunction<ResultValue6, ResultValue7>,
f8: pPipe.UnaryFunction<ResultValue7, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
declare function pPipe<
f1: UnaryFunction<ValueType, ResultValue1>,
f2: UnaryFunction<ResultValue1, ResultValue2>,
f3: UnaryFunction<ResultValue2, ResultValue3>,
f4: UnaryFunction<ResultValue3, ResultValue4>,
f5: UnaryFunction<ResultValue4, ResultValue5>,
f6: UnaryFunction<ResultValue5, ResultValue6>,
f7: UnaryFunction<ResultValue6, ResultValue7>,
f8: UnaryFunction<ResultValue7, ReturnType>
): Pipeline<ValueType, ReturnType>;
export default function pPipe<
ValueType,

@@ -143,18 +140,16 @@ ResultValue1,

>(
f1: pPipe.UnaryFunction<ValueType, ResultValue1>,
f2: pPipe.UnaryFunction<ResultValue1, ResultValue2>,
f3: pPipe.UnaryFunction<ResultValue2, ResultValue3>,
f4: pPipe.UnaryFunction<ResultValue3, ResultValue4>,
f5: pPipe.UnaryFunction<ResultValue4, ResultValue5>,
f6: pPipe.UnaryFunction<ResultValue5, ResultValue6>,
f7: pPipe.UnaryFunction<ResultValue6, ResultValue7>,
f8: pPipe.UnaryFunction<ResultValue7, ResultValue8>,
f9: pPipe.UnaryFunction<ResultValue8, ReturnType>
): pPipe.Pipeline<ValueType, ReturnType>;
f1: UnaryFunction<ValueType, ResultValue1>,
f2: UnaryFunction<ResultValue1, ResultValue2>,
f3: UnaryFunction<ResultValue2, ResultValue3>,
f4: UnaryFunction<ResultValue3, ResultValue4>,
f5: UnaryFunction<ResultValue4, ResultValue5>,
f6: UnaryFunction<ResultValue5, ResultValue6>,
f7: UnaryFunction<ResultValue6, ResultValue7>,
f8: UnaryFunction<ResultValue7, ResultValue8>,
f9: UnaryFunction<ResultValue8, ReturnType>
): Pipeline<ValueType, ReturnType>;
// Fallbacks if more than 9 functions are passed as input (not type-safe).
declare function pPipe(
...functions: (pPipe.UnaryFunction<any, unknown>)[]
): pPipe.Pipeline<unknown, unknown>;
export = pPipe;
export default function pPipe(
...functions: Array<UnaryFunction<any, unknown>>
): Pipeline<unknown, unknown>;

@@ -1,4 +0,2 @@

'use strict';
module.exports = (...functions) => {
export default function pPipe(...functions) {
if (functions.length === 0) {

@@ -11,4 +9,4 @@ throw new Error('Expected at least one argument');

for (const fn of functions) {
currentValue = await fn(currentValue); // eslint-disable-line no-await-in-loop
for (const function_ of functions) {
currentValue = await function_(currentValue); // eslint-disable-line no-await-in-loop
}

@@ -18,2 +16,2 @@

};
};
}
{
"name": "p-pipe",
"version": "3.1.0",
"version": "4.0.0",
"description": "Compose promise-returning & async functions into a reusable pipeline",

@@ -13,4 +13,6 @@ "license": "MIT",

},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": ">=12"
},

@@ -41,7 +43,7 @@ "scripts": {

"devDependencies": {
"ava": "^1.4.1",
"sinon": "^7.3.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"sinon": "^10.0.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
}
}

@@ -1,2 +0,2 @@

# p-pipe [![Build Status](https://travis-ci.com/sindresorhus/p-pipe.svg?branch=master)](https://travis-ci.com/sindresorhus/p-pipe)
# p-pipe

@@ -14,3 +14,3 @@ > Compose promise-returning & async functions into a reusable pipeline

```js
const pPipe = require('p-pipe');
import pPipe from 'p-pipe';

@@ -22,6 +22,4 @@ const addUnicorn = async string => `${string} Unicorn`;

(async () => {
console.log(await pipeline('❤️'));
//=> '❤️ Unicorn Rainbow'
})();
console.log(await pipeline('❤️'));
//=> '❤️ Unicorn Rainbow'
```

@@ -28,0 +26,0 @@

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