simple-string-utils-study
Version:
Simple string utility functions for study purposes
51 lines (33 loc) • 834 B
Markdown
# Simple String Utils
A simple collection of string utility functions for study purposes.
## Installation
```bash
npm install simple-string-utils-study
```
## Usage
```javascript
const { capitalize, reverse, kebabCase, wordCount } = require('simple-string-utils-study');
// Capitalize first letter
console.log(capitalize('hello')); // 'Hello'
// Reverse string
console.log(reverse('hello')); // 'olleh'
// Convert to kebab-case
console.log(kebabCase('HelloWorld')); // 'hello-world'
// Count words
console.log(wordCount('hello world')); // 2
```
## API
### `capitalize(str)`
Capitalizes the first letter of a string.
### `reverse(str)`
Reverses a string.
### `kebabCase(str)`
Converts a string to kebab-case.
### `wordCount(str)`
Counts the number of words in a string.
## Testing
```bash
npm test
```
## License
MIT