JSPM

babel-plugin-pull

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q12170F
  • License MIT

Transform pipeline operator into pull(...) calls

Package Exports

  • babel-plugin-pull

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-pull) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-plugin-pull

Transform pipeline operator into pull(...) calls

This inspired from similar pipe operator plugins to use pull-stream, which provides you a whole ecosystem + composing them together!

Install

npm install --save-dev babel-plugin-pull

# with yarn:
yarn add --dev babel-plugin-pull

Then load it in your Babel config:

{
  "plugins": ["pull"]
}

Usage

It takes input as such:

source()
| through()
| sink()

And transforms to:

pull(
  source(),
  through(),
  sink()
)

This allows you to use duplex streams, and compose them!

Composition

You can create streams from other streams:

// Create a source:
var foo = source() | through()

// Create a through:
var bar = through() | through()

// Create a sink:
var qux = through() | through() | sink()

// Reuse any of them in another pipeline:
foo | bar | qux

This would transform to:

var foo = pull(source(), through())

var bar = pull(through(), through())

var qux = pull(through(), through(), sink())

pull(foo, bar, qux)