# enchain

> Method chaining DSL builder

Latest version **0.0.1** (published 2013-01-20) · 0 weekly downloads

## Install

```sh
npm install enchain
pnpm add enchain
yarn add enchain
bun add enchain
```

## 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.0.1 |
| Published | 2013-01-20 |
| First published | 2013-01-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 1 |
| Author | Irakli Gozalishvili |
| Maintainers | gozala |
| Keywords | enchain, dsl, chaining, method |

## Links

- npm: https://www.npmjs.com/package/enchain
- Repository: https://github.com/Gozala/enchain
- Issues: http://github.com/Gozala/enchain/issues/
- npm.io page: https://npm.io/package/enchain

## Recent versions

- 0.0.1 (latest) — 2013-01-20

## README

# enchain

[![Build Status](https://secure.travis-ci.org/Gozala/enchain.png)](http://travis-ci.org/Gozala/enchain)


[![Browser support](http://ci.testling.com/Gozala/enchain.png)](http://ci.testling.com/Gozala/enchain)


There are cases when you may prefer method chaining API over plain functions.
Libraries like [jQuery][] and [underscore][] include chaining facilities with
them to address these use cases, although chaining is different problem and
can (and there for should) be solved separately. Enchain solves just a chaining
problem so libraries can concentrate on their actual problems and let users
figure how they wanna chain them.

## API

```js
var enchain = require("enchain")
var reducers = require("reducers")
var chain = enchain(reducers)


chain([ 1, 2, 3, 4, 5, 6 ]).
  map(function(x) { return x + 1 }).
  filter(function(x) { return x % 2 }).
  concat([ "a", "b" ]).
  into([]).
  valueOf() // will return actual value rather then chainable DSL

// => [ 3, 5, 7, 'a', 'b' ]
```

Note that result of each method call is a chainable DSL, and in order to
get actual result `.valueOf()` needs to be called. Although second set of
functions maybe provided to make `valueOf()` call implicit:

```js
var enchain = require("enchain")
var reducers = require("reducers")
var chain = enchain(reducers, {
  print: reducers.print,
  fold: reducers.fold
})

chain([ 1, 2, 3, 4, 5, 6 ]).
  map(function(x) { return x + 1 }, 3).
  filter(function(x) { return x % 2 }).
  fold(function(x, y) { return x + y }, 0)

// => 15
```

## Install

    npm install enchain

[underscore]:http://documentcloud.github.com/underscore/
[jQuery]:http://jquery.com/
[reducers]:https://github.com/Gozala/reducers

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