0.0.2 • Published 5 months ago

@sveltecult/helpers v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Helpers

The Helpers library is a collection of useful number and string helper functions designed to simplify common tasks such as pluralization, email obfuscation, random string generation, and more.

Installation

To install Helpers, use your preferred package manager:

npm install @sveltecult/helpers

Or, if you're using Bun:

bun add @sveltecult/helpers

Getting Started

To use the Helpers library in your project, import the desired functions:

Basic Usage

import { Str, Num } from "@sveltecult/helpers";

const id = Str.random();
const email = Str.obfuscate("john@example.com");
const plural = Str.pluralize("cat", 3);
const OTP = Num.random(6);

Available Helpers:

Str.pluralize(noun: string, count: number, inclusive?: boolean)

Returns the plural form of a word based on the given count.

Str.obfuscate(email: string)

Obfuscates an email address to help prevent spam.

Str.random(length: number?)

Generates a random string of the specified length.

Num.random(digits: number?)

Generates a random number with the specified number of digits.

License

License

Helpers is licensed under the MIT License.