npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jarenjs/calc

v0.91.4

Published

A native, headless multi-mode calculator (standard / programmer / scientific / financial / converter) with x·y and x·y·z plotting rendered as pure-vnode SVG through @jarenjs/view — a two-stage expression compiler (parseExpression ⇄ toExpression), built on

Readme

@jarenjs/calc

A native, headless multi-mode calculator for the jarenjs stack: standard / scientific / programmer / financial / converter, with x·y and x·y·z plotting rendered as pure-vnode SVG through @jarenjs/view. The calculator is an @jarenjs/app document (state is JSON, keys are data bindings, transitions are copy-on-write RFC-6902 patches), and it is built on @jarenjs/core — it holds no formulas or unit factors of its own.

Zero runtime dependencies beyond @jarenjs/*. No eval, no new Function (CSP-safe). SSR-able and deterministic.

Two layers

  • Engine (@jarenjs/calc) — pure functions over data. A two-stage expression compiler parseExpression(text) → ExprAST → compileExpr → (scope) => value, its canonical printer toExpression (a round-trip fixed point), and plot2d/plot3d/calcToVnode (pure-vnode SVG). Imports only @jarenjs/core + @jarenjs/view.
  • Component (@jarenjs/calc/component) — the @jarenjs/app glue: createCalcComponent() → { initialState, actions, mode, rules, effects, subs, viewModel, createApp }, the keypad/panel JSLT view, the financial @jarenjs/forms panel, and the live crypto/fiat rates layer.
import { evaluate, parseExpression, toExpression, plot2d, toSvgString } from '@jarenjs/calc';

evaluate('sin(pi/2) + 2^10').value;          // 1025
toExpression(parseExpression('a-(b-c)'));    // "a - (b - c)"
toSvgString(plot2d('sin(x)', { domain: [-6.28, 6.28] })); // standalone SVG
import { createCalcComponent } from '@jarenjs/calc/component';
const calc = createCalcComponent({ provider: 'coingecko' });
const app = calc.createApp({ node: document.getElementById('calc') });

createCalcComponent({ codes, fallbackRates }) uses those currency choices and fallback rates for its exposed configuration and both initialization paths. Programmer Equals records the selected base on the tape; grouping spaces stay out of the committed expression so it can be used in the next calculation.

The numeric kernel lives in @jarenjs/core

Reusable primitives were pushed down into core, so any package can use them: @jarenjs/core/math (transcendentals, word.js BigInt word math, solve.js root finders, mat4/project.js 3D kernel, format.js), @jarenjs/core/finance (TVM, cash-flow, amortization, interest, depreciation, bond, indicators, returns) and @jarenjs/core/convert (fixed-factor dimensional conversion + the pure convertCurrency rate-table primitive). The calculator's financial mode calls core/finance; its converter calls core/convert. Core is pure and never fetches.

Changing the converter dimension updates its unit selections in the same transition. Existing choices survive when the new dimension offers them; otherwise it selects the first two available units (the same unit for both sides when only one exists). Currency choices come from the current rate table. A dimension with no available units leaves the conversion unchanged.

Live currency (the maturity example)

The converter's currency dimension takes live crypto+fiat rates from free public tickers (CoinGecko default, Binance alternative) through an @jarenjs/app effect + a when-gated polling subscription. The pure conversion is @jarenjs/core/convert's convertCurrency; only the fetch is component-side. A static fallback table keeps the converter, SSR and offline tests working with no network; failures route to an error action. When refreshes overlap, only the newest request may publish success or failure; an older completion cannot replace its rates or clear its in-flight status.

See docs/CALC-FORMAT.md and ARCHITECTURE.md for the full contract.

Exports

Every subpath a consumer can import, derived from the manifest by npm run docs:derive (npm run docs:check fails when the two drift):

| Import | Kind | Declarations | |---|---|---| | @jarenjs/calc | JavaScript | declared | | @jarenjs/calc/component | JavaScript | declared | | @jarenjs/calc/theme | JavaScript | declared | | @jarenjs/calc/styles/calc.css | asset | — | | @jarenjs/calc/schemas/financial-inputs.schema.json | schema | — | | @jarenjs/calc/schemas/jaren-calc-ast.schema.json | schema | — | | @jarenjs/calc/schemas/jaren-calc-state.schema.json | schema | — | | @jarenjs/calc/package.json | metadata | — |