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

@stackline/ndarray-ops

v1.0.3

Published

Dependency-free, CSP-safe elementwise and aggregate operations for ndarrays

Readme

@stackline/ndarray-ops

Dependency-free, CSP-safe elementwise and aggregate operations for ndarrays.

npm version license GitHub repository Docs Reddit community

Documentation | npm | Issues | Repository

Current package version: 1.0.3


Why this package?

A dependency-free, CSP-safe continuation of [email protected]. It preserves the complete 150-function CommonJS API, including the historical ndarray-ops.js deep entry, while adding native ESM, a classic-browser build, and first-party TypeScript 3.9 declarations.

Stackline maintains this package independently. It is not affiliated with or endorsed by the original project.

Compatibility

| Item | Value | | --- | --- | | Package | @stackline/[email protected] | | Node.js runtime | >=18.0.0 | | CommonJS / primary entry | ./ndarray-ops.js | | ES module entry | ./index.mjs | | Type declarations | ./index.d.ts |

Installation

Install

npm install @stackline/ndarray-ops

An identity-preserving migration keeps existing imports unchanged:

Usage

{
  "dependencies": {
    "ndarray-ops": "npm:@stackline/ndarray-ops@^1.0.1"
  }
}
const ops = require('ndarray-ops')
const same = require('ndarray-ops/ndarray-ops.js')

Native ESM supports both default and named imports:

import ops, { add, sum } from '@stackline/ndarray-ops'

Loading browser.js as a classic script exposes globalThis.ndarrayOps; AMD loaders receive the same operation object.

Declarations support TypeScript 3.9 CommonJS import assignment and synthetic default imports. Conditional named ESM declarations are selected by TypeScript 4.7 and later.

Features and Integrations

CSP and performance

Runtime code generation is not used. The package loads and runs under Node's string-code-generation prohibition and in a browser VM where Function construction is disabled. This removes the upstream unsafe-eval requirement.

Static typed paths for the common one-, two-, and three-dimensional layouts avoid the upstream compiler's cold specialization cost. CI also enforces a conservative hot-loop bound: a 15-case repeated-batch matrix of large contiguous and mixed-order operations must stay within 5x upstream and under 50 ms per call on the test host. That gate guards regressions; exact performance depends on runtime, dtype, rank, and layout.

See COMPATIBILITY_CONTRACT.md for traversal order, empty/rank-zero behavior, generic side effects, validation hardening, and exact return contracts.

Security

Review inputs and the package-specific compatibility limits before processing untrusted data. Report suspected vulnerabilities as described in the security policy.

API Surface

API

The package includes all upstream operator families:

  • arithmetic and bitwise: add, sub, mul, div, mod, band, bor, bxor, lshift, rshift, and rrshift;
  • logical and comparisons: and, or, eq, neq, lt, gt, leq, and geq;
  • unary and Math functions, including reversed atan2op* and powop* forms;
  • assign, assigns, random, equals, any, all, numeric norms and reductions, sup, inf, argmin, and argmax.

The historical suffixes remain: eq means in-place, s means a scalar right operand, seq combines both, and op reverses atan2 or pow operands. Every elementwise/mutating function returns its first ndarray argument.

Views may use arbitrary non-negative signed-32-bit integer shapes, positive, zero or negative signed-32-bit integer strides and offsets, and any permutation in order. Typed and generic (data.get/data.set) storage are supported. Shapes must match exactly across array arguments.

Local Development

git clone https://github.com/alexandroit/stackline-ndarray-ops.git
cd stackline-ndarray-ops
npm ci
npm run verify

Release tooling uses Node.js 24.20.0 and npm 11.19.0. The consumer runtime contract remains the one documented above.

Consumer Smoke Test

Run the repository's existing consumer/package check after installing development dependencies:

npm run test:smoke

Release Checklist

Run npm run verify and inspect the package contents before release. Publish a new version through the GitHub Actions publishing workflow, using the SHA-512 digest of the reviewed tarball. Verify the exact published version, tarball integrity, and npm provenance after the run.

License

MIT. Original runtime and DefinitelyTyped attribution is preserved in LICENSE, NOTICE, and THIRD_PARTY_LICENSES.md.

Credits and original authors

Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.

Community and Links

Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.