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

@kissthebug/ts-utils

v0.1.5

Published

A lightweight TypeScript utility library with common helpers for strings, dates, objects, and arrays. Includes functions like string case converters, date formatting, deep cloning, object merging, unique values, and array chunking.

Downloads

54

Readme

@kissthebug/ts-utils

NPM Downloads

A lightweight TypeScript utility library with common helpers for strings, dates, objects, and arrays. Includes functions like string case converters, date formatting, deep cloning, object merging, unique values, and array chunking.


✨ Features

  • ✅ Written in TypeScript with full type definitions
  • ✅ Supports ESM and CommonJS
  • ✅ Tiny string utilities
  • ✅ Customizable date formatting function
  • ✅ Tested with Vitest

📦 Installation

npm install @kissthebug/ts-utils
# or
yarn add @kissthebug/ts-utils
# or
pnpm add @kissthebug/ts-utils

🚀 Usage

String utilities

import { stringToLower, stringToUpper } from "@kissthebug/ts-utils";

console.log(stringToLower("HeLLo")); // "hello"
console.log(stringToUpper("HeLLo")); // "HELLO"

Date utility

import { formatDate } from "@kissthebug/ts-utils";

// Default format
console.log(formatDate("2025-08-31"));
// -> "2025-08-31"

// Custom format
console.log(formatDate("2025-08-31T07:05:09Z", "MM/DD/YYYY HH:mm:ss"));
// -> "08/31/2025 07:05:09"

📚 API Reference

stringToLower(input: unknown): string

Converts input to lowercase string.
Returns "" for null or undefined.

stringToUpper(input: unknown): string

Converts input to uppercase string.
Returns "" for null or undefined.

formatDate(input: Date | string | number, format = "YYYY-MM-DD"): string

Formats a date using simple tokens.
Returns "" if input is not a valid date.

Supported tokens:

  • YYYY – 4-digit year
  • YY – 2-digit year
  • MM – zero-padded month (01–12)
  • M – month (1–12)
  • DD – zero-padded day (01–31)
  • D – day (1–31)
  • HH – zero-padded hours (00–23)
  • mm – zero-padded minutes (00–59)
  • ss – zero-padded seconds (00–59)

ℹ️ This formatter is lightweight and does not handle locales/time zones beyond the native Date. For advanced needs, consider date-fns or dayjs.

deepClone<T>(value: T): T

Creates a deep copy of the input value.
Supports objects, arrays, Date, RegExp, Map, Set, and primitives.
Returns a new instance, so modifying the clone does not affect the original.

const original = { a: 1, nested: { b: 2 } };
const copy = deepClone(original);
copy.nested.b = 3;
console.log(original.nested.b); // 2 (unchanged)

mergeObjects<T, U>(target: T, source: U): T & U

Deeply merges two objects.

  • For objects → merges properties recursively
  • For arrays/primitives → values from source overwrite target
const a = { user: { name: "Alice" }, roles: ["user"] };
const b = { user: { age: 30 }, roles: ["admin"] };
const merged = mergeObjects(a, b);
// { user: { name: "Alice", age: 30 }, roles: ["admin"] }

unique<T>(arr: T[]): T[]

Removes duplicate values from an array.
Uses strict equality (===) for comparison.

unique([1, 2, 2, 3, 1]);
// [1, 2, 3]

unique(["a", "b", "a"]);
// ["a", "b"]

chunk<T>(arr: T[], size: number): T[][]

Splits an array into chunks of the given size.
If size <= 0, returns an empty array.

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

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

🛠 Development

Clone repo and install deps:

git clone https://github.com/your-username/@kissthebug/ts-utils.git
cd @kissthebug/ts-utils
npm install

Build:

npm run build

Run tests:

npm test

📜 License

MIT © kissthebug