# callbag-first

> Emit the first value

Latest version **1.1.2** (published 2018-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install callbag-first
pnpm add callbag-first
yarn add callbag-first
bun add callbag-first
```

## 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.1.2 |
| Published | 2018-03-05 |
| First published | 2018-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jinahm |
| Maintainers | jinahm |
| Keywords | callbag, first |

## Links

- npm: https://www.npmjs.com/package/callbag-first
- Repository: https://github.com/MartyJiang/callbag-first
- Homepage: https://github.com/MartyJiang/callbag-first#readme
- Issues: https://github.com/MartyJiang/callbag-first/issues
- npm.io page: https://npm.io/package/callbag-first

## Recent versions

- 1.1.2 (latest) — 2018-03-05
- 1.1.1 — 2018-02-05
- 1.1.0 — 2018-02-05
- 1.0.0 — 2018-02-03

## README

# callbag-first

[Callbag](https://github.com/callbag/callbag) operator that emit the first value emitted from source on completion, based on provided expression.

`npm install callbag-first`

`first(predicate?: (v: any) => Boolean, resultSelector?: (v: any) => any)`

```javascript
const {
  forEach,
  interval,
  pipe,
  fromIter
} = require('callbag-basics');

const first = require('callbag-first');

pipe(
  fromIter([1, 2, 3, 4]),
  first(),
  forEach(v => console.log(v)) // 1
);

pipe(
  fromIter([1, 2, 3, 4]),
  first(v => v > 3),
  forEach(v => console.log(v)) // 4
);

pipe(
  fromIter([1, 2, 3, 4]),
  first(v => v > 3, v => `value: ${v}`),
  forEach(v => console.log(v)) // value: 4
);
```

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