Alternative to babel-plugin-pipe-operator
npm install @rung/babel-plugin-pipe-operatorThis 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.
``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 @rung/babel-plugin-pipe-operator
.babelrc
`json`
{
"plugins": ["@rung/pipe-operator-curry"]
}
`sh`
$ babel --plugins @rung/pipe-operator-curry script.js
`javascript``
require("babel-core").transform("code", {
plugins: ["@rung/pipe-operator-curry"]
});
MIT