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

@stellarshift/token-units

v1.0.0

Published

BigInt-safe wei / gwei / ether and ERC-20 decimal parsing for Web3 backends and scripts.

Downloads

156

Readme

@stellarshift/token-units

License: MIT

BigInt-first unit conversion for EVM token amounts — parseUnits / formatUnits with arbitrary decimals, plus ETH / gwei shortcuts.

Designed for backend scripts, indexers, and take-home tasks that should not depend on full ethers or viem.

Install

npm install @stellarshift/token-units

Examples

const {
  parseUnits,
  formatUnits,
  parseEther,
  formatEther,
  parseGwei,
  formatGwei,
} = require('@stellarshift/token-units');

// ERC-20 with 6 decimals (USDC-style)
parseUnits('12.34', 6);   // 12340000n
formatUnits(12340000n, 6); // '12.34'

// Native ETH
parseEther('0.05');        // 50000000000000000n
formatEther('50000000000000000n'); // '0.05'

// Gas price
parseGwei('25.5');         // 25500000000n
formatGwei(25500000000n);  // '25.5'

API

| Export | Description | |--------|-------------| | parseUnits(value, decimals) | Human → base units (bigint) | | formatUnits(value, decimals, precision?) | Base → human string | | parseEther / formatEther | 18-decimal shortcuts | | parseGwei / formatGwei | 9-decimal shortcuts | | WEI_PER_GWEI, WEI_PER_ETHER | Constants |

Behaviour

  • Uses native BigInt — no floating-point rounding on wei
  • Rejects fractional strings longer than decimals
  • Negative values supported for accounting use-cases

License

MIT © StellarShift Labs