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

@left-curve/utils

v1.0.0

Published

General-purpose utilities for the [Dango](https://dango.exchange) ecosystem.

Downloads

208

Readme

@left-curve/utils

General-purpose utilities for the Dango ecosystem.

Installation

npm install @left-curve/utils

Usage

import { Decimal, formatUnits, parseUnits, truncateAddress } from "@left-curve/utils";

const amount = Decimal("1000.50");
const formatted = formatUnits("1000000", 6); // "1.000000"
const parsed = parseUnits("1.5", 6); // "1500000"
const short = truncateAddress("0x1234...abcd");

API

Decimal

Arbitrary-precision decimal arithmetic (wraps big.js). Use for all financial math — never use Number.

import { Decimal } from "@left-curve/utils";

const a = Decimal("100.5");
const b = a.mul(Decimal("2"));

Formatting

  • formatNumber(value, options) - locale-aware number formatting
  • formatUnits(value, decimals) / parseUnits(value, decimals) - unit conversion
  • truncateAddress(address) - shorten addresses for display
  • truncateDec(value, digits) - truncate decimal places

Strings

  • camelToSnake(str) / snakeToCamel(str) - case conversion
  • capitalize(str) - capitalize first letter

Assertions

  • assertString(value), assertNumber(value), assertBoolean(value), etc.
  • assertDeepEqual(a, b) - deep equality check
  • assertNotEmpty(value) - non-empty check

Async

  • withRetry(fn, options) - retry with backoff
  • withTimeout(fn, timeout) - timeout wrapper
  • wait(ms) - promise-based delay
  • withResolvers() - deferred promise

Objects

  • recursiveTransform(obj, fn) - deep transform object values
  • sortObject(obj) - sort object keys
  • invertObject(obj) - swap keys and values

DEX

  • calculateTradeSize(params), calculateFees(params), calculatePrice(params)
  • adjustPrice(price, tickSize) - snap price to tick
  • formatOrderId(id) - format order ID for display

Vault

  • sharesToUsd(shares, params) / usdToShares(usd, params) - vault conversions
  • computeVaultApy(snapshots) - compute vault APY from snapshots

Misc

  • uid() - generate unique ID
  • debounce(fn, delay) - debounce function calls
  • tryCatch(fn) - Result type wrapper
  • createSubscription(options) - subscription helper
  • batchPoller(fn, interval) - batch polling
  • getNavigatorOS(), isMobileOrTable() - browser detection

License

TBD