Mirror: 🎩 A tiny but capable push & pull stream library for TypeScript and Flow
1# Wonka 2 3A fast push & pull stream library for Reason, loosely following the [callbag spec](https://github.com/callbag/callbag) 4 5[![Build Status](https://travis-ci.org/kitten/wonka.svg?branch=master)](https://travis-ci.org/kitten/wonka) 6[![Coverage Status](https://coveralls.io/repos/github/kitten/wonka/badge.svg?branch=master)](https://coveralls.io/github/kitten/wonka?branch=master) 7[![npm](https://img.shields.io/npm/v/wonka.svg)](https://www.npmjs.com/package/wonka) 8[![npm](https://img.shields.io/npm/l/wonka.svg)](https://www.npmjs.com/package/wonka) 9 10> “There’s no earthly way of knowing<br> 11> Which direction we are going<br> 12> There’s no knowing where we’re rowing<br> 13> Or which way the river’s flowing” - **Willy Wonka** 14 15<br> 16 17![Wonka](/docs/wonka.jpg?raw=true) 18 19* [What is `Wonka`](#what-is-wonka) 20* [Why it exists](#why-it-exists) 21* [Installation](#installation) 22* [Getting Started](#getting-started) 23* [Documentation (In Progress)](#documentation) 24 25## What is `Wonka` 26 27`Wonka` is a library for lightweight observables and iterables loosely based on the [callbag spec](https://github.com/callbag/callbag). 28It exposes a set of helpers to create and transform sources and output sinks, meaning it helps you to turn an event source or an 29iterable set of data into streams, and manipulate these streams. 30 31Reason has been becoming increasingly popular, but it's missing a good pattern for streams that feels native to the language. 32The functional nature of callbags make them a perfect starting point to fix this, and to introduce a reactive programming 33pattern to a language that is well suited for it. 34 35This library also attempts to support as many Reason/JS environments as possible, which makes the adoption of streams across 36multiple projects a lot easier. Hence `Wonka` is a library that aims to make complex streams of data easy to deal with. 37 38## Compatibility 39 40`Wonka` is not only compatible with Reason/Bucklescript, but out of the box with other environments as well. 41 42- TypeScript 43- JS/Flow 44- Reason/OCaml Bucklescript 45- Reason/OCaml `bs-native` 46- Reason/OCaml Dune 47 48In summary, it should work in any TypeScript/Flow/Reason/OCaml environment with full type safety. 49 50## Installation 51 52Install the library first: `yarn add wonka` or `npm install --save wonka`, 53 54### BuckleScript 55 56For Bucklescript you will also need to add `wonka` to `bs-dependencies` in your `bsconfig.json` file like so: 57 58```diff 59{ 60 "name": "<your name>", 61 "version": "0.1.0", 62 "sources": ["src"], 63 "bsc-flags": ["-bs-super-errors"], 64 "bs-dependencies": [ 65+ "wonka" 66 ] 67} 68``` 69 70## Documentation 71 72This is still a work-in-progress but will contain full information on the following 73across all supported languages: 74 75- The API, i.e. a list of all helpers 76- Examples 77- Usage Guides & Recipes 78- Developer Guides (How to write a source/operator/sink) 79- Modified Callbag spec 80