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

pipe-ts

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pipe-ts - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

6

package.json

@@ -16,3 +16,3 @@ {

],
"version": "0.0.3",
"version": "0.0.4",
"scripts": {

@@ -28,6 +28,4 @@ "lint": "tslint --project ./tsconfig.json",

],
"dependencies": {
"@types/node": "^12.0.10"
},
"devDependencies": {
"@types/node": "^12.0.10",
"prettier": "^1.18.2",

@@ -34,0 +32,0 @@ "source-map-support": "^0.5.12",

@@ -58,2 +58,6 @@ # pipe-ts

## Note about type safety
`pipe` and `pipeWith` currently support up to 9 functions. If more than 9 functions are passed, type safety will be lost. If need be, we are open to adding more overloads to avoid this.
## Development

@@ -60,0 +64,0 @@

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

declare type AnyFunction = (...params: any[]) => any;
declare type UnknownFunction = (...params: unknown[]) => unknown;
export declare function pipe<A extends unknown[], B>(ab: (...a: A) => B): (...args: A) => B;
export declare function pipe<A extends unknown[], B, C>(ab: (...a: A) => B, bc: (b: B) => C): (...args: A) => C;

@@ -9,2 +12,4 @@ export declare function pipe<A extends unknown[], B, C, D>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D;

export declare function pipe<A extends unknown[], B, C, D, E, F, G, H, I, J>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): (...args: A) => J;
export declare function pipe(...fns: AnyFunction[]): UnknownFunction;
export declare function pipeWith<A, B>(a: A, ab: (a: A) => B): B;
export declare function pipeWith<A, B, C>(a: A, ab: (a: A) => B, bc: (b: B) => C): C;

@@ -18,1 +23,3 @@ export declare function pipeWith<A, B, C, D>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D): D;

export declare function pipeWith<A, B, C, D, E, F, G, H, I, J>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): J;
export declare function pipeWith(a: unknown, ...fns: AnyFunction[]): unknown;
export {};

@@ -20,2 +20,3 @@ "use strict";

// One test for each overload
assert.strictEqual(index_1.pipe(singleParamFnAdd1)(1), 2);
assert.strictEqual(index_1.pipe(singleParamFnAdd1, singleParamFnTimes2)(1), 4);

@@ -29,2 +30,3 @@ assert.strictEqual(index_1.pipe(singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1)(1), 5);

assert.strictEqual(index_1.pipe(singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1)(1), 47);
assert.strictEqual(index_1.pipe(singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2)(1), 94);
});

@@ -38,2 +40,3 @@ it('works when first function has multiple params', function () {

// One test for each overload
assert.strictEqual(index_1.pipeWith(1, singleParamFnAdd1), 2);
assert.strictEqual(index_1.pipeWith(1, singleParamFnAdd1, singleParamFnTimes2), 4);

@@ -47,4 +50,5 @@ assert.strictEqual(index_1.pipeWith(1, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1), 5);

assert.strictEqual(index_1.pipeWith(1, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1), 47);
assert.strictEqual(index_1.pipeWith(1, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2, singleParamFnAdd1, singleParamFnTimes2), 94);
});
});
//# sourceMappingURL=tests.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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