Skip to content

Commit

Permalink
Fix unCamelcase parsing of entry with numbers
Browse files Browse the repository at this point in the history
This fixes #15
  • Loading branch information
demsking authored Nov 3, 2017
2 parents 8132421 + 76eae1c commit 01b1ca7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const unCamelcase = (text) => {
const chars = []

text.split('').forEach((char) => {
if (char !== '-' && char === char.toUpperCase()) {
if (/[A-Z]/.test(char)) {
char = char.toLowerCase()

if (chars.length) {
Expand Down
8 changes: 8 additions & 0 deletions test/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,14 @@ describe('libutils', () => {

assert.equal(result, entry)
})

it('should succeed with entry that contains numbers', () => {
const entry = 'i18n'
const result = utils.unCamelcase(entry)
const expected = 'i18n'

assert.equal(result, expected)
})
})

describe('getDependencies(ast, source)', () => {
Expand Down

0 comments on commit 01b1ca7

Please sign in to comment.