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

odgn-ts-helpers

v0.1.0

Published

TypeScript utility helpers for strings, dates, caching, logging, and more

Downloads

86

Readme

odgn-ts-helpers

TypeScript utility helpers for strings, dates, caching, logging, and more. Built with Bun.

Installation

# npm
npm install odgn-ts-helpers

# bun
bun add odgn-ts-helpers

Usage

Import specific modules for tree-shaking:

import { slugify, toCamelCase } from 'odgn-ts-helpers/string';
import { createQueryCache } from 'odgn-ts-helpers/cache';
import { trycatch } from 'odgn-ts-helpers/try-catch';

Or import everything from the main entry:

import { slugify, createQueryCache, trycatch } from 'odgn-ts-helpers';

Modules

boolean

Boolean parsing and type checking utilities.

  • isBoolean(value) - Type guard for booleans
  • toBoolean(value) - Convert strings like "true", "yes", "1" to boolean
  • safeParseBoolean(value, defaultValue) - Safely parse with fallback

cache

LRU cache with TTL support for async/sync functions.

  • createQueryCache() - Create a query cache instance with wrap, invalidate, and clear methods

date

Date parsing and ISO string utilities.

  • isDate(value) - Type guard for Date objects
  • toIsoDateString(value, defaultValue) - Convert to ISO string without milliseconds

diff

Object comparison utilities using deep-object-diff and fast-json-patch.

  • isObjectEqual(a, b) - Check if two objects are equal
  • getObjectDiff(a, b) - Get detailed diff between objects
  • compareObjects(a, b) - Get JSON patch operations between objects

log

Configurable logger with timestamp prefixes.

  • createLog(prefix, disabled) - Create a logger with optional prefix and disabled log types

number

Number parsing and conversion utilities.

  • isNumber(value) - Type guard for numbers
  • toInteger(value, defaultValue) - Convert to integer with fallback
  • toNumber(value, defaultValue) - Convert to number with fallback
  • safeParseInt(value, defaultValue) - Safely parse integer
  • safeParseFloat(value, defaultValue) - Safely parse float
  • roundNumberToDecimalPlaces(number, places) - Round to decimal places

random

Pseudo-random number generation with seeding support.

  • prng(seed) - Basic PRNG
  • prngInt(seed), prngDouble(seed), prngBoolean(seed) - Typed random values
  • prngIntRange(seed, min, max), prngDoubleRange(seed, min, max) - Random ranges
  • prngShuffle(seed, array) - Seeded array shuffle
  • randomUnsignedInt(min, max) - Random integer in range
  • djb2Hash(str) - DJB2 hash function

string

String manipulation and validation utilities.

  • slugify(str) - Convert to URL-safe slug
  • toPascalCase(str), toCamelCase(str), toKebabCase(str), toSnakeCase(str) - Case conversions
  • toCapitalized(str) - Capitalize words
  • isString(value) - Type guard for strings
  • isEmail(value) - Email validation

time

Time constants and utilities.

  • Constants: ONE_SECOND, ONE_MINUTE, FIVE_MINUTES, ONE_HOUR, ONE_DAY, etc.
  • wait(ms) - Promise-based delay
  • runAfter(ms, fn) - Run function after delay
  • getTimestamp() - Get formatted timestamp (HH:MM:SS.SSS)

try-catch

Go-style error handling with tuple returns.

  • trycatch(operation) - Returns [data, null] on success or [null, error] on failure

unique-name

Random name generation.

  • generateUniqueName() - Generate a unique name like "brave-red-alice"

Development

bun install          # Install dependencies
bun test             # Run tests
bun run lint         # Lint with ESLint
bun run format       # Format with Prettier
bun run type-check   # TypeScript type checking

License

MIT