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

Overloads to supports up to 9 functions.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pipe-ts

Overloads to supports up to 9 functions.

Installation

yarn add pipe-ts

npm install pipe-ts

pipe

Create a new function which pipes its value through the list functions.

const singleParamFnAdd1 = (n: number) => n + 1;
const singleParamFnTimes2 = (n: number) => n * 2;

const result = pipe(
    singleParamFnAdd1,
    singleParamFnTimes2,
)(1);

assert.strictEqual(result, 4);

Allows first function to have multiple parameters, using generic rest parameters

const singleParamFnAdd1 = (n: number) => n + 1;
const multipleParamFn = (a: number, b: number) => a - b;

const result = pipe(
    multipleParamFn,
    singleParamFnAdd1,
)(2, 1);

assert.strictEqual(result, 2);

pipeWith

Transform a value by piping it through the listed functions. Sugar syntax for pipe(f, g)(value).

const singleParamFnAdd1 = (n: number) => n + 1;
const singleParamFnTimes2 = (n: number) => n * 2;

const result = pipeWith(1, singleParamFnAdd1, singleParamFnTimes2);

assert.strictEqual(result, 4);

Development

yarn
npm run start

FAQs

Package last updated on 28 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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