Skip to content

fczbkk/convert-case

Repository files navigation

Convert case

Utility for converting strings between camelCase, snake_case, kebab-case, etc.

npm npm David Travis

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

Returns string

parseCharacters

Breaks input into array containing metadata about each character.

Parameters

Returns Array<Object>

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 riki@fczbkk.com. 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.

About

Utility for converting strings between camelCase, snake_case, kebab-case, etc.

Resources

License

Stars

Watchers

Forks

Packages

No packages published