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

engineering-cal

v1.1.1

Published

A TypeScript library for common engineering calculations across various disciplines.

Readme

Engineering Calculations Library

A TypeScript library for common engineering calculations across various disciplines.

Overview

This library provides a collection of utility functions for engineering calculations, including:

  • Unit conversions
  • Electrical engineering calculations
  • Mechanical engineering calculations
  • Statistical functions

Installation

npm install engineering-cal

Usage

Unit Conversions

import { convertLength } from 'engineering-cal';

// Convert 5 meters to feet
const lengthInFeet = convertLength(5, 'm', 'ft');
console.log(lengthInFeet); // 16.4042

Electrical Engineering

import { 
  resistorCalculator, 
  calculateVoltage, 
  calculateCurrent, 
  calculateResistance,
  calculatePower,
  calculatePowerFromCurrentAndResistance,
  calculatePowerFromVoltageAndResistance,
  calculateEnergy,
  calculateVoltageDrop
} from 'engineering-cal';

// Calculate resistor ratio for a voltage divider
const ratio = resistorCalculator(12, 5);
console.log(ratio); // 0.4166...

// Ohm's Law (V = I × R)
const voltage = calculateVoltage(2, 10); // 2A through 10Ω
console.log(voltage); // 20V

const current = calculateCurrent(12, 6); // 12V across 6Ω
console.log(current); // 2A

const resistance = calculateResistance(24, 3); // 24V with 3A
console.log(resistance); // 8Ω

// Power Calculations
const power1 = calculatePower(12, 2); // 12V, 2A
console.log(power1); // 24W

const power2 = calculatePowerFromCurrentAndResistance(3, 5); // 3A, 5Ω
console.log(power2); // 45W

const power3 = calculatePowerFromVoltageAndResistance(120, 60); // 120V, 60Ω
console.log(power3); // 240W

// Energy Consumption
const energy = calculateEnergy(100, 3600); // 100W for 1 hour (3600 seconds)
console.log(energy); // 360,000 joules (100 watt-hours)

// Voltage Drop
const voltageDrop = calculateVoltageDrop(15, 100, 10000); // 15A, 100ft, 10000 circular mils
console.log(voltageDrop); // Voltage drop in volts

Mechanical Engineering

import { calcForce } from 'engineering-cal';

// Calculate force using F = m * a
const force = calcForce(10, 9.8); // 10kg mass with 9.8m/s² acceleration
console.log(force); // 98 Newtons

Statistical Functions

import { mean, median } from 'engineering-cal';

const data = [1, 2, 3, 4, 5];
console.log(mean(data)); // 3
console.log(median(data)); // 3

Development

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Setup

  1. Clone the repository
  2. Install dependencies:
    npm install

Available Scripts

  • npm run build - Compile TypeScript to JavaScript
  • npm test - Run tests
  • npm run lint - Run ESLint
  • npm run format - Format code with Prettier

License

ISC