Skip to content

Commit

Permalink
inline is_uppercase for perf
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Veneman committed Jul 26, 2024
1 parent 7e16739 commit 6f74744
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ const TYPE_SELECTOR = 'Selector'
const TYPE_DECLARATION = 'Declaration'
const TYPE_OPERATOR = 'Operator'

/**
* Check if a string contains uppercase characters
* @param {string} str
*/
function is_uppercase(str) {
return /[A-Z]/.test(str)
}

/** @param {string} str */
function lowercase(str) {
if (is_uppercase(str)) {
// Only create new strings in memory if we need to
if (/[A-Z]/.test(str)) {
return str.toLowerCase()
}
return str
Expand Down

0 comments on commit 6f74744

Please sign in to comment.