Skip to content

Commit

Permalink
refactor: use some instead of find
Browse files Browse the repository at this point in the history
Co-authored-by: edison <daiwei521@126.com>
  • Loading branch information
KazariEX and edison1105 authored Sep 5, 2024
1 parent 5073a6e commit d40e385
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/compiler-core/src/transforms/transformElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ export function buildProps(
}

// force hydration for v-bind with .prop modifier
if (isVBind && modifiers.find(mod => mod.content === 'prop')) {
if (isVBind && modifiers.some(mod => mod.content === 'prop')) {
patchFlag |= PatchFlags.NEED_HYDRATION
}

Expand Down
6 changes: 3 additions & 3 deletions packages/compiler-core/src/transforms/vBind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const transformBind: DirectiveTransform = (dir, _node, context) => {
}

// .sync is replaced by v-model:arg
if (modifiers.find(mod => mod.content === 'camel')) {
if (modifiers.some(mod => mod.content === 'camel')) {
if (arg.type === NodeTypes.SIMPLE_EXPRESSION) {
if (arg.isStatic) {
arg.content = camelize(arg.content)
Expand All @@ -83,10 +83,10 @@ export const transformBind: DirectiveTransform = (dir, _node, context) => {
}

if (!context.inSSR) {
if (modifiers.find(mod => mod.content === 'prop')) {
if (modifiers.some(mod => mod.content === 'prop')) {
injectPrefix(arg, '.')
}
if (modifiers.find(mod => mod.content === 'attr')) {
if (modifiers.some(mod => mod.content === 'attr')) {
injectPrefix(arg, '^')
}
}
Expand Down

0 comments on commit d40e385

Please # to comment.