https://github.com/biancahpp/to-kebab
https://github.com/biancahpp/to-kebab
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/biancahpp/to-kebab
- Owner: biancahpp
- License: mit
- Created: 2023-11-19T22:15:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-19T22:54:25.000Z (over 1 year ago)
- Last Synced: 2025-02-23T20:37:41.967Z (3 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# To Kebab
A simple npm package for converting strings, objects, and arrays to kebab-case.
## Installation
You can install this package using npm or yarn:
```bash
npm install your-package-name
# or
yarn add your-package-name
```## Usage
`stringToKebab(string)`
Converts a string to kebab-case.
```javascript
const { stringToKebab } = require("your-package-name");const kebabCaseString = stringToKebab("ThisIsAString");
console.log(kebabCaseString); // Output: 'this-is-a-string'
````objectToKebab(obj)`
Converts the keys of an object to kebab-case.
```javascript
const { objectToKebab } = require("your-package-name");const inputObject = {
camelCaseKey: "value1",
snake_case_key: "value2",
};const kebabCaseObject = objectToKebab(inputObject);
console.log(kebabCaseObject);
// Output: { 'camel-case-key': 'value1', 'snake-case-key': 'value2' }
````arrayToKebab(arr)`
Converts an array of strings to kebab-case.
```javascript
const { arrayToKebab } = require("your-package-name");const inputArray = ["ThisIsAString", "AnotherString"];
const kebabCaseArray = arrayToKebab(inputArray);
console.log(kebabCaseArray); // Output: [ 'this-is-a-string', 'another-string' ]
```## Contributing
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue on the GitHub repository.
## License
This package is licensed under the MIT License.