A reusable, type-safe utility library for arrays, objects, strings, dates, and more.
isBefore
, getDay
, setYear
, etc.)npm install codetrix
import { clamp } from 'codetrix/numbers';
const result = clamp(5, 0, 10); // 5
import { isWeekend } from 'codetrix/date/is';
isWeekend(new Date()); // true or false
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 |
npm npm test
If you find this library helpful, please consider
Your support helps me continue maintaining and improving this project.