Skip to content

Weird results when original string consists of all caps #30

@alidrus

Description

@alidrus

I'm trying to make some case conversions for certain types of sensors (e.g. pH sensor, TSS sensor etc).

I haven't covered all the different case types here but I think this is sufficient to indicate there is a fundamental problem with single-letter abbreviated words. For example, in the following code:

import { capitalCase, kebabCase, camelCase, pascalCase } from 'case-anything';

// From Camel Case
console.log(pascalCase('tSS'));
console.log(camelCase('tSS'));
console.log(capitalCase('tSS'));
console.log(kebabCase('tSS'));

// From Pascal Case
console.log(pascalCase('TSS'));
console.log(camelCase('TSS'));
console.log(capitalCase('TSS'));
console.log(kebabCase('TSS'));

Gives the following wrong results:

TSs
tSs
T Ss
t-ss
Tss
tss
Tss
tss

Which is different from the expected result which SHOULD be:

TSS
tSS
T S S
t-s-s
TSS
tSS
T S S
t-s-s

By the way the abbreviation "TSS" used here stands for "Total Suspended Solids". I am using "TSS" to shorten strings.

All that being said, this is a magnificent project and I hope this bug report will help improve it even further. Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions