Skip to content

Commit

Permalink
Merge pull request #60 from ljsnagy/better-screaming-snake-case-regex
Browse files Browse the repository at this point in the history
Improve screaming snake case regex.
  • Loading branch information
skellock committed Jul 24, 2018
2 parents f0e9eda + 9f7ce65 commit e55381f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/createActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ const defaultOptions = {
prefix: ''
}

// matches on capital letters (except at the start & end of the string)
const RX_CAPS = /(?!^)([A-Z])/g
// matches each word in a camelCaseString (except the first)
// consecutive capitals are treated as one word
const RX_CAPS = /(?!^)([A-Z][a-z]+|[A-Z]+(?=[A-Z]|\b))/g

// converts a camelCaseWord into a SCREAMING_SNAKE_CASE word
const camelToScreamingSnake = pipe(
Expand Down

0 comments on commit e55381f

Please sign in to comment.