Skip to content

Swizz/babel-plugin-pipe-operator-curry

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-pipe-operator-curry

This work is an alternative to babel-plugin-pipe-operator. I choosed to implement pipe operator with the currying way instead of putting flow as the first callable arguments.

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 babel-plugin-pipe-operator-curry

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["pipe-operator-curry"]
}

Via CLI

$ babel --plugins pipe-operator-curry script.js

Via Node API

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

License

MIT

Packages

No packages published

Languages

  • JavaScript 100.0%