# object-pipe

> Use pipeline with any Object.

Latest version **1.0.0** (published 2018-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install object-pipe
pnpm add object-pipe
yarn add object-pipe
bun add object-pipe
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-08-05 |
| First published | 2018-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Nigelk |
| Maintainers | nigelkozlowski |

## Links

- npm: https://www.npmjs.com/package/object-pipe
- Repository: https://github.com/super-javascript/object-pipe
- Homepage: https://github.com/super-javascript/object-pipe#readme
- Issues: https://github.com/super-javascript/object-pipe/issues
- npm.io page: https://npm.io/package/object-pipe

## Dependencies (1)

- [tape](https://npm.io/package/tape.md) ^4.9.1

## Recent versions

- 1.0.0 (latest) — 2018-08-05

## README

# object-pipe [![Build Status](https://travis-ci.com/kozlown/super-curry.svg?branch=master)](https://travis-ci.com/kozlown/object-pipe) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Extend Object prototype with pipe function.

## Installation

```bash
yarn add object-pipe
```
or
```bash
npm install object-pipe
```

## Usage

```js
require('object-pipe')()
```
Nothing else needed, this will mutate the Object prototype.
By default the pipe function is named `do` and it's used like this in the examples below.

But you can setup another name for it
```js
require('object-pipe')('pipe')
// the pipe function will be 'pipe'
```

## Examples

### Double

```js
require('object-pipe')()

function double () {
  return this + this
  // 'this' is referring to the object calling the pipe function
}

console.info((5).do(double)) // 10

console.info('Hey'.do(double)) // "HeyHey"

console.info([1, 2, 3].do(double)) // "1,2,31,2,3"
```

### Reduce on string
```js
require('object-pipe')()
const reduce = Array.prototype.reduce
const sumFunction = (accumulator, number) => accumulator + parseInt(number)

let sum = '13544862'.do(reduce, sumFunction, 0)

console.info(sum) // 33

sum = sum.toString().do(reduce, sumFunction, 0)

console.info(sum) // 6
```

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