# arrow.js

> Arrows in javascript.

Latest version **0.1.7** (published 2016-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install arrow.js
pnpm add arrow.js
yarn add arrow.js
bun add arrow.js
```

## 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.7 |
| Published | 2016-03-26 |
| First published | 2016-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Bruno Dias |
| Maintainers | diasbruno |
| Keywords | arrows, functional |

## Links

- npm: https://www.npmjs.com/package/arrow.js
- Repository: https://github.com/diasbruno/arrow.js
- Homepage: https://github.com/diasbruno/arrow.js#readme
- Issues: https://github.com/diasbruno/arrow.js/issues
- npm.io page: https://npm.io/package/arrow.js

## Dependencies (2)

- [daggy](https://npm.io/package/daggy.md) 0.0.1
- [fantasy-tuples](https://npm.io/package/fantasy-tuples.md) 0.0.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.1.7 (latest) — 2016-03-26
- 0.1.6 — 2016-03-26
- 0.1.5 — 2016-03-25
- 0.1.4 — 2016-03-24

## README

arrowjs
=======

John Hughes' arrows.

## Usage

- Arrow(f)

Given an function, it creates an arrow.

```javascript
function inc(val) {
  return v + 1;
}

Arrow(inc).run(1) == 2;
```

- Arrow.next(arrA, arrB)

Compose two arrows.

```javascript
function inc(v) {
  return v + 1;
}

function decr(v) {
  return v - 1;
}

Arrow(inc).next(Arrow(decr)).run(1) == Arrow.next(Arrow(inc), Arrow(decr)).run(1);
```

- Arrow.first(arr)

Given a tuple, it will run the arrow with the first element of the tuple.

```javascript
function inc(v) {
  return v + 1;
}

Arrow(inc).first().run({_1: 10, _2: 4}) == {_1: 11, _2: 4};
Arrow.first(Arr(inc)).run({_1: 10, _2: 4}) == {_1: 11, _2: 4};
```

- Arrow.second(arr)

Given a tuple, it will run the arrow with the second element of the tuple.

```javascript
function inc(v) {
  return v + 1;
}

Arrow(inc).second().run({_1: 10, _2: 4}) == {_1: 10, _2: 5};
Arrow.secondfirst(Arr(inc)).run({_1: 10, _2: 4}) == {_1: 10, _2: 5};
```

- Arrow.bifur(arrA, arrB)

Given two arrows, apply each arrow to a value and return a tuple.

```javascript
function inc(v) {
  return v + 1;
}

function decr(v) {
  return v - 1;
}

Arrow.bifur(Arrow(inc), Arrow(decr)).run(5) == {_1: 6, _2: 4};
```

- Arrow.prod(arrA, arrB)

Given two arrows, returns an arrow that receives a tuple and apply
each one to the correpondent in the tuple.

```javascript
function inc(v) {
  return v + 1;
}

function decr(v) {
  return v - 1;
}

Arrow.prod(Arrow(inc), Arrow(decr)).run({_1: 6, _2: 4}) == {_1: 7, _2: 3};
```

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