text-tweak
text-tweak is a lightweight JavaScript/TypeScript package for effortless string casing formatting. With text-tweak, you can easily convert text between various casing styles such as lowercase, UPPERCASE, Title Case, camelCase, snake_case, kebab-case, PascalCase, and more.
Installation
To install text-tweak, simply use npm:
npm install text-tweak
Key Features
- Convert text to lowercase, UPPERCASE, Title Case, sentence case, and more.
- Transform text into camelCase, snake_case, kebab-case, PascalCase, and more.
- Create engaging and consistent text formatting effortlessly.
- Supports a variety of common and custom casing styles.
Why Choose text-tweak
- Easy-to-use functions for quick and efficient string casing transformations.
- Versatile package suitable for a wide range of projects.
- Lightweight package with minimal overhead.
- Well-tested and reliable functions to ensure consistent results.
How to Use
To use the functions provided by the text-tweak
package, follow these steps:
- Import the necessary functions from the
text-tweak
package:
import {
toLowerCase,
toUpperCase,
toTitleCase,
toSentenceCase,
toCamelCase,
toSnakeCase,
toKebabCase,
toPascalCase,
toConstantCase,
toDotCase,
toPathCase,
toAlternatingCase,
toInvertedCase,
toSpongeCase,
toReverseCase,
toSmallCaps
} from 'text-tweak';
toLowerCase()
Converts a string to lowercase.
const text = 'Hello World';
const lowerCaseText = toLowerCase(text);
console.log(lowerCaseText);
toUpperCase()
Converts a string to uppercase.
const text = 'Hello World';
const upperCaseText = toUpperCase(text);
console.log(upperCaseText);
toTitleCase()
Converts a string to camel case.
const text = 'hello world';
const camelCaseText = toCamelCase(text);
console.log(camelCaseText);
toSentenceCase()
Converts a string to camel case.
const text = 'hello world';
const camelCaseText = toCamelCase(text);
console.log(camelCaseText);
toCamelCase()
Converts a string to camel case.
const text = 'hello world';
const camelCaseText = toCamelCase(text);
console.log(camelCaseText);
toKebabCase()
Converts a string to kebab case.
const text = 'Hello World';
const kebabCaseText = toKebabCase(text);
console.log(kebabCaseText);
toPascalCase()
Converts a string to Pascal case.
const text = 'hello world';
const pascalCaseText = toPascalCase(text);
console.log(pascalCaseText);
toConstantCase()
Converts a string to constant case.
const text = 'Hello World';
const constantCaseText = toConstantCase(text);
console.log(constantCaseText);
toDotCase()
Converts a string to dot case.
const text = 'Hello World';
const dotCaseText = toDotCase(text);
console.log(dotCaseText);
toPathCase()
Converts a string to path case.
const text = 'Hello World';
const pathCaseText = toPathCase(text);
console.log(pathCaseText);
toAlternatingCase()
Converts a string to alternating case.
const text = 'Hello World';
const alternatingCaseText = toAlternatingCase(text);
console.log(alternatingCaseText);
toInvertedCase()
Converts a string to inverted case.
const text = 'Hello World';
const invertedCaseText = toInvertedCase(text);
console.log(invertedCaseText);
toSpongeCase()
Converts a string to sponge case.
const text = 'Hello World';
const spongeCaseText = toSpongeCase(text);
console.log(spongeCaseText);
toReverseCase()
Converts a string to reverse case.
const text = 'Hello World';
const reverseCaseText = toReverseCase(text);
console.log(reverseCaseText);
toSmallCaps()
Converts a string to small caps.
const text = 'Hello World';
const smallCapsText = toSmallCaps(text);
console.log(smallCapsText);
Check out these other fantastic packages developed by Me:
-
Debounce Throttling 🕒 - Smooth out your application's performance by managing function calls with debouncing and throttling techniques.
-
LocalSafe 🔒 - Securely store sensitive data locally in the user's browser with encryption and other protective measures.
-
Online Status JS 🌐 - Keep track of your user's online status and enhance your application's real-time capabilities.
🌟 Made with ❤️ by Ashish