github/rafifos/bits

			jsrepo init github/rafifos/bits
		

Rafifos's Bits and Bytes

Checked with Biome jsrepo Blocks jsrepo Categories jsrepo Dependencies

A collection of reusable TypeScript utility functions and helpers that are too small to be their own libraries.

Overview

This repository contains small, focused utility functions that can be easily imported into your projects using jsrepo. Each utility is thoroughly tested and follows modern TypeScript best practices.

Installation

This library is distributed via jsrepo, which allows you to import just the specific utilities you need without any additional dependencies.

  1. Setup jsrepo if you haven't already:
npx jsrepo init --project
  1. Use any utility directly in your project:
npx jsrepo add github/rafifos/bits/utils/handle-async

Available Utilities

  • handle-async: A utility for handling async functions with proper error handling.
  • should-never-happen: A utility for handling cases that should never occur in your application flow.

Development

Prerequisites

  • Node.js ≥ 22
  • pnpm ≥ 10

Setup

  1. Clone the repository:
git clone https://github.com/rafifos/bits.git
cd bits
  1. Install dependencies:
pnpm install

Commands

  • pnpm build - Builds the jsrepo registry
  • pnpm test - Runs tests with Jest
  • pnpm lint - Runs Biome linter and formatter

Adding a New Utility

  1. Create a new file in the appropriate category directory (e.g., src/utils/my-utility.ts)
  2. Add tests in a corresponding my-utility.test.ts file
  3. Run pnpm build to update the jsrepo manifest
  4. Run pnpm test to ensure everything works correctly

Commit Guidelines

This project uses Conventional Commits for commit messages, enforced by commitlint.

Examples:

  • feat: add new handle-error utility
  • fix: correct type definition in handle-async
  • docs: update usage examples
  • test: add more test cases for should-never-happen

CI/CD

This project uses GitHub Actions for continuous integration:

  • Code quality checks with Biome
  • Unit tests with Jest
  • Commit message validation with commitlint
  • Automatic jsrepo manifest updates

License

MIT License - see the LICENSE file for details.

Categories 1
Blocks 2
Dependencies 0
Config Files 0