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

v1.0.7

Published

A lightweight utility library for TypeScript projects

Readme

TS-Helpers-kit

npm Types

ts-helpers-kit is a modern, lightweight, and type-safe utility library for TypeScript projects. It provides handy helper functions for date manipulation, localStorage, cookies, and more. It is compatible with all frontend frameworks or plain TypeScript environments.

Features

  • Lightweight & Fast: No external dependencies and supports tree-shaking.
  • TypeScript First: Fully written in TypeScript with strict type safety.
  • Framework Agnostic: Works with React, Vue, Angular, Svelte, or plain TS.
  • Tested: Fully covered with Vitest.
  • Modular: Import only what you need.

📦 Repository

Find the full source code on GitHub:

🔗 github.com/emanuelpps/ts-helpers-kit

💬 Why Use ts-helpers-kit?

  • You save hours of repetitive code.
  • You keep your TypeScript codebase clean, safe, and readable.
  • You avoid installing big libraries just for a few helpers.
  • You can use it in any environment (browser, SSR, Node).

Installation

npm install ts-helpers-kit

or with Yarn:

yarn add ts-helpers-kit

Usage

Date Manipulation

import { formatDate, addDays } from 'ts-helpers-kit';

const formatted = formatDate(new Date(), 'YYYY-MM-DD');
console.log(formatted); // '2025-04-07'

const newDate = addDays(new Date(), 3);
console.log(newDate); // 3 days later

localStorage Helpers

import { setLocalStorage, getLocalStorage, removeLocalStorage } from 'ts-helpers-kit';

setLocalStorage('token', 'abc123');
console.log(getLocalStorage('token')); // 'abc123'
removeLocalStorage('token');

Cookie Helpers

import { setCookie, getCookie, deleteCookie } from 'ts-helpers-kit';

setCookie('user', 'Jane Doe', 7);
console.log(getCookie('user')); // 'Jane Doe'
deleteCookie('user');

📚 Utility Functions Reference

🔤 String Manipulation

Functions to work with text strings, useful in any application.

slugify(text: string): string

Converts a string into a SEO-friendly slug.
Example: 'Hello World!' → 'hello-world'

capitalize(text: string): string

Converts the first letter to uppercase.
Example: 'hello' → 'Hello'

truncate(text: string, length: number): string

Truncates a string and adds ellipsis if it's too long.
Example: 'This is a long string' → 'This is a…'

randomString(length: number): string

Generates a random alphanumeric string.
Example: 'randomString(8)' → 'aZ8h1jP3'


🔢 Numbers and Currency

Helps with calculations and number formatting.

formatCurrency(amount: number, locale: string, currency: string): string

Formats a number as currency.
Example: formatCurrency(2500, 'en-US', 'USD') → '$2,500.00'

clamp(value: number, min: number, max: number): number

Restricts a number within a range.
Example: clamp(120, 0, 100) → 100

randomInt(min: number, max: number): number

Generates a random number between two values.
Example: randomInt(1, 10) → 7


🕒 Dates and Time

Common functions for formatting and handling dates.

formatDate(date: Date, format: string): string

Formats a date into a custom format.
Example: formatDate(new Date(), 'YYYY-MM-DD') → '2025-04-07'

timeAgo(date: Date): string

Returns a human-readable relative time.
Example: '1 minute ago', '3 days ago'

addDays(date: Date, days: number): Date

Adds a number of days to a date.
Example: addDays(new Date(), 5) → [Date +5 days]

isWeekend(date: Date): boolean

Checks if the given date falls on a weekend.
Example: isWeekend(new Date('2025-04-06')) → true


💾 Storage and Cookies

Functions for managing localStorage, sessionStorage, and cookies.

setLocalStorage(key: string, value: any): void

Stores a value in localStorage.

getLocalStorage<T>(key: string): T | null

Retrieves a value from localStorage.

setCookie(name: string, value: string, days: number): void

Sets a cookie with expiration in days.

getCookie(name: string): string | null

Gets a cookie by name.


🧠 Data Structures and Algorithms

Utilities to manipulate arrays and objects.

deepClone<T>(obj: T): T

Clones an object without references.

deepMerge<T>(target: T, source: T): T

Deeply merges two objects without overwriting nested properties.

groupBy<T>(array: T[], key: keyof T): Record<string, T[]>

Groups array elements by a key.


⚙️ General Utility Functions

Practical helpers to improve code quality.

debounce(func: Function, delay: number): Function

Controls repeated execution of a function by delaying it.

throttle(func: Function, limit: number): Function

Limits function execution within a specified time window.

isEmpty(value: any): boolean

Checks if an object, array, or string is empty.

uuid(): string

Generates a unique UUID.


🔑 Keywords

typescript helpers utilities toolkit ts localStorage cookies dates strings frontend typescript library utility functions javascript react vue angular nodejs npm webdev


MIT License • Made by @emanuelpps