Skip to content

Commit 8accdae

Browse files
committed
refactor: remove redundant code and checks
1 parent dbe17df commit 8accdae

File tree

1 file changed

+6
-6
lines changed
  • packages/babel-sugar-v-model/src

1 file changed

+6
-6
lines changed

packages/babel-sugar-v-model/src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ const parseVModel = (t, path) => {
5353
if (t.isJSXNamespacedName(path.get('name')) || !startsWithCamel(path.get('name.name').node, 'v-model')) {
5454
return null
5555
}
56-
let modifiers = null
57-
let _
56+
5857
if (!t.isJSXExpressionContainer(path.get('value'))) {
5958
throw new Error('You have to use JSX Expression inside your v-model')
60-
} else if (t.isJSXIdentifier(path.get('name'))) {
61-
;[_, ...modifiers] = path.get('name.name').node.split('_')
62-
modifiers = new Set(modifiers)
6359
}
60+
61+
const modifiers = path.get('name.name').node.split('_')
62+
modifiers.shift()
63+
6464
return {
65-
modifiers: modifiers,
65+
modifiers: new Set(modifiers),
6666
valuePath: path.get('value.expression'),
6767
}
6868
}

0 commit comments

Comments
 (0)