UNPKG

codetrix

Version:

A lightweight lodash-style utility library

63 lines (39 loc) โ€ข 1.54 kB
# custom-utility-functions A reusable, type-safe utility library for arrays, objects, strings, dates, and more. --- ## โœจ Features - ๐Ÿ”ข Array and number utilities - ๐Ÿ“… Date helpers (`isBefore`, `getDay`, `setYear`, etc.) - ๐Ÿ”ค String utilities - โœ… Type-safe, modular, tree-shakable - ๐Ÿ“ฆ Lightweight and dependency-free --- ## ๐Ÿ“ฆ Installation ```bash npm install codetrix ``` ## ๐Ÿ”ง Usage ``` import { clamp } from 'codetrix/numbers'; const result = clamp(5, 0, 10); // 5 ``` ``` import { isWeekend } from 'codetrix/date/is'; isWeekend(new Date()); // true or false ``` ## ๐Ÿงฐ Available Methods | Category | Methods | | --------------- | ------------------------------------------------- | | **Array** | `compact`, `flatten`, `shuffle`, `unique` | | **Date โ†’ is/** | `isWeekend`, `isLeapYear`, `isSameDay`, `isToday` | | **Date โ†’ get/** | `getDay`, `getMonth`, `getYear`, `getWeekNumber` | | **Date โ†’ set/** | `setYear`, `setMonth`, `setDay`, `setTime` | | **String** | `capitalize`, `camelCase`, `kebabCase`, `trimAll` | | **Number** | `clamp`, `random`, `isEven`, `isOdd` | ## ๐Ÿงช Running Tests ```bash npm npm test ``` ## ๐Ÿ’– Sponsor This Project If you find this library helpful, please consider [![Sponsor](https://img.shields.io/badge/sponsor-%E2%9D%A4-lightgrey?logo=github)](https://github.com/sponsors/shivanshuJags) Your support helps me continue maintaining and improving this project.