Skip to content

Commit 0ab95b7

Browse files
committed
refactor(runtime-vapor): replace apply with spread operator for key extraction
1 parent 8e2d140 commit 0ab95b7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/runtime-vapor/src/apiCreateFor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const createFor = (
159159
while (right < commonLength) {
160160
const index = newLength - right - 1
161161
const item = getItem(source, index)
162-
const key = getKey.apply(null, item)
162+
const key = getKey(...item)
163163
const block = oldBlocks[oldLength - right - 1]
164164
if (block.key === key) {
165165
update(block, ...item)
@@ -175,7 +175,7 @@ export const createFor = (
175175

176176
while (left < commonLength - right) {
177177
const item = getItem(source, left)
178-
const key = getKey.apply(null, item)
178+
const key = getKey(...item)
179179
const oldBlock = oldBlocks[left]
180180
const oldKey = oldBlock.key
181181
if (oldKey === key) {
@@ -194,14 +194,14 @@ export const createFor = (
194194
const prepareLength = Math.min(newLength - right, commonLength)
195195
for (let i = left; i < prepareLength; i++) {
196196
const item = getItem(source, i)
197-
const key = getKey.apply(null, item)
197+
const key = getKey(...item)
198198
pendingNews[l1++] = [i, item, key]
199199
}
200200

201201
if (!l1 && !l2) {
202202
for (let i = prepareLength; i < newLength - right; i++) {
203203
const item = getItem(source, i)
204-
const key = getKey.apply(null, item)
204+
const key = getKey(...item)
205205
mount(source, i, item, key, defaultAnchor)
206206
}
207207
} else {
@@ -250,7 +250,7 @@ export const createFor = (
250250

251251
for (let i = prepareLength; i < newLength - right; i++) {
252252
const item = getItem(source, i)
253-
const key = getKey.apply(null, item)
253+
const key = getKey(...item)
254254
moveOrMount(i, item, key, -1)
255255
}
256256

0 commit comments

Comments
 (0)