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

@snivio/numpy

v1.0.1

Published

A comprehensive NumPy-like numerical computing library for TypeScript/JavaScript

Readme

@snivio/numpy

NumPy, but for TypeScript. No Python runtime, no WASM blobs, no nonsense. Just typed arrays and math.

If you've ever wished you could np.linalg.solve() in a Node script without spinning up a Jupyter notebook, this is for you.


Install

npm install @snivio/numpy

Works in Node 16+, Bun, Deno, and any bundler (Vite, webpack, esbuild). Ships ESM + CJS + full .d.ts types.


Quick Start

import np, { array, zeros, arange, linspace } from "@snivio/numpy";

// vectors & matrices
const v = array([1, 2, 3, 4, 5]);
const m = arange(0, 12).reshape([3, 4]);

// element-wise math (broadcasting just works)
const doubled = np.multiply(v, 2);
const normed = np.divide(v, np.sqrt(np.sum(np.power(v, 2))));

// linear algebra
const A = array([
  [2, 1],
  [5, 7],
]);
const b = array([11, 13]);
const x = np.linalg.solve(A, b); // solves Ax = b

// statistics
np.mean(v); // 3
np.std(v); // 1.414...
np.corrcoef(v, v); // [[1, 1], [1, 1]]

// random (seeded for reproducibility)
np.random.seed(42);
const noise = np.random.randn(100, 100); // 100x100 gaussian noise

What's Inside

| Module | Highlights | | ---------------- | ---------------------------------------------------------------------------- | | Core | N-dim typed arrays, strides, broadcasting, slicing with steps | | Creation | zeros, ones, full, arange, linspace, eye, diag, tile | | Math | All the trig, exp/log, floor/ceil, clip, element-wise comparisons | | Linalg | det, inv, solve, eig, svd, qr, cholesky, norm | | Stats | mean, median, std, var, corrcoef, cov, histogram | | Random | Xorshift128+ PRNG, normal, uniform, poisson, gamma, beta, choice | | FFT | Cooley-Tukey radix-2: fft, ifft, fft2, fftfreq, fftshift | | Manipulation | concat, stack, split, flip, rot90, unique, where, meshgrid |


API Cheat Sheet

Array Creation

np.array([
  [1, 2],
  [3, 4],
]); // from nested arrays
np.zeros([3, 3]); // 3×3 of zeros
np.ones([2, 4], "float32"); // with explicit dtype
np.arange(0, 10, 0.5); // [0, 0.5, 1, ..., 9.5]
np.linspace(0, 1, 50); // 50 points from 0 to 1
np.eye(4); // 4×4 identity
np.diag([1, 2, 3]); // diagonal matrix

Math (element-wise)

np.add(a, b)        np.subtract(a, b)
np.multiply(a, b)   np.divide(a, b)
np.power(a, 2)      np.sqrt(a)
np.sin(a)           np.exp(a)
np.log(a)           np.clip(a, 0, 1)
np.abs(a)           np.round(a)

Linear Algebra

np.dot(a, b); // dot product / matmul
np.linalg.det(A); // determinant
np.linalg.inv(A); // inverse
np.linalg.solve(A, b); // solve linear system
np.linalg.eig(A); // eigenvalues & vectors
np.linalg.svd(A); // singular value decomposition
np.linalg.norm(v); // L2 norm
np.linalg.qr(A); // QR decomposition
np.linalg.cholesky(A); // Cholesky factorization

Statistics

np.mean(a)          np.median(a)
np.std(a)           np.var_(a)
np.min(a)           np.max(a)
np.sum(a, axis)     np.prod(a, axis)
np.corrcoef(x, y)   np.cov(x, y)
np.percentile(a, 75)
np.histogram(a, 10)

Random

np.random.seed(123); // reproducible
np.random.rand(3, 3); // uniform [0, 1)
np.random.randn(3, 3); // standard normal
np.random.randint(0, 100, [5]); // random ints
np.random.normal(0, 1, [1000]); // gaussian
np.random.choice(a, 5); // sample
np.random.shuffle(a); // in-place shuffle

Manipulation

a.reshape([2, 6])         a.transpose()
a.flatten()               a.slice([...])
np.concatenate([a, b])    np.stack([a, b])
np.flip(a)                np.rot90(a)
np.unique(a)              np.where(cond, x, y)
np.diff(a)                np.cumsum(a)
np.meshgrid(x, y)         np.outer(a, b)

Dtypes

Backed by real TypedArrays, no boxing overhead.

float64 (default) · float32 · int32 · int16 · int8 · uint32 · uint16 · uint8 · bool

const a = np.zeros([1000, 1000], "float32"); // ~4MB instead of ~8MB
const b = a.astype("int32");

Why This Exists

Python's NumPy is fantastic but sometimes you just need to crunch numbers in a TypeScript codebase without crossing language boundaries. This library gives you the same mental model (shapes, broadcasting, axis-based reductions) in a package you can import and go.

Not a 1:1 port (no C extensions here), but covers the 90% of NumPy that most people actually use day-to-day.


Contributing

PRs welcome. Run the test suite before submitting:

npm test        # 68 tests via vitest
npm run lint    # eslint
npm run build   # tsup, outputs cjs + esm + .d.ts

License

MIT