Shared Utils
Shared Utils is a TypeScript utility library consumed across the @alawein repository portfolio. It provides a curated set of common functions that multiple projects depend on, reducing duplication and ensuring consistent behavior for frequent operations. The project sits in the library domain at P3 priority and links to Devkit as a reference.
The library exports several categories of utilities. For class name management, it provides a className merge function built on clsx and tailwind-merge, which handles conditional class application and resolves Tailwind CSS class conflicts. Formatting helpers cover currency formatting, date formatting, and number formatting, giving consuming projects standardized display logic for common data types.
String utilities include truncate for shortening text with ellipsis handling, capitalize for uppercasing the first character, and titleCase for converting strings to title case. These cover the most frequent string transformations needed across frontend and backend code.
The async tools module exports debounce and throttle for rate-limiting function calls, sleep for promise-based delays, memoize for caching expensive function results, and retry for automatically re-attempting failed async operations with configurable backoff. These utilities are particularly useful in UI event handling and API interaction layers.
Shared Utils produces dual output formats via tsup, generating both ESM (ES modules) and CJS (CommonJS) bundles. This ensures compatibility with both modern module systems and legacy Node.js environments that still require CommonJS imports.
The project is hosted on GitHub under the alawein organization and is in active development. It is tagged as cataloged and serves as a foundational dependency across the portfolio's TypeScript projects.