Skip to content

Getting Started

This guide will help you get started with @beerush/utils.

Installation

Install the package using your preferred package manager:

bash
npm install @beerush/utils
bash
yarn add @beerush/utils
bash
pnpm add @beerush/utils
bash
bun add @beerush/utils

Usage

After installation, you can import and use the utilities in your project:

typescript
import { toCamelCase } from '@beerush/utils/global'
import { addClass } from '@beerush/utils/client'

console.log(toCamelCase('hello-world')) // helloWorld
addClass(document.body, 'loaded')
javascript
const { toCamelCase } = require('@beerush/utils/global')
const { addClass } = require('@beerush/utils/client')

console.log(toCamelCase('hello-world')) // helloWorld
addClass(document.body, 'loaded')

Individual Module Imports

You can also import from specific modules:

typescript
import { toCamelCase, toKebabCase } from '@beerush/utils/global/string'
import { addClass, removeClass } from '@beerush/utils/client/dom'

Module Overview

The library is organized into three main modules:

  1. Client (@beerush/utils/client): Client-side utilities for DOM manipulation, styling, forms, files, clipboard operations, and more
  2. Global (@beerush/utils/global): Universal utilities for working with strings, numbers, objects, colors, logging, and other base types
  3. Server (@beerush/utils/server): Server-side utility functions

Each module contains several sub-modules that group related functionality together.