From cf8977073be6137195e714b36499da89759b2114 Mon Sep 17 00:00:00 2001 From: Maverik Minett Date: Sat, 13 Sep 2025 15:58:31 -0400 Subject: [PATCH 1/2] update docs --- src/lib/functions/camelize.ts | 7 +++++-- src/lib/functions/kebabify.ts | 8 ++++++-- src/lib/functions/pascalize.ts | 7 +++++-- src/lib/functions/pluralize.ts | 13 +++++++++++-- src/lib/functions/quantify.ts | 8 ++++++-- src/lib/functions/singularize.ts | 9 +++++++-- src/lib/functions/snakify.ts | 7 +++++-- src/lib/functions/titalize.ts | 7 +++++-- src/lib/functions/verbalize.ts | 8 ++++++-- 9 files changed, 56 insertions(+), 18 deletions(-) diff --git a/src/lib/functions/camelize.ts b/src/lib/functions/camelize.ts index 3f04e2b..80510d6 100644 --- a/src/lib/functions/camelize.ts +++ b/src/lib/functions/camelize.ts @@ -2,24 +2,27 @@ * Converts a string to camelCase. * Removes all non-alphanumeric separators and capitalizes each word except the first. * - * ## Usage - * + * @example * ```ts * camelize("hello world"); // "helloWorld" * ``` * + * @example * ```ts * camelize("Hello_world"); // "helloWorld" * ``` * + * @example * ```ts * camelize("API_response_code"); // "apiResponseCode" * ``` * + * @example * ```ts * camelize("user-42-profile"); // "user42Profile" * ``` * + * @example * ```ts * camelize("ThisIsALongVariableName"); // "thisIsALongVariableName" * ``` diff --git a/src/lib/functions/kebabify.ts b/src/lib/functions/kebabify.ts index 82109b4..0e2f4dd 100644 --- a/src/lib/functions/kebabify.ts +++ b/src/lib/functions/kebabify.ts @@ -6,28 +6,32 @@ import { PLACEHOLDER } from "../private/constants"; * Replaces spaces, underscores, camelCase transitions, and other separators with dashes. * It also preserves version tokens like "v2" and lowercases the result. * - * ## Usage - * + * @example * ```ts * kebabify("hello world"); // "hello-world" * ``` * + * @example * ```ts * kebabify("first_name"); // "first-name" * ``` * + * @example * ```ts * kebabify("userProfile42"); // "user-profile-42" * ``` * + * @example * ```ts * kebabify("APIResponseV2"); // "api-response-v2" * ``` * + * @example * ```ts * kebabify("HTML5_Parser v3"); // "html-5-parser-v3" * ``` * + * @example * ```ts * kebabify(" Leading_and trailing "); // "leading-and-trailing" * ``` diff --git a/src/lib/functions/pascalize.ts b/src/lib/functions/pascalize.ts index 3fe7402..d2b932a 100644 --- a/src/lib/functions/pascalize.ts +++ b/src/lib/functions/pascalize.ts @@ -4,24 +4,27 @@ * Removes non-alphanumeric characters, splits on casing and digits, * capitalizes each word, and strips leading/trailing separators. * - * ## Usage - * + * @example * ```ts * pascalize("hello world"); // "HelloWorld" * ``` * + * @example * ```ts * pascalize("first_name"); // "FirstName" * ``` * + * @example * ```ts * pascalize("user42Profile"); // "User42Profile" * ``` * + * @example * ```ts * pascalize("API response code"); // "ApiResponseCode" * ``` * + * @example * ```ts * pascalize(" messy__input--string "); // "MessyInputString" * ``` diff --git a/src/lib/functions/pluralize.ts b/src/lib/functions/pluralize.ts index 9e630ee..f38710d 100644 --- a/src/lib/functions/pluralize.ts +++ b/src/lib/functions/pluralize.ts @@ -11,48 +11,57 @@ import { preserveCasing } from '../private/util'; * * The output preserves the casing of the input, especially the prefix. * - * ## Usage - * + * @example * ```ts * pluralize("city"); // "cities" * ``` * + * @example * ```ts * pluralize("box"); // "boxes" * ``` * + * @example * ```ts * pluralize("child"); // "children" * ``` * + * @example * ```ts * pluralize("person"); // "people" * ``` * + * @example * ```ts * pluralize("API"); // "APIs" * ``` * + * @example * ```ts * pluralize("ID"); // "IDs" * ``` * + * @example * ```ts * pluralize("File"); // "Files" * ``` * + * @example * ```ts * pluralize("buzz"); // "buzzes" * ``` * + * @example * ```ts * pluralize("CPU"); // "CPUs" * ``` * + * @example * ```ts * pluralize("DOG"); // "DOGS" * ``` * + * @example * ```ts * pluralize("A"); // "As" * ``` diff --git a/src/lib/functions/quantify.ts b/src/lib/functions/quantify.ts index d650bae..eca77b8 100644 --- a/src/lib/functions/quantify.ts +++ b/src/lib/functions/quantify.ts @@ -8,28 +8,32 @@ import { pluralize } from './pluralize'; * pluralize(unit) * to generate one. * - * ## Usage - * + * @example * ```ts * quantify(1, "apple"); // "1 apple" * ``` * + * @example * ```ts * quantify(3, "apple"); // "3 apples" * ``` * + * @example * ```ts * quantify("02", "box"); // "02 boxes" * ``` * + * @example * ```ts * quantify(1, "child", "children"); // "1 child" * ``` * + * @example * ```ts * quantify(2, "child", "children"); // "2 children" * ``` * + * @example * ```ts * quantify(5, "CPU"); // "5 CPUs" * ``` diff --git a/src/lib/functions/singularize.ts b/src/lib/functions/singularize.ts index a7d09d3..771008d 100644 --- a/src/lib/functions/singularize.ts +++ b/src/lib/functions/singularize.ts @@ -11,32 +11,37 @@ import { preserveCasing } from '../private/util'; * * Preserves the casing of the original input, including acronyms or title case. * - * ## Usage - * + * @example * ```ts * singularize("cities"); // "city" * ``` * + * @example * ```ts * singularize("boxes"); // "box" * ``` * + * @example * ```ts * singularize("children"); // "child" * ``` * + * @example * ```ts * singularize("teeth"); // "tooth" * ``` * + * @example * ```ts * singularize("dogs"); // "dog" * ``` * + * @example * ```ts * singularize("BUZZES"); // "BUZZ" * ``` * + * @example * ```ts * singularize("IDs"); // "ID" * ``` diff --git a/src/lib/functions/snakify.ts b/src/lib/functions/snakify.ts index 88aec27..9bfa036 100644 --- a/src/lib/functions/snakify.ts +++ b/src/lib/functions/snakify.ts @@ -7,24 +7,27 @@ import { PLACEHOLDER } from '../private/constants'; * removes special characters, preserves embedded version tokens (like "v2"), * and lowercases the result. * - * ## Usage - * + * @example * ```ts * snakify("hello world"); // "hello_world" * ``` * + * @example * ```ts * snakify("UserProfileV2"); // "user_profile_v2" * ``` * + * @example * ```ts * snakify("HTML5 Parser"); // "html_5_parser" * ``` * + * @example * ```ts * snakify(" messy-input_string "); // "messy_input_string" * ``` * + * @example * ```ts * snakify("ReportV3Final"); // "report_v3_final" * ``` diff --git a/src/lib/functions/titalize.ts b/src/lib/functions/titalize.ts index 075dd96..520994f 100644 --- a/src/lib/functions/titalize.ts +++ b/src/lib/functions/titalize.ts @@ -5,24 +5,27 @@ * (like "of", "and", "the") unless they appear at the beginning. * Preserves words already containing uppercase letters (e.g., acronyms). * - * ## Usage - * + * @example * ```ts * titalize("the quick brown fox"); // "The Quick Brown Fox" * ``` * + * @example * ```ts * titalize("a tale of two cities"); // "A Tale of Two Cities" * ``` * + * @example * ```ts * titalize("in the heart of the sea"); // "In the Heart of the Sea" * ``` * + * @example * ```ts * titalize("API reference guide"); // "API Reference Guide" * ``` * + * @example * ```ts * titalize(" war and peace "); // "War and Peace" * ``` diff --git a/src/lib/functions/verbalize.ts b/src/lib/functions/verbalize.ts index 9f3c935..608ac07 100644 --- a/src/lib/functions/verbalize.ts +++ b/src/lib/functions/verbalize.ts @@ -7,28 +7,32 @@ import { PLACEHOLDER } from '../private/constants'; * identifiers into space-separated words. Capitalizes the first word, and * preserves acronyms and version tokens (e.g., `v2`, `v3.1`). * - * ## Usage - * + * @example * ```ts * verbalize("helloWorld"); // "Hello world" * ``` * + * @example * ```ts * verbalize("HTML5Parser"); // "HTML 5 parser" * ``` * + * @example * ```ts * verbalize("api_v2_response"); // "Api v2 response" * ``` * + * @example * ```ts * verbalize("User-ID"); // "User ID" * ``` * + * @example * ```ts * verbalize("employeeV3Final"); // "Employee v3 final" * ``` * + * @example * ```ts * verbalize("version_2_0_release"); // "Version 2 0 release" * ``` From 89e0229cd1a31945a4687e139a8b8252dbf65efd Mon Sep 17 00:00:00 2001 From: Maverik Minett Date: Sun, 14 Sep 2025 07:32:01 -0400 Subject: [PATCH 2/2] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 092b06d..01858cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@agape/string", - "version": "2.2.5", + "version": "2.2.6", "description": "String and token manipulation", "main": "./cjs/index.js", "module": "./es2020/index.js",