1.0.5 • Published 4 years ago
@huz-com/text-case v1.0.5
Huz.Com > Component > Text Case
- Converts different naming conventions
- Provides also aliases for different naming culture
Standards
- Language:
TS - Eslint:
Yes - Static Code Analysis:
YesIntelliJ Code Inspections - DDD - Document Driven:
Yes - EDD - Exception Driven:
Yes - TDD - Test Driven:
Yesgo to test folder - Standards Complied: Huz Standards
Commands
npm run clear// clears "dist" foldernpm run lint// runs eslint for static code analysisnpm run test// runs test files in "test" foldernpm run build// builds JS files at "dist" foldernpm publishornpm run publix// publishes "dist" folder to npm
Formats
- camelCase, camelize:
textCase - pascalCase, capitalize:
TextCase - snakeCase, underscore, decamelize:
text_case - kebabCase, dashCase:
text-case - upperCase, allCaps, constCase:
TEXT_CASE - titleCase, labelCase:
Text Case - regularCase, humanize:
text case - dotCase:
text.case - folderCase:
text/case - pipeCase:
text|case
Install
npm i @huz-com/text-case
Samples
const {textCase} = require('@huz-com/text-case');
textCase.snakeCase('foo bar'); // ==> foo_bar
textCase.underscore('fooBar'); // alias for textCase.snakeCase
textCase.decamelize('FOO_BAR'); // alias for textCase.snakeCase
textCase.camelCase('foo--bar'); // ==> fooBar
textCase.camelCase('foo-BAR', true); // ==> fooBAR
textCase.camelize('FOO BAR'); // alias for textCase.camelCase
textCase.pascalCase('foo--bar'); // ==> FooBar
textCase.pascalCase('foo-BAR', true); // ==> FooBAR
textCase.capitalize('FOO BAR'); // alias for textCase.pascalCase
textCase.titleCase('foo--bar'); // ==> Foo Bar
textCase.labelCase('FOO BAR'); // alias for textCase.titleCase
textCase.regularCase('fooBar'); // ==> foo bar
textCase.humanize('FOO BAR'); // alias for textCase.regularCase
textCase.kebabCase('fooBar'); // ==> foo-bar
textCase.dashCase('FOO BAR'); // alias for textCase.kebabCase
textCase.upperCase('fooBar'); // ==> FOO_BAR
textCase.allCaps('foo--bar'); // alias for textCase.upperCase
textCase.constCase('FOO BAR'); // alias for textCase.upperCase
textCase.dotCase('fooBar'); // ==> foo.bar
textCase.folderCase('fooBar'); // ==> foo/bar
textCase.pipeCase('fooBar'); // ==> foo|barException Handling
- If input's type is not string then throws
TextCaseTextError