Skip to content

MrLawrenceKwan/ts-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ts-utils

A lightweight collection of TypeScript utility functions for everyday development.

Features

  • 🔧 String utilities — slugify, truncate, capitalize, camelCase
  • 📅 Date helpers — relative time, format, timezone-aware parsing
  • 🔢 Number utils — clamp, round to precision, currency formatting
  • 🎯 Type guards — runtime type checking with TypeScript inference
  • âš¡ Zero dependencies — tree-shakeable ESM

Installation

npm install @lawrencekwan/ts-utils

Usage

import { slugify, relativeTime, clamp, isNonNullable } from '@lawrencekwan/ts-utils';

slugify('Hello World!');        // 'hello-world'
relativeTime(new Date('2024-01-01')); // '1 year ago'
clamp(150, 0, 100);            // 100
isNonNullable(value);          // type narrows to NonNullable<T>

License

MIT

About

Lightweight TypeScript utility functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published