@fczbkk/convert-case
v1.0.0
Published
Utility for converting strings between camelCase, snake_case, kebab-case, etc.
Downloads
7
Readme
Convert case
Utility for converting strings between camelCase, snake_case, kebab-case, etc.
How to use
Install the library via NPM:
npm install @fczbkk/convert-case --save
Then use in your project like this:
import convertCase from '@fczbkk/convert-case';
// convert between any combination of cases
var human_string = 'aaa bbb ccc';
var camel_string = convertCase(human_string, 'human', 'camel'); // aaaBbbCcc
var pascal_string = convertCase(camel_string, 'camel', 'pascal'); // AaaBbbCcc
var upper_string = convertCase(pascal_string, 'pascal', 'upper'); // AAA_BBB_CCC
var kebab_string = convertCase(upper_string, 'upper', 'kebab'); // aaa-bbb-ccc
Documentation
CapitalizationType
Type of capitalization: human, camel, snake, kebab, upper or pascal.
convertCase
Converts string from one type of capitalization to another.
Parameters
input
stringsource_case
CapitalizationTypetarget_case
CapitalizationType
Returns string
parseCharacters
Breaks input into array containing metadata about each character.
Parameters
Bug reports, feature requests and contact
If you found any bugs, if you have feature requests or any questions, please, either file an issue at GitHub or send me an e-mail at [email protected]. The best bug report is a pull request with failing test.
Contributing
- All pull requests are welcome.
- Use
npm run dev
task for local development. It will start a watch task that will run tests against each code change. - Don't forget to add/update tests and documentation.
Thank you.
License
Convert case is published under the MIT license.