Skip to content

Commit

Permalink
Merge d25e096 into 90fa8c6
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomontalbano committed Feb 27, 2020
2 parents 90fa8c6 + d25e096 commit 52da14b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
17 changes: 16 additions & 1 deletion packages/output-components-utils/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';

import { camelCase } from './index';
import { camelCase, pascalCase } from './index';

describe('utils', () => {
it('camelCase', async () => {
Expand All @@ -17,4 +17,19 @@ describe('utils', () => {
expect(camelCase('with {curly}')).to.eql('withCurly');
expect(camelCase('Random[thIng]s')).to.eql('randomThIngS');
});

it('pascalCase', async () => {
expect(pascalCase('')).to.eql('');
expect(pascalCase('a')).to.eql('A');
expect(pascalCase('a word')).to.eql('AWord');
expect(pascalCase('a 5 number')).to.eql('A5Number');
expect(pascalCase('with-dash')).to.eql('WithDash');
expect(pascalCase('with_lodash')).to.eql('WithLodash');
expect(pascalCase('with/slash')).to.eql('WithSlash');
expect(pascalCase('with\\backslash')).to.eql('WithBackslash');
expect(pascalCase('with [square]')).to.eql('WithSquare');
expect(pascalCase('with (round)')).to.eql('WithRound');
expect(pascalCase('with {curly}')).to.eql('WithCurly');
expect(pascalCase('Random[thIng]s')).to.eql('RandomThIngS');
});
});
7 changes: 6 additions & 1 deletion packages/output-components-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ const camelCase = (str: string): string => {
}, '');
};

export { camelCase };
const pascalCase = (str: string): string => upperFirst(camelCase(str));

export {
camelCase,
pascalCase,
};

0 comments on commit 52da14b

Please sign in to comment.