Alternative to babel-plugin-pipe-operator
npm install babel-plugin-pipe-operator-curryThis 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.
``javascript
import { mean, round } from 'lodash';
const array = [1, 2, 3, 4, 5];
array
| mean
| round
`
Turn into
`javascript
import { mean, round } from 'lodash';
const array = [1, 2, 3, 4, 5];
round(mean(array))
`
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.
`sh`
$ npm install --save-dev babel-plugin-pipe-operator-curry
.babelrc
`json`
{
"plugins": ["pipe-operator-curry"]
}
`sh`
$ babel --plugins pipe-operator-curry script.js
`javascript``
require("babel-core").transform("code", {
plugins: ["pipe-operator-curry"]
});
MIT