Socket
Book a DemoInstallSign in
Socket

downpipe

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

downpipe

pipe operator, it goes down

0.1.2
latest
npmnpm
Version published
Maintainers
1
Created
Source

Downpipe : Pipe Operator

Installation

Grab it from NPM:

npm i downpipe

Setting Up

To use downpipe, follow these steps:

  • Import the Default class export from the package. This is your pipe constructor.
import Downpipe from 'downpipe'
  • Have your single-argument functions ready. You get type hinting, but no enforced type safety between pipe functions, so create your pipe class instances responsibly.
const double = (n) => n * 2
const increment = (n) => n + 1
  • Create a new instance of Downpipe and feel free to destructure the v function. Pass an object with your functions in as the sole argument.
const { v } = new Downpipe({ double, increment })

Piping

Don't invoke the functions themselves, just invoke v to pass the starting value in and then chain your functions. Make sure to end it with a return.

const someNumber = 473566;
const pipedNumber = 
    v(someNumber)
    .double
    .increment
    .increment
    .increment
    .return;
console.log(pipedNumber); // Outputs: 947135

License

This project is licensed under the MIT License.

FAQs

Package last updated on 31 May 2023

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.