Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
A fast push & pull stream library for Reason, loosely following the [callbag spec](https://github.com/callbag/callbag)
The wonka package is a lightweight but powerful stream library for TypeScript and JavaScript. It allows for the creation, manipulation, and consumption of streams of values over time. It's particularly useful for handling asynchronous operations and events in a functional reactive programming style.
Creating streams
This feature allows for the creation of streams from various sources. In this example, a stream is created from an array.
import { fromArray } from 'wonka';
const stream = fromArray([1, 2, 3]);
Transforming streams
This feature demonstrates how to transform streams using operators like `map`. In the example, each value in the stream is doubled.
import { fromArray, map } from 'wonka';
const stream = fromArray([1, 2, 3]);
const doubled = map(x => x * 2)(stream);
Consuming streams
This feature shows how to consume streams. The `forEach` operator is used to log each value from the stream to the console.
import { fromArray, forEach } from 'wonka';
const stream = fromArray([1, 2, 3]);
forEach(x => console.log(x))(stream);
RxJS is a comprehensive library for reactive programming using Observables. It offers a wider range of operators than wonka, making it more powerful but also larger in size. It's well-suited for complex data flow scenarios.
xstream is a library designed for creating and working with streams of values. It's similar to wonka in its focus on streams but differs in API and operator availability. It's known for its simplicity and small bundle size.
Most.js is a high-performance reactive programming library. It focuses on providing a rich set of operators for composing asynchronous and event-based programs. It's known for its speed and efficiency compared to other streaming libraries.
A fast push & pull stream library for Reason, loosely following the callbag spec
“There’s no earthly way of knowing
Which direction we are going
There’s no knowing where we’re rowing
Or which way the river’s flowing” - Willy Wonka
Wonka
Wonka
is a library for lightweight observables and iterables loosely based on the callbag spec.
It exposes a set of helpers to create and transform sources and output sinks, meaning it helps you to turn an event source or an
iterable set of data into streams, and manipulate these streams.
Reason has been becoming increasingly popular, but it's missing a good pattern for streams that feels native to the language. The functional nature of callbags make them a perfect starting point to fix this, and to introduce a reactive programming pattern to a language that is well suited for it.
This library also attempts to support as many Reason/JS environments as possible, which makes the adoption of streams across
multiple projects a lot easier. Hence Wonka
is a library that aims to make complex streams of data easy to deal with.
Wonka
is not only compatible with Reason/Bucklescript, but out of the box with other environments as well.
bs-native
In summary, it should work in any TypeScript/Flow/Reason/OCaml environment with full type safety.
Install the library first: yarn add wonka
or npm install --save wonka
,
For Bucklescript you will also need to add wonka
to bs-dependencies
in your bsconfig.json
file like so:
{
"name": "<your name>",
"version": "0.1.0",
"sources": ["src"],
"bsc-flags": ["-bs-super-errors"],
"bs-dependencies": [
+ "wonka"
]
}
This is still a work-in-progress but will contain full information on the following across all supported languages:
FAQs
A tiny but capable push & pull stream library for TypeScript and Flow
The npm package wonka receives a total of 1,209,757 weekly downloads. As such, wonka popularity was classified as popular.
We found that wonka demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.