aeon-core
v0.3.1
Published
Denotationally-designed reactive streams for TypeScript
Maintainers
Readme
aeon-core
The main package of Aeon, a denotationally-designed reactive programming library for TypeScript.
Aeon provides two core abstractions with precise mathematical semantics:
Event<A, E>— a discrete stream of time-stamped values with a typed error channelBehavior<A, E>— a continuous function from time to a value, evaluated lazily when sampled
Features
- Denotational semantics — every combinator has a formal mathematical meaning
- Typed error channel —
E = nevermeans a stream provably cannot fail - V8-optimized — monomorphic sink classes, hidden class discipline, construction-time pipeline fusion
- Three API styles — data-first composition,
pipe()with data-last curried operators (P.*), fluent chainable methods - Behaviors — continuous-time values with generation-based dirty-flag caching, plus numerical integration and differentiation
- Comprehensive — 50+ operators covering transforms, slicing, combining, higher-order, error handling, time, and aggregation
- Small — 1.5 KB gzipped minimal import, 8.3 KB full library
Installation
pnpm add aeon-core aeon-schedulerQuick Start
import { fromArray, map, filter, observe } from "aeon-core";
import { DefaultScheduler } from "aeon-scheduler";
const scheduler = new DefaultScheduler();
await observe(
(v) => console.log(v),
map(
(x) => x * 2,
filter((x) => x % 2 === 0, fromArray([1, 2, 3, 4, 5])),
),
scheduler,
);
// 4, 8Using pipe
import { fromArray, pipe, observe, P } from "aeon-core";
import { DefaultScheduler } from "aeon-scheduler";
const result = pipe(
fromArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
P.filter((x) => x % 2 === 0),
P.map((x) => x * 2),
P.take(3),
);
await observe((v) => console.log(v), result, new DefaultScheduler());
// 4, 8, 12Using the fluent API
import { fromArray, fluent } from "aeon-core";
import { DefaultScheduler } from "aeon-scheduler";
await fluent(fromArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
.filter((x) => x % 2 === 0)
.map((x) => x * 2)
.take(3)
.observe((v) => console.log(v), new DefaultScheduler());
// 4, 8, 12Documentation
- Main README
- Getting Started
- Denotational Semantics
- Optimizations
- Migration from RxJS
- Migration from @most/core
License
MIT
