1.2.0 • Published 12 months ago

@noobdevelova/stringformatter v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

String Formatter

String Formatter is a lightweight JavaScript library designed to provide easy-to-use functions for capitalizing strings. Whether you need to capitalize the first letter of a string, each part of a full name, or just a single name, this library simplifies these tasks with straightforward methods.

Features

  • Capitalize First: Capitalizes the first letter of a given string and converts the rest of the string to lowercase.
  • Capitalize Full Name: Capitalizes the first letter of each part of a full name, making it suitable for formatting names in user interfaces.
  • Capitalize Single Name: Capitalizes the first letter of a single name, useful for title cases and user-friendly displays.

Installation

You can install the library via npm:

npm install @noobdevelova/stringformatter

Usage

Example usage of this library:

import {
  capitalizeFirst,
  capitalizeFullName,
  capitalizeSingleName,
  capitalizeAll,
} from "@noobdevelova/stringformatter";

// Example usage

// Capitalize the first letter of a single name
const singleName = capitalizeSingleName("john");
console.log(singleName); // Output: John

// Capitalize the first letter of each part of a full name
const fullName = capitalizeFullName("john doe");
console.log(fullName); // Output: John Doe

// Capitalize the first letter of a string
const firstNameCapitalized = capitalizeFirst("example");
console.log(firstNameCapitalized); // Output: Example

// Capitalize the first letter of a string and lower the rest
const firstNameCapitalizedAndFix = capitalizeFirstAndFix("eXAMPle");
console.log(firstNameCapitalizedAndFix); // Output: Example

// Capitalize all letter of a string
const allCapitalized = capitalizeAll("example");
console.log(firstNameCapitalized); // Output: EXAMPLE

Acknowledgments

  • Author: Randi Risdiansyah

License

This library is licensed under the MIT License.

1.2.0

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago