Skip to content

Commit

Permalink
feat: vue compliant style string parsing (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorehouse authored and alexsasharegan committed Jun 1, 2019
1 parent f66248b commit e7d640b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { VNodeData } from "vue";
const pattern = {
camel: /-(\w)/g,
style: /:(.*)/,
styleList: /;(?![^(]*\))/g,
} as const;

function camelReplace(_substr: string, match: string) {
Expand All @@ -16,7 +17,7 @@ function camelCase(str: string) {
function parseStyle(style: string) {
let styleMap: Record<string, any> = {};

for (let s of style.split(";")) {
for (let s of style.split(pattern.styleList)) {
let [key, val] = s.split(pattern.style);
key = key.trim();
if (!key) {
Expand Down

0 comments on commit e7d640b

Please # to comment.