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

ts-yutils

v1.0.0

Published

A small, growing set of type-safe TypeScript helpers.

Readme

YUtils (ts-yutils)

A small, growing set of type-safe TypeScript helpers.

npm version license types status

A type-first utility toolkit for everyday TypeScript tasks


Features

  • 🛡️ Type-safe: Strong generics and clear return types
  • 🧩 Modular: Small, focused helpers you can pick and choose
  • Lightweight: Zero runtime dependencies
  • Predictable: Immutable operations and readable naming

Installation

npm install ts-yutils
# or
yarn add ts-yutils

Usage

import YUtils from "ts-yutils";

// Deep vs shallow equality
YUtils.deepCompare({ a: [1, 2] }, { a: [1, 2] }); // true
YUtils.objectShallowCompare({ a: 1 }, { a: 1 });   // true

// Typed entries
const entries = YUtils.safeEntries({ a: 1, b: "x" });
// entries: Array<["a" | "b", number | string]>

// Naming case conversions
YUtils.setNamingCase("kebab-case", "helloWorld"); // "hello-world"
YUtils.setNamingCase("camelCase", "hello-world"); // "helloWorld"

// Stringify key/value pairs
YUtils.stringify({ color: "red", size: 12 }, ",");
// "color: red;,size: 12;"

// Hash short labels
YUtils.hashString("hello", 8); // e.g., "1y2lv0m0"

Advanced example

import YUtils from "ts-yutils";

// Compare configs deeply
const cfgA = { theme: { primary: "#f00" }, flags: ["a", "b"] };
const cfgB = { theme: { primary: "#f00" }, flags: ["a", "b"] };
const isSame = YUtils.deepCompare(cfgA, cfgB); // true

// Extend object immutably and keep types
const nextCfg = YUtils.extendObject(cfgA, ["version", 2]);
// { theme: { primary: "#f00" }, flags: ["a","b"], version: 2 }

// Validate alpha channel with Regex helper
const isAlphaOk = YUtils.Regex.Validate("ALPHA_CHANNEL", 0.6); // true

// Serialize for logging with different separators
YUtils.stringify({ a: 1, b: 2 }, ",");          // "a: 1;,b: 2;"
YUtils.stringify({ a: 1, b: 2 }, "white-space"); // "a: 1; b: 2;"
YUtils.stringify({ a: 1, b: 2 }, "new-line");    // "a: 1;\nb: 2;"
YUtils.stringify({ a: 1, b: 2 });                  // "a: 1;b: 2;"

API overview

  • Equality: deepCompare, objectDeepCompare, objectShallowCompare
  • Objects: safeEntries, extendObject, containKeys
  • Strings: setNamingCase, stringify, hashString
  • Regex: Regex.Validate, Regex.Expressions

Types

  • SafeOmit<T, K extends keyof T> — Omit keys from a type with IntelliSense safety
  • SafePick<T, K extends keyof T> — Pick keys from a type with IntelliSense safety
  • SafeExclude<T, U extends T> — Exclude values from a union
  • SafeExtract<T, U extends T> — Extract values from a union
  • Collection<T> — Mutable array of T
  • ReadonlyCollection<T> — Readonly array of T
  • DeepReadonly<T> — Recursively readonly object type
  • ObjectKey<T extends object> — String keys of T
  • ObjectEntry<K extends string, V> — Tuple [K, V]
  • ObjectEntries<T extends object> — Array of [key, value] tuples from T
  • ExtendObject<T, K extends string, V>T & Record<K, V>
  • NamingCase"kebab-case" | "camelCase"
  • StringSeparator"," | "white-space" | "new-line" | "none"
// Examples
interface User { id: number; name: string; email: string; password: string; }

type PublicUser = SafeOmit<User, "password" | "id">; // { name; email }
type UserProfile = SafePick<User, "name" | "email">; // { name; email }

type Status = "active" | "archived" | "deleted";
type Active = SafeExclude<Status, "archived" | "deleted">; // "active"

type Permission = "read" | "write" | "admin";
type AdminOnly = SafeExtract<Permission, "admin">; // "admin"

type FrozenUser = DeepReadonly<User>;

License

Apache-2.0 © YZA. See LICENSE.md.