ranuts

A utility library for the front end and for Node, published as independent, tree-shakeable entry points. Import from the subpath that owns what you need and the rest never reaches your bundle. Everything is TypeScript, and every export is documented from source.

npm install ranuts
import { debounce } from 'ranuts/utils';

Entry points

Import Contains Runtime
ranuts Root barrel: the utils + visual surface browser + node
ranuts/utils DOM/BOM, string, object, number, colour, time, storage, … browser + node*
ranuts/node HTTP server, router, WebSocket, fs, streams, middleware node only
ranuts/visual 2D rendering engine (Canvas / WebGL / WebGPU) browser only
ranuts/i18n Translation engine: flat dictionaries, runtime switching browser + node
ranuts/sw Cache strategies and the precache protocol's worker half service worker
ranuts/vnode Snabbdom-style virtual DOM browser
ranuts/stream SSE parsing, model-stream fold, token budget browser + node
ranuts/conversation Event log → renderable conversation nodes browser + node

* ranuts/utils is broad: most of it is browser-oriented, but the pure helpers run anywhere. Do not import ranuts/node in browser code. It pulls in fs / http / child_process.

What's in it

Functional: debounce · throttle · once / singleFlight · QuestQueue · withTimeout / deferred · compose

Data: cloneDeep · isEqual · merge · filterObj · format / parse numbers · colour conversion and blending

Text: md5 · truncate · detectLanguage · resolveLocale · segmentByRanges · paginate · escapeHtml

Browser: storage · IndexedDB · worker client · postMessage bridge · prefetch · device detection · performance · ZIP · audio recording · speech to text

AI & chat: stream · conversation · i18n

Rendering: 2D engine · virtual DOM · canvas helpers · tween

Node: HTTP server and router · file operations · MIME types

That is a selection. The API reference has every export with its signature and description, generated from source so it cannot drift.

Where to go next

If you want to… Read
Find out whether a function exists, and its signature API reference
Decide between two similar utilities Choosing a utility
Browse by category Utility index
Render a streamed model response streamconversation
Build UI on top of it ranui

Both packages ship CLAUDE.md inside the npm tarball: orientation for coding agents, readable straight from node_modules with no network access.