# babel-plugin-pipe-composition

> Overload the bitwise operators (``) to provide F# like pipe forward/backward behavior

Latest version **0.1.1** (published 2016-08-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-pipe-composition
pnpm add babel-plugin-pipe-composition
yarn add babel-plugin-pipe-composition
bun add babel-plugin-pipe-composition
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2016-08-29 |
| First published | 2016-08-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | Michael Mitchell |
| Maintainers | michaelmitchell |
| Keywords | babel, babel-plugin, pipe, pipe operator, pipe forward, pipe backward, pipeline, pipe operator |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-pipe-composition
- Repository: https://github.com/michaelmitchell/babel-plugin-pipe-composition
- Issues: https://github.com/michaelmitchell/babel-plugin-pipe-composition/issues
- npm.io page: https://npm.io/package/babel-plugin-pipe-composition

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2016-08-29
- 0.1.0 — 2016-08-27

## README

[![github tag](https://img.shields.io/github/tag/michaelmitchell/babel-plugin-pipe-composition.svg?maxAge=2592000)]()
[![npm version](https://badge.fury.io/js/babel-plugin-pipe-composition.svg)](https://badge.fury.io/js/babel-plugin-pipe-composition)
[![npm license](https://img.shields.io/npm/l/babel-plugin-pipe-composition.svg?maxAge=2592000)]()
[![build status](https://travis-ci.org/michaelmitchell/babel-plugin-pipe-composition.svg?branch=master)](https://travis-ci.org/michaelmitchell/babel-plugin-pipe-composition)
[![known vulnerabilities](https://snyk.io/test/npm/babel-plugin-pipe-composition/badge.svg)](https://snyk.io/test/npm/babel-plugin-pipe-composition)

# babel-plugin-pipe-composition

Overload the bitwise operators (`<<`) and (`>>`) to provide to provide F# like pipe forward/backward behavior

This is an alternative to [babel-plugin-pipe-operator](https://github.com/miraks/babel-plugin-pipe-operator) and [babel-plugin-pipe-operator-curry](https://github.com/miraks/babel-plugin-pipe-operator-curry) and favors the currying approach.

## Examples

```javascript
import { map, filter } from 'lodash';

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

let result = array
  >> map(n => n * 2)
  >> filter(n => n % 3 == 0);

let result = filter(n => n % 3 == 0)
  << map(n => n * 2)
  << array;
```

## Disabling in current scope

If you want to use the original bitwise operators, you can disable this plugin in current scope (and child scopes) using `"no pipe"` directive

```javascript
const fn = () => {
  const arr = [1, 2, 3] >> map(n => n + 1);

  return () => {
    "no pipe";

    arr.map(n => n >> 1);
  };
};

const fn = () => {
  const arr =  map(n => n + 1) << [1, 2, 3];

  return () => {
    "no pipe";

    arr.map(n => 1 << n);
  };
};
```

## Installation

```sh
$ npm install --save-dev babel-plugin-pipe-composition
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["pipe-composition"]
}
```

### Via CLI

```sh
$ babel --plugins pipe-composition script.js
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  plugins: ["pipe-composition"]
});
```

# License

MIT

---
_Source: https://npm.io/package/babel-plugin-pipe-composition · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
