Selaa lähdekoodia

port hyphenate fix

Evan You 9 vuotta sitten
vanhempi
commit
06ca85d633
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 2 1
      src/shared/util.js

+ 2 - 1
src/shared/util.js

@@ -99,9 +99,10 @@ export const capitalize = cached((str: string): string => {
 /**
  * Hyphenate a camelCase string.
  */
-const hyphenateRE = /([a-z\d])([A-Z])/g
+const hyphenateRE = /([^-])([A-Z])/g
 export const hyphenate = cached((str: string): string => {
   return str
+    .replace(hyphenateRE, '$1-$2')
     .replace(hyphenateRE, '$1-$2')
     .toLowerCase()
 })