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

@kaynooo/utils

v1.6.7

Published

A bunch of small utils functions that I use in my TS based projects

Readme

@kaynooo/utils

A comprehensive TypeScript utility library with type-safe builders, decorators, and helper functions for modern web development.

npm version License: MIT

Features

  • 🎯 Type-safe - Full TypeScript support with strict typing
  • 🏗️ Builder patterns - Configurable loggers, endpoints, and i18n systems
  • 🎨 Color utilities - Advanced color conversion and manipulation
  • 📝 Text processing - Case conversion, formatting, and validation
  • Performance - Memoization decorators with TTL and cache invalidation
  • 🌍 Internationalization - Type-safe i18n with dot notation keys
  • 🔧 Validation - Comprehensive rule-based validation system

Installation

# bun (recommended)
bun add @kaynooo/utils
# pnpm
pnpm add @kaynooo/utils
# yarn
yarn add @kaynooo/utils
# npm
npm install @kaynooo/utils

Quick Start

import { declareI18n, declareLogger } from '@kaynooo/utils/builders'
import { Memoize } from '@kaynooo/utils/decorators'
import { ColorConverter } from '@kaynooo/utils/tools'

// Type-safe logging
const logger = declareLogger({ logLevel: 2 })
logger('success', 'Application started')

// Color conversion
const hslColor = ColorConverter.from('hex', '#f0af02').to('hsl')

// Memoization with automatic cache invalidation
class DataService {
  @Memoize({ ttl: 5000 })
  get expensiveData() {
    return fetchDataFromAPI()
  }
}

Core Modules

🏗️ Builder Patterns

Create configured instances with fluent APIs:

  • Logger Builder - Custom loggers with levels, colors, and formatting
  • Endpoint Builder - Type-safe API endpoint declarations
  • i18n Builder - Internationalization with variable interpolation
  • Permission Builder - Role-based access control systems

🎨 Color & Design

  • ColorConverter - Convert between hex, RGB, HSL, and more
  • Color utilities - Manipulation, validation, and generation
  • Text formatting - Case conversion (camelCase, kebab-case, etc.)

⚡ Performance & Caching

  • @Memoize decorator - Method result caching with TTL
  • Cache invalidation - Smart cache clearing based on property changes
  • Timing utilities - Delays, intervals, and performance measurement

🔧 Validation & Rules

  • Rule engine - Composable validation rules
  • Built-in validators - Email, URL, phone, date ranges, and more
  • Custom rules - Easy to extend with your own validation logic

🌍 Internationalization

Type-safe translations with dot notation keys:

const { t } = declareI18n({
  en: { user: { profile: 'Profile of {username}' } },
  fr: { user: { profile: 'Profil de {username}' } }
})

// Full type safety - TypeScript will error on invalid keys/variables
t('en', 'user.profile', { username: 'John' }) // ✅
t('en', 'invalid.key') // ❌ TypeScript error

Examples

Check out the examples/ directory for comprehensive usage examples of each utility.

Documentation

Full API documentation is available at: https://kayno0o.github.io/utils/docs/

Development

# Install dependencies
bun install

# Run tests
bun test

# Build the library
bun run build

# Generate documentation
bun run doc

License

MIT © Kaynooo