string-utils-pro-sf
Version:
reverseString capitalizeWords toSnakeCase toKebabCase
74 lines (55 loc) • 1.73 kB
Markdown
# String Utils Pro
A simple utility library for common string manipulation tasks in JavaScript.
## Features
This library provides the following functions:
- **reverseString**: Reverses the given string.
- **capitalizeWords**: Capitalizes the first letter of each word.
- **toSnakeCase**: Converts the given string to snake_case.
- **toKebabCase**: Converts the given string to kebab-case.
## Installation
To install the package, run the following command in your project directory:
```bash
npm install string-utils-pro-sf
```
## Usage
After installing the package, you can import the functions and use them as needed.
### Import the package
```
const {
reverseString,
capitalizeWords,
toSnakeCase,
toKebabCase,
} = require('string-utils-pro-sf');
```
### Reverse a string
Generate the reversed version of a string:
```
const reversed = reverseString('hello world');
console.log(reversed);
// Output: 'dlrow olleh'
```
### Capitalize words
Capitalize the first letter of every word in a string:
```
const capitalized = capitalizeWords('hello world');
console.log(capitalized);
// Output: 'Hello World'
```
### Convert to snake_case
Transform a string to snake_case:
```
const snakeCase = toSnakeCase('Hello World Test');
console.log(snakeCase);
// Output: 'hello_world_test'
```
### Convert to kebab-case
Transform a string to kebab-case:
```
const kebabCase = toKebabCase('Hello World Test');
console.log(kebabCase);
// Output: 'hello-world-test'
```
## Notes
** These utilities are synchronous and optimized for typical string manipulation tasks.
** Input strings should be clean and properly formatted for best results.