# callbag-common

> common callbags

Latest version **0.1.8** (published 2021-03-11) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2021-03-11 |
| First published | 2020-11-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 16 |
| Unpacked size | 26.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Eugene Ghanizadeh Khoub |
| Maintainers | lorean.victor |
| Keywords | callbag, reactive |

## Links

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

## Dependencies (16)

- [callbag](https://npm.io/package/callbag.md) ^1.4.0
- [callbag-of](https://npm.io/package/callbag-of.md) ^2.0.0
- [callbag-map](https://npm.io/package/callbag-map.md) ^1.1.0
- [callbag-expr](https://npm.io/package/callbag-expr.md) ^0.2.0
- [callbag-pipe](https://npm.io/package/callbag-pipe.md) ^1.2.0
- [callbag-scan](https://npm.io/package/callbag-scan.md) ^1.1.0
- [callbag-take](https://npm.io/package/callbag-take.md) ^1.5.0
- [callbag-merge](https://npm.io/package/callbag-merge.md) ^3.2.2
- [callbag-filter](https://npm.io/package/callbag-filter.md) ^1.1.0
- [callbag-combine](https://npm.io/package/callbag-combine.md) ^1.2.0
- [callbag-flatten](https://npm.io/package/callbag-flatten.md) ^1.7.0
- [callbag-debounce](https://npm.io/package/callbag-debounce.md) ^2.1.3
- [callbag-interval](https://npm.io/package/callbag-interval.md) ^1.2.0
- [callbag-subscribe](https://npm.io/package/callbag-subscribe.md) ^1.5.1
- [callbag-from-event](https://npm.io/package/callbag-from-event.md) ^1.3.0
- [callbag-from-promise](https://npm.io/package/callbag-from-promise.md) ^1.3.0

## Recent versions

- 0.1.8 (latest) — 2021-03-11
- 0.1.7 — 2021-03-11
- 0.1.6 — 2021-03-11
- 0.1.5 — 2021-01-15
- 0.1.4 — 2021-01-14
- 0.1.3 — 2020-12-17
- 0.1.2 — 2020-11-30
- 0.1.1 — 2020-11-30
- 0.1.0 — 2020-11-27
- 0.0.1 — 2020-11-27

## README

<div align="center">
  <img src="/callbag.svg" width="156"/>
  <br><br>
  <h1>callbag-common</h1>
  
  [![tests](https://img.shields.io/github/workflow/status/loreanvictor/callbag-common/Test?label=tests&logo=mocha&logoColor=green&style=flat-square)](https://github.com/loreanvictor/callbag-common/actions?query=workflow%3A%22Test%22)
[![version](https://img.shields.io/npm/v/callbag-common?logo=npm&style=flat-square)](https://www.npmjs.com/package/callbag-common)
[![docs](https://img.shields.io/badge/%20-docs-blue?logo=read%20the%20docs&logoColor=white&style=flat-square)](https://loreanvictor.github.io/callbag-common/)
</div>

A collection of commonly used utilities for creating / working with reactive streams or iterables.
Included utilities follow the [callbag specification](https://github.com/callbag/callbag).
```bash
npm i callbag-common
```

👉 [Read the docs](https://loreanvictor.github.io/callbag-common/)

👉 If you do not know what reactive streams or callbags are,
  [read this post first](https://loreanvictor.github.io/callbag-common/what-are-callbags).

<br>

## Included Utilities

### Source Factories

- [of](https://loreanvictor.github.io/callbag-common/factory/of): Convert static value(s) to a callbag.
- [fromEvent](https://loreanvictor.github.io/callbag-common/factory/from-event): Listen to DOM event.
- [fromPromise](https://loreanvictor.github.io/callbag-common/factory/from-promise): Converts a promise to a callbag.
- [interval](https://loreanvictor.github.io/callbag-common/factory/interval): Emits an increasing number at given intervals.

### Operators

- [map](https://loreanvictor.github.io/callbag-common/operator/map): Transforms incoming values.
- [filter](https://loreanvictor.github.io/callbag-common/operator/filter): Filters incoming values.
- [take](https://loreanvictor.github.io/callbag-common/operator/take): Take a maximum number of values from source.
- [startWith](https://loreanvictor.github.io/callbag-common/operator/start-with): Start with given values.
- [scan](https://loreanvictor.github.io/callbag-common/operator/scan): Combine consecutive values from source.
- [flatten](https://loreanvictor.github.io/callbag-common/operator/flatten): Flattens higher-order callbags.
- [debounce](https://loreanvictor.github.io/callbag-common/operator/debounce): Debounces incoming values.


### Comination

- [expr](https://loreanvictor.github.io/callbag-common/combine/expr): Create expressions from other callbags.
- [merge](https://loreanvictor.github.io/callbag-common/combine/merge): Merges given callbags, emitting when each one emits.
- [combine](https://loreanvictor.github.io/callbag-common/combine/combine): Combines given callbags, emits arrays of latest values of each.

### Utilities

- [pipe](https://loreanvictor.github.io/callbag-common/util/pipe): Pipes sources to operators to sinks.
- [subscribe](https://loreanvictor.github.io/callbag-common/util/subscribe): Subscribes to given callbag.
- [tap](https://loreanvictor.github.io/callbag-common/util/tap): Taps into given callbag (without subscribing).
- [source](https://loreanvictor.github.io/callbag-common/util/source): Converts non-callbags to callbag sources.

<br>

<br>

## Why?

[callbag-basics](https://github.com/staltz/callbag-basics) is maintained _relatively_ slowly, specifically due to the fragmantation
of both utilities included and export targets (for example `tap()` is missing since it lacks types, or examples 
on the README are not working due to environment differences).

In callbag-commons, on the other hand:

- Callbags are picked based on active usage in real-life projects.
- Specifically targeting TypeScript / ES6 (no pre-bundled version as that means no tree-shaking).
- External libraries used, whenever possible.
- Internal alternatives used, whenever external library not possible.

So ideally, in the long run, this should be not _much_ different from callbag-basics. It will basically be
_eventually decentralized_ and _always available_ (everything working in target environments properly).

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