Registry / data / pondjs

pondjs

JSON →
library0.9.0jsnpmunverified

Pond.js is a JavaScript and TypeScript library built on `immutable.js`, providing robust, immutable data structures and processing capabilities for time-based data. It unifies the handling of time ranges, events, collections, and time series through specialized types like `TimeRange`, `TimeEvent`, and `TimeSeries`. The library also offers a powerful `Pipeline` API for advanced batch and stream processing, supporting operations such as windowing, grouping, and aggregation. Currently at version 0.9.0, Pond.js is actively developed and ships with comprehensive TypeScript declarations, with the project having been rewritten in TypeScript for its upcoming v1.0 alpha. Its focus on immutability and specialized time-based structures differentiates it for applications requiring consistent and reliable time-series data management.

npm install pondjs
INSTALL
IMPORT
SIG · PONDJS
P
pondjs
datajavascriptv0.9.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TimeSeries
import { TimeSeries } from 'pondjs'
const TimeSeries = require('pondjs').TimeSeries
Pond.js ships with ES module exports and TypeScript types. CommonJS `require` is discouraged.
TimeRange
import { TimeRange } from 'pondjs'
import TimeRange from 'pondjs/lib/TimeRange'
Use named imports from the main 'pondjs' package; direct `lib` imports are for internal use or older versions.
Pipeline
import { Pipeline } from 'pondjs'
import { Pipeline } from 'pondjs/dist/pipeline'
Ensure you are importing from the main entry point to leverage type definitions and proper module resolution.

Demonstrates creating a TimeSeries, performing a daily average rollup, calculating an overall average, and working with TimeRange intersections.

import { TimeSeries, TimeEvent, Collection, TimeRange } from 'pondjs'; // Example weather data for demonstration const weatherData = new Collection([ new TimeEvent(new Date('2024-01-01T00:00:00Z'), { value: 60 }), new TimeEvent(new Date('2024-01-01T01:00:00Z'), { value: 62 }), new TimeEvent(new Date('2024-01-01T02:00:00Z'), { value: 65 }), new TimeEvent(new Date('2024-01-02T00:00:00Z'), { value: 58 }), new TimeEvent(new Date('2024-01-02T01:00:00Z'), { value: 60 }), new TimeEvent(new Date('2024-01-02T02:00:00Z'), { value: 63 }), new TimeEvent(new Date('2024-01-03T00:00:00Z'), { value: 55 }) ]); const timeseries = new TimeSeries({ name: 'temperature', events: weatherData.toArray(), columns: ['time', 'value'] }); // Define aggregation function for average const avg = (events: TimeEvent[]) => { if (events.length === 0) { return null; } const sum = events.reduce((acc, event) => acc + event.get('value'), 0); return sum / events.length; }; // Perform daily average rollup on the 'value' column const dailyAvg = timeseries.fixedWindowRollup('1d', { value: avg }); console.log('Original TimeSeries events:', timeseries.events().map(e => e.data().toJSON())); console.log('\nDaily Average TimeSeries events:', dailyAvg.events().map(e => e.data().toJSON())); // Example: Get overall average value of a specific column const overallAvg = timeseries.avg('value'); console.log(`\nOverall average temperature: ${overallAvg}`); // Example: Create and intersect TimeRanges const tr1 = new TimeRange('2024-01-01T00:00:00Z', '2024-01-02T00:00:00Z'); const tr2 = new TimeRange('2024-01-01T12:00:00Z', '2024-01-02T12:00:00Z'); const intersection = tr1.intersection(tr2); console.log(`\nIntersection of TimeRanges: ${intersection ? intersection.toString() : 'No intersection'}`);
Debug
Known issues
breakingPond.js is currently in a pre-1.0 state (v0.9.0) and is actively being developed. While the project aims for stability, future minor or patch releases may introduce breaking changes or incomplete features as it integrates further into its maintainers' systems.
fix
Review the CHANGES.md for each update and pin exact versions to avoid unexpected behavior. Be prepared for potential API adjustments.
affects: >=0.x
breakingThe project is undergoing a rewrite in TypeScript for its upcoming v1.0 alpha. This will likely introduce significant breaking changes to the API, data structures, and internal implementations when it transitions from the 0.x series to 1.x.
fix
Monitor the project's development for the official 1.0 release. Expect a migration guide and plan for refactoring code when upgrading to 1.x versions.
affects: >=0.9.0
gotchaPond.js relies heavily on `immutable.js`. Attempting to directly mutate data structures like `TimeSeries` or `Collection` will not work as expected and can lead to unexpected behavior or errors. All modifications should be done using the library's provided methods which return new immutable instances.
fix
Always treat Pond.js objects as immutable. Use methods like `addEvent()`, `set()`, `map()`, `filter()`, etc., which return new instances rather than modifying the original.
affects: >=0.x
Errors
Common errors & fixes
TypeError: series.events is not a function
Attempting to call `.events()` on a plain JavaScript array or an object not instantiated as a `TimeSeries`.
fix
Ensure the variable `series` is an instance of `TimeSeries`. If working with raw data, create a new `TimeSeries` object: `new TimeSeries({ events: myRawDataArray })`.
Error: Immutable error: Not an Immutable object: [...]
This error typically occurs when a Pond.js method expects an `Immutable.js` data structure (e.g., `Immutable.List`, `Immutable.Map`), but receives a plain JavaScript array or object instead.
fix
Verify that any nested data within `TimeEvent` or `TimeSeries` is correctly converted to `Immutable.Map` or `Immutable.List` if the operation requires it, or ensure you are passing the correct type of data to Pond.js constructors/methods.
Upgrade
Version history
0.9.0latest on npm
Audit
Dependencies
immutablerequiredCore data structures are built on immutable.js
Agent activity
34 hits · last 30 days
node
32
OpenAI (training)
1
Resources
pondjs — npm install pondjs · libregistry