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

@rainbow-oh/yee-tools

v0.1.0

Published

A modern, type-safe TypeScript utility library

Downloads

102

Readme

@rainbow-oh/yee-tools

npm License: MIT

A modern, type-safe TypeScript utility library. Part of the Yee component library.

Features

  • 100% TypeScript with strict mode enabled
  • Zero any types — fully type-safe across all modules
  • Tree-shakeable — modular ESM / CJS / UMD exports for optimal bundle size
  • Comprehensive tests — 173 passing tests covering edge cases and real-world usage
  • JSDoc documentation — complete API documentation with inline examples
  • Zero dependencies — no runtime dependencies (optional dayjs peer dependency for date utils)

Installation

pnpm add @rainbow-oh/yee-tools

Usage

import { StringUtils, NumberUtils, DateUtils, SessionContext } from '@rainbow-oh/yee-tools';

// String utilities
const cleaned = StringUtils.trim('  hello  '); // 'hello'
const empty = StringUtils.isBlank('   '); // true

// Precise floating-point arithmetic
const sum = NumberUtils.add(0.1, 0.2); // 0.3
const product = NumberUtils.multiply(0.1, 0.2); // 0.02

// Date utilities (requires dayjs peer dependency)
const formatted = DateUtils.getCurrentDateTime('YYYY-MM-DD HH:mm:ss');

Import specific modules for tree-shaking:

import { StringUtils } from '@rainbow-oh/yee-tools/string';
import { NumberUtils } from '@rainbow-oh/yee-tools/number';
import { DateUtils } from '@rainbow-oh/yee-tools/date';

Modules

StringUtils

trim, isEmpty, isNotEmpty, isBlank, isNotBlank, mask

StringUtils.mask('4111111111111111', 4, 4); // '4111********1111'

NumberUtils

add, subtract, multiply, divide, random

NumberUtils.add(0.1, 0.2);   // 0.3 (not 0.30000000000000004)
NumberUtils.divide(1, 3, 2); // 0.33

DateUtils

getCurrentDateTime, formatStringToDate, formatToSubmitFormat, formatToViewFormat, add, subtract

Requires dayjs >= 1.11.11 as a peer dependency.

ArrayUtils

trimArray, isRepeat, repeatElement, unique, chunk

ArrayUtils.chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]

ObjectUtils

clone, extend, merge, pick, omit

ObjectUtils.pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }

SecurityUtils

escapeHTML, unescapeHTML, escapeHTMLAttribute, encodeJavaScriptIdentifier, encodeJavaScriptString, encodeCSSIdentifier, encodeCSSString

SecurityUtils.escapeHTML('<script>alert("xss")</script>');
// '&lt;script&gt;alert(&quot;xss&quot;)&lt;/script&gt;'

CookieUtils

get, set, remove

CookieUtils.set('theme', 'dark', { expires: 7 });
const theme = CookieUtils.get('theme'); // 'dark'

TypeUtils

parseBool, isArray, isString, isNumber, isDate, isFunction, isObject, isNullOrUndefined

Cache

Four storage strategies with the same get/set/remove/clear API:

| Module | Storage | Lifecycle | |---|---|---| | SessionContext | sessionStorage | Cleared on browser close | | LocalContext | localStorage | Persists until cleared | | PageContext | In-memory | Cleared on page navigation | | StoreContext | IndexedDB | Persists across sessions |

import { SessionContext, LocalContext, PageContext, StoreContext } from '@rainbow-oh/yee-tools/cache';

HTTP Client

Lightweight HTTP client with interceptor support:

import { ax } from '@rainbow-oh/yee-tools/fetch';

// Add auth header via interceptor
ax.interceptors.request.use(({ config }) => {
  const token = sessionStorage.getItem('Authorization');
  if (token) {
    config.headers = { ...config.headers, Authorization: `Bearer ${token}` };
  }
  return config;
});

// Make requests
const users = await ax.get('/api/users');
const result = await ax.post('/api/users', { name: 'John' });

i18n

Internationalization utilities for multi-language support:

import { I18nUtils } from '@rainbow-oh/yee-tools/i18n';

Platform-dependent Modules

The following modules depend on specific backend services and are designed for use within the Yee platform:

  • codetable (@rainbow-oh/yee-tools/codetable) — Requires Yee backend API endpoints for code table data
  • url (@rainbow-oh/yee-tools/url) — normalizeURL uses platform-specific routing logic (tenant-aware URL prefixes)

These modules can still be imported but will not function correctly without the matching backend services.

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Build
pnpm build

# Build with type definitions
pnpm build:all

Contributing

See the root Contributing Guide.

License

MIT © InsureMO