babel-plugin-transform-opipe
Version:
A babel parser and plugin implementing the opipe operator, to easily pipe an object.
42 lines (29 loc) • 1.52 kB
Markdown
# babel-plugin-transform-opipe     
> A babel parser and plugin implementing the opipe operator, to easily pipe an object.
```javascript
const _ = require('lodash');
const ten = [1,2,3,4]
:| _.filter( n=>n%2 ) // [1,3]
:| _.map( n=>n**2 ) // [1,9]
:| _.sum(); // 10
```
- [Installation](#installation)
- [Opipe operator](#opipe-operator)
- [Quickstart](#quickstart)
## Installation
```bash
npm install --save-dev babel-plugin-transform-opipe
```
## Opipe operator
The opipe operator is defined as following:
```javascript
a :| b(...args) ≡ b(a, ...args)
```
It's handy to quickly and easily pipe objects through method-like-functions that accept their logical `this` as the first parameter.
## Quickstart
Install the babel suite, enable this plugin, then use babel to transpile your code
The easiest way to get started, is the following:
```javascript
npm install --save babel-plugin-transform-opipe babel-meta
npx babel-node --plugins='babel-plugin-transform-opipe' your_opipeful_file.js
```