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

@harshil3134/utils

v1.0.0

Published

Production-grade TypeScript utility helpers for Node.js, Express, React, and React Native

Readme

@harshil3134/utils

Production-grade TypeScript utility helpers for Node.js, Express, React, and React Native.

npm version License: MIT TypeScript Tests


🚀 Overview

@harshil3134/utils is a comprehensive, tree-shakeable utility library designed for modern TypeScript environments. It provides high-performance, well-tested helpers ranging from simple string manipulation to advanced observability and async patterns.

  • Type-Safe: Written in pure TypeScript with strict types.
  • Tree-shakeable: Import only what you need to keep bundles small.
  • Zero Dependencies: Core library has no external dependencies.
  • Environment Aware: Built-in support for Node, Browser, and React Native.

📦 Install

npm install @harshil3134/utils
# or
yarn add @harshil3134/utils

🛠 Usage

Import everything

import { truncate, isValidEmail, retry } from '@harshil3134/utils'

Subpath Imports (Best for Tree-shaking)

Direct imports ensure your bundler (Vite, Webpack) only includes the specific module.

import { truncate, slugify }       from '@harshil3134/utils/string'
import { retry, sleep }            from '@harshil3134/utils/async'
import { isObject, isPromise }      from '@harshil3134/utils/guards'
import { chunk, shuffle }          from '@harshil3134/utils/collection'
import { useDebouncedValue }       from '@harshil3134/utils/react'

🧩 Modules Overview

| Module | Purpose | Target | | :--- | :--- | :--- | | string | Advanced text manipulation & formatting | All | | async | Patterns for retries, timeouts, and concurrency | All | | collection | High-performance array & collection helpers | All | | guards | Type-safe runtime checks (Type Guards) | All | | object | Deep cloning, merging, and transformations | All | | validation | Schema-based Env validation & data checks | All | | date | Formatting, relative time, and calendar math | All | | react | Optimized hooks for state & effects | React | | logging | Pluggable logging system with levels | All | | metrics | Performance tracking & metric collection | All | | storage | SSR-safe storage with TTL/Expiration | Browser/Mobile | | network | Fetch wrappers & query string builders | All |


📖 API Highlight

✍️ String Utilities (/string)

  • truncate(str, maxLen, suffix?): Smart truncation with suffix.
  • slugify(str): Generate URL-safe slugs.
  • maskSensitiveData(val, type): Mask emails, phones, or credit cards.
  • camelCase, snakeCase, kebabCase, capitalize, titleCase.

⏳ Async Patterns (/async)

  • retry(fn, options?): Retry with exponential backoff.
  • withTimeout(promise, ms): Wrap any promise in a timeout.
  • sleep(ms): Promisified delay.
  • concurrentLimit(fns, limit): Execute promises with controlled concurrency.

🛡 Type Guards (/guards)

  • isObject, isPromise, isString, isNumber, isBoolean, isDefined, isFunction.

🧱 Collection Helpers (/collection)

  • chunk(arr, size): Split array into chunks.
  • shuffle(arr): Fisher-Yates randomization.
  • sample(arr): Random element selection.
  • unique(arr, by?): Deduplicate based on value or transformation.
  • range(start, end, step?): Generate numeric sequences.

📂 Object Manipulation (/object)

  • deepMerge(target, source): Recursive object merging (Config merging).
  • deepClone(obj): Deep recursive copy.
  • pick(obj, keys) / omit(obj, keys): Typed property selection/exclusion.
  • flattenObject(obj): Convert nested objects to dot-notation keys.

✅ Validation & Env (/validation)

  • validateEnv(schema, source?): Schema-based environment validation with parsing.
  • isValidEmail / isValidPhone / isUUID / isStrongPassword / isNonEmptyString.

⚛️ React Hooks (/react)

  • useAsyncState(fn): Managed loading/error/data state.
  • useDebouncedValue(val, delay): Debounce value changes.
  • useStableCallback(fn): A callback with stable reference but latest closures.
  • useIsMounted, usePrevious, useAbortableEffect.

💾 Storage & Network (/storage, /network)

  • setWithExpiry(key, val, ttl): Store data with auto-expiration (SSR-safe).
  • storageAvailable(type): Check for storage permissions/availability.
  • fetchWithRetry(url, options?): Native fetch with built-in retries.
  • isOnline() / createQueryString / parseQueryString.

🧪 Testing

We believe in bulletproof utilities. Every function is tested.

npm run test          # Run all 67 tests
npm run test:coverage # Check coverage (Targeting 90%+)

🔨 Development

Generated with tsup for high-performance CJS and ESM support with full type declarations.

npm run build      # Build CJS & ESM to /dist
npm run build:watch # Development mode
npm run lint       # Type safety check

📄 License

MIT © harshil3134