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-utility-kit

v2.1.1

Published

Shared TypeScript utilities with generated type definitions.

Readme

ts-utility-kit

Shared TypeScript utilities packaged as focused subpath modules.

日本語 README

Install From npm

npm i ts-utility-kit

Use this when you want to install the latest published version from the npm registry.

Install From GitHub

npm i github:ShionTerunaga/ts-utility-kit#release

Use this when you want to install directly from the built release branch on GitHub.

To pin a specific version, install from a version tag instead of release.

npm i github:ShionTerunaga/ts-utility-kit#v1.4.0

Import Style

This package exposes subpath modules. Import from the feature you need.

import { ValidationError } from "ts-utility-kit/error";
import { omitElementObject } from "ts-utility-kit/object";
import { createSome } from "ts-utility-kit/option";

Available subpath exports:

  • ts-utility-kit/error
  • ts-utility-kit/is
  • ts-utility-kit/merger
  • ts-utility-kit/object
  • ts-utility-kit/option
  • ts-utility-kit/result
  • ts-utility-kit/types

Package Guide

ts-utility-kit/error

Use this when you want application errors with consistent names, codes, status values, or metadata.

import { BadRequestError, NotFoundError, SchemeError, ValidationError } from "ts-utility-kit/error";

throw new ValidationError({
    field: "email",
    issues: [{ path: "email", message: "Invalid format" }],
});

throw new SchemeError({
    allowedSchemes: ["https"],
    receivedScheme: "http",
});

throw new NotFoundError({
    details: { resource: "user", id: "42" },
});

Included exports:

  • BaseError
  • BaseHttpError
  • HTTP error classes such as BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, PayloadTooLargeError, and UnsupportedMediaTypeError
  • SchemeError
  • ValidationError

ts-utility-kit/is

Use these small type guards when narrowing nullable values.

import { isNull, isUndefined } from "ts-utility-kit/is";

function normalize(value: unknown) {
    if (isNull(value) || isUndefined(value)) {
        return "empty";
    }

    return String(value);
}

ts-utility-kit/merger

Use this when you want to merge class name arrays while removing empty entries and duplicates.

import { classMerger } from "ts-utility-kit/merger";

const className = classMerger(["button", "", "button", "primary"]);
// "button primary"

ts-utility-kit/object

Use this when you want to copy an object without specific keys.

import { omitElementObject } from "ts-utility-kit/object";

const user = {
    id: 1,
    name: "Shion",
    password: "secret",
};

const safeUser = omitElementObject(user, ["password"]);

ts-utility-kit/option

Use this when you want to represent nullable values explicitly as Some or None.

import { createNone, createSome, isNone, isSome, optionConversion } from "ts-utility-kit/option";

const token = optionConversion(process.env.API_TOKEN);

if (isSome(token)) {
    console.log(token.value);
}

const fallback = isNone(token) ? "guest" : token.value;
const fixed = createSome("ready");
const empty = createNone<string>();

Included exports:

  • Option<T>
  • createSome(value)
  • createNone()
  • isSome(option)
  • isNone(option)
  • optionConversion(value)

ts-utility-kit/result

Use this when you want functions to return Result<T, E> instead of throwing directly.

import { UNIT, checkPromiseReturn, createErr, createOk, isErr, isOk } from "ts-utility-kit/result";

const result = await checkPromiseReturn({
    fn: async () => fetchUser(),
    err: (error) => createErr(error),
});

if (isOk(result)) {
    console.log(result.value);
}

if (isErr(result)) {
    console.error(result.err);
}

const done = createOk(UNIT);

Included exports:

  • Result<T, E>
  • createOk(value)
  • createErr(error)
  • isOk(result)
  • isErr(result)
  • UNIT and Unit
  • checkResultReturn({ fn, err, finalFn? })
  • checkResultVoid({ fn, err, finalFn? })
  • checkPromiseReturn({ fn, err, finalFn? })
  • checkPromiseVoid({ fn, err, finalFn? })

ts-utility-kit/types

Use this when you only need shared TypeScript utility types.

import type { Dict, Without } from "ts-utility-kit/types";

interface User {
    id: string;
    name: string;
    password: string;
}

type PublicUser = Without<User, "password">;
type UserMap = Dict<PublicUser>;

Included exports:

  • Dict<T>
  • Without<T, K>

The built files are committed to the release branch, so the package can be installed directly from this GitHub repository without running build scripts.