blakeembrey / blakeembrey/change-case
Issue transforming from PascalCase to kebab-case
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 106
- PR merge metrics
- No merged PRs in 30d
Description
Hi
Thanks for the library. I am trying to transform strings between PascalCase and kebab-case but there is a mistmatch when two consuctive charchters occure.
This is my code
```js
import * as changeCase from 'change-case';
const { pascalCase, kebabCase, splitSeparateNumbers } = changeCase;
const data = ['an-outlined-open-a-i', 'an-outlined-harmony-o-s', 'bx-sort-a-z'];
const pascalCases = data.map((icon) => {
return pascalCase(icon, {
mergeAmbiguousCharacters: true,
split: splitSeparateNumbers,
});
});
const kebabCasesFromPascal = pascalCases.map((icon) => {
return kebabCase(icon, {
split: splitSeparateNumbers,
});
});
console.log('Original Data:', data);
console.log('Pascal Cases:', pascalCases);
console.log('Kebab Cases from Pascal:', kebabCasesFromPascal);
```
which outputs
```
Original Data: [ 'an-outlined-open-a-i', 'an-outlined-harmony-o-s', 'bx-sort-a-z' ]
Pascal Cases: [ 'AnOutlinedOpenAI', 'AnOutlinedHarmonyOS', 'BxSortAZ' ]
Kebab Cases from Pascal: [ 'an-outlined-open-ai', 'an-outlined-harmony-os', 'bx-sort-az' ]
```
as you can see in Kebab Case from Pascal that `a-i` became `ai` and so on for the other strings. I disabled the options `mergeAmbiguousCharacters` and `splitSeparateNumbers` with the same results.
I am using version `5.4.4`
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the supplied example using the pascalCase and kebabCase entry points and compare the intermediate PascalCase values with the expected round trip. The payload names no source files or tests; first determine the intended behavior for consecutive characters such as “A-I”, then add regression coverage demonstrating the agreed result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100