1.0.0 • Published 6 years ago

@rung/babel-plugin-pipe-operator v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

@rung/babel-plugin-pipe-operator

This work is a fork of a fork. It's based on https://github.com/Swizz/babel-plugin-pipe-operator-curry, however, it integrates without problems with other plugins.

Examples

import { mean, round } from 'lodash';

const array = [1, 2, 3, 4, 5];

array
| mean
| round

Turn into

import { mean, round } from 'lodash';

const array = [1, 2, 3, 4, 5];

(round)((mean)(array))

Disabling in current scope

If you want to use the original pipe operator, you can disable this plugin in current scope (and it children scopes) using "no pipe" directive as described in the original one.

Installation

$ npm install --save-dev @rung/babel-plugin-pipe-operator

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["@rung/pipe-operator-curry"]
}

Via CLI

$ babel --plugins @rung/pipe-operator-curry script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["@rung/pipe-operator-curry"]
});

License

MIT