https://github.com/danmad/on-the-case
Extends JavaScript's native `String` object, including additional case conversion methods
https://github.com/danmad/on-the-case
case-conversion javascript typescript
Last synced: 3 months ago
JSON representation
Extends JavaScript's native `String` object, including additional case conversion methods
- Host: GitHub
- URL: https://github.com/danmad/on-the-case
- Owner: DanMad
- License: mit
- Created: 2021-07-03T01:12:30.000Z (almost 5 years ago)
- Default Branch: develop
- Last Pushed: 2024-08-30T13:57:35.000Z (almost 2 years ago)
- Last Synced: 2024-09-15T01:46:09.411Z (almost 2 years ago)
- Topics: case-conversion, javascript, typescript
- Language: TypeScript
- Homepage: https://github.com/danmad/on-the-case#readme
- Size: 1.61 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# onTheCase.js
Extends JavaScript's native `String` object, including additional
case conversion methods.
## Table of Contents
- [Getting Started](#getting-started)
- [Usage](#usage)
- [Issues](#issues)
- [Contributing](#contributing)
## Getting Started
To use _onTheCase.js_, add it to your project.
```sh
yarn add on-the-case
```
Alternatively, _onTheCase.js_ can be added to your project via CDN.
```html
```
## Usage
The following case conversion methods are included in _onTheCase.js_.
### Camel Case
The `toCamelCase()` method returns the calling string value converted to camel
case.
#### Examples
```js
'Hello, World!'.toCamelCase();
// => 'helloWorld'
'The quick brown fox jumps over the lazy dog.'.toCamelCase();
// => 'theQuickBrownFoxJumpsOverTheLazyDog'
```
### Kebab Case
The `toKebabCase()` method returns the calling string value converted to kebab
case.
#### Examples
```js
'Hello, World!'.toKebabCase();
// => 'hello-world'
'the-quick-brown-fox-jumps-over-the-lazy-dog.'.toKebabCase();
// => 'the-quick-brown-fox-jumps-over-the-lazy-dog'
```
### Pascal Case
The `toPascalCase()` method returns the calling string value converted to pascal
case.
#### Examples
```js
'Hello, World!'.toPascalCase();
// => 'HelloWorld'
'The quick brown fox jumps over the lazy dog.'.toPascalCase();
// => 'TheQuickBrownFoxJumpsOverTheLazyDog'
```
### Snake Case
The `toSnakeCase()` method returns the calling string value converted to snake
case.
#### Examples
```js
'Hello, World!'.toSnakeCase();
// => 'hello_world'
'The quick brown fox jumps over the lazy dog.'.toSnakeCase();
// => 'the_quick_brown_fox_jumps_over_the_lazy_dog'
```
### Title Case
The `toTitleCase()` method returns the calling string value converted to title
case.
#### Examples
```js
'Hello, World!'.toTitleCase();
// => 'Hello, World!'
'The quick brown fox jumps over the lazy dog.'.toTitleCase();
// => 'The Quick Brown Fox Jumps Over the Lazy Dog.'
```
## Issues
If you encounter any bugs, please
[post an issue](https://github.com/DanMad/on-the-case/issues/new).
## Contributing
Contributions are more than welcome. Ensure you read through the
[contributing guidelines](https://github.com/DanMad/on-the-case/blob/main/CONTRIBUTING.md)
before submitting a pull request.