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

pipeable

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pipeable

This package help you to execute functions and pipe the result of that function has first parameter of the next function. Something like pipe operator on Erlang, Elixir or others functional programming languages.

  • 0.0.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Pipeable

This package help you to execute functions and pipe the result of that function has first parameter of the next function. Something like pipe operator on Erlang, Elixir or others functional programming languages.

This is a very little library, that all this is a currying function.

After do some benchmark y create the same functionality using classes, because classes are more fast.

With functions x 20,242 ops/sec ±6.54% (70 runs sampled)
With Classes x 381,338 ops/sec ±5.22% (70 runs sampled)

New sintax for the class

var _pipe = require('pipeable').default

var result = _pipe([1,2,3])
  .pipe(function(value) {
    return value.map(function(item) {
      return item + item
    })
  })
  .result() // return => [2,4,6]

Example using the old function pipe

var _pipe = require('pipeable').Pipeable

var arrayPiped = _pipe([1,2,3]) // return a Pipe function that carry the array [1,2,3]

var arrayMaped = arrayPiped(function(value) {
  return value.map(function(item) {
    return item + item
  })
}) // return a Pipe function that carry the result of the map

arrayMaped() // return the value of the currying => [2,4,6]
Can be used chaining functions
_pipe([1,2,3])(function(value) {
  return value.map(function(item) {
    return item + item
  })
})() // return the value of the currying => [2,4,6]

Keywords

FAQs

Package last updated on 16 Nov 2015

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