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

@brad_promptnow/vec3

v1.0.1

Published

Small, dependency-free 3D vector math for TypeScript and JavaScript.

Readme

@brad_promptnow/vec3

Small, dependency-free 3D vector math for TypeScript and JavaScript.

  • Plain objects ({ x, y, z }), no classes
  • Full TypeScript types included
  • Every function returns a new value and never modifies its inputs

Install

npm install @brad_promptnow/vec3

Quick start

import { v3_add, v3_cross, v3_length } from "@brad_promptnow/vec3";
import type { V3 } from "@brad_promptnow/vec3";

const a: V3 = { x: 1, y: 0, z: 0 };
const b: V3 = { x: 0, y: 1, z: 0 };

v3_add(a, b);    // { x: 1, y: 1, z: 0 }
v3_cross(a, b);  // { x: 0, y: 0, z: 1 }
v3_length({ x: 2, y: 3, z: 6 }); // 7

CommonJS also works:

const { v3_add } = require("@brad_promptnow/vec3");

API

Type

type V3 = { x: number; y: number; z: number };

Functions

| Function | Returns | Description | |---|---|---| | v3_add(a, b) | V3 | a + b | | v3_sub(a, b) | V3 | a - b | | v3_mul(a, b) | V3 | Component-wise multiply: (a.x*b.x, a.y*b.y, a.z*b.z) | | v3_scale(a, s) | V3 | Multiply every component by the number s | | v3_dot(a, b) | number | Dot product | | v3_cross(a, b) | V3 | Cross product, perpendicular to both inputs | | v3_length(a) | number | Length (magnitude) of the vector |

Notes

  • Dot product is positive when the vectors point the same way, 0 when perpendicular, and negative when opposite.
  • Cross product is order-sensitive: v3_cross(a, b) points the opposite way from v3_cross(b, a).
  • v3_mul vs v3_scale: v3_mul takes two vectors and multiplies each axis separately. v3_scale takes a vector and a single number.

Examples

import { v3_sub, v3_scale, v3_dot } from "@brad_promptnow/vec3";

// direction from point p to point q
const dir = v3_sub({ x: 4, y: 5, z: 6 }, { x: 1, y: 2, z: 3 }); // { x: 3, y: 3, z: 3 }

// move a position by velocity * time
const next = v3_scale({ x: 1, y: 0, z: 0 }, 2.5); // { x: 2.5, y: 0, z: 0 }

// are two vectors perpendicular?
v3_dot({ x: 1, y: 0, z: 0 }, { x: 0, y: 1, z: 0 }) === 0; // true

Development

npm install
npm run build   # compiles src/ to dist/
npm pack        # creates a .tgz to test locally

Releasing a new version:

npm version patch   # or minor / major
npm run build
npm publish --access public

License

ISC