@boopathidev/easy-utils-ts
v1.0.1
Published
Lightweight TypeScript utility library
Maintainers
Readme
easy-utils-ts
A lightweight and easy-to-use TypeScript utility library with common helper functions for string, array, object, date, crypto, OTP, validation, and number operations.
Features
- ✅ String Utilities
- ✅ Array Utilities
- ✅ Object Utilities
- ✅ Multi-Dimensional Object Search
- ✅ Date & Time Utilities
- ✅ OTP Generator
- ✅ MD5 Hash
- ✅ AES Encrypt / Decrypt
- ✅ Number to Words (Indian Format)
- ✅ Currency Formatter
- ✅ Email Validation
- ✅ Mobile Validation
- ✅ PAN Validation
- ✅ Aadhaar Validation
- ✅ GST Validation
- ✅ Random ID Generator
- ✅ UUID Generator
- ✅ Debounce & Throttle
- ✅ TypeScript Support
Installation
npm
npm install easy-utils-tsScoped Package
npm install @boopathidev/easy-utils-tsImport
Individual Functions
import {
capitalize,
generateOTP,
numberToWords
} from "easy-utils-ts";Utils Object
import { Utils } from "easy-utils-ts";
Utils.capitalize("hello world");String Utilities
capitalize("hello world");
// Hello world
titleCase("hello world");
// Hello World
upper("hello");
// HELLO
lower("HELLO");
// hello
firstLetter("Boopathi");
// B
initials("Boopathi Thangarasu");
// BTArray Utilities
arrayEquals([1,2],[1,2]);
deepArrayEquals(
[{id:1}],
[{id:1}]
);
unique([1,2,2,3]);
// [1,2,3]
intersection(
[1,2,3],
[2,3,4]
);
// [2,3]Object Utilities
getNestedValue(
obj,
"user.profile.name"
);
setNestedValue(
obj,
"user.profile.name",
"Boopathi"
);
deepClone(obj);Multi-Dimensional Search
findValueByKey(
data,
"city"
);
findByKeyValue(
data,
"id",
100
);
removeByKeyValue(
data,
"status",
"Deleted"
);
updateByKeyValue(
data,
"id",
1,
{
name: "John"
}
);Date Utilities
formatDate(new Date());
formatDateTime(new Date());
formatTime(new Date());
isToday(new Date());
addDays(
new Date(),
10
);
subtractDays(
new Date(),
5
);
getAge(
"1998-12-10"
);Number Utilities
formatCurrency(
100000
);
// ₹1,00,000.00
formatNumber(
123456789
);
// 12,34,56,789Number To Words
numberToWords(
1250.50
);
// One Thousand Two Hundred Fifty Rupees and Fifty Paise Only
amountToWords(
100000
);
// One Lakh Rupees OnlyOTP Generator
generateOTP();
// 482915
generateOTP(4);
// 7294
generateOTP(
8,
"alphanumeric"
);
// A92XK7LQCrypto
MD5
md5("Admin@123");Verify
verifyMD5(
"Admin@123",
hash
);AES Encrypt
encrypt(
"Hello World",
"secret"
);AES Decrypt
decrypt(
cipher,
"secret"
);Validation
isEmail(
"[email protected]"
);
isMobile(
"9876543210"
);
isPAN(
"ABCDE1234F"
);
isAadhaar(
"123412341234"
);
isGST(
"22AAAAA0000A1Z5"
);
isURL(
"https://example.com"
);
isStrongPassword(
"Admin@123"
);Misc Utilities
Random ID
randomId();
// ax83md29UUID
uuid();Sleep
await sleep(1000);Debounce
const save = debounce(
() => {
console.log("Saved");
},
500
);Throttle
const scroll = throttle(
() => {
console.log("Scrolling");
},
1000
);Example
import { Utils } from "easy-utils-ts";
const otp =
Utils.generateOTP(6);
const hash =
Utils.md5("Admin@123");
const amount =
Utils.numberToWords(
25000.75
);
console.log(otp);
console.log(hash);
console.log(amount);Requirements
- Node.js >= 18
- TypeScript >= 5
Author
Boopathi Dev
GitHub: https://github.com/boopathidev
npm: https://www.npmjs.com/~boopathidev
License
MIT License
Copyright (c) 2026 Boopathi Dev
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, to deal in the Software without restriction.
