Skip to content

Commit e9e8b42

Browse files
committed
perf: prefer mutation instead of Object.assign
1 parent 19bed1e commit e9e8b42

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/hover-vanilla/src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ function parseJSON (value) {
2727
}
2828
}
2929

30-
function parseObject (obj) {
30+
function parseObject (obj) {function parseObject (obj) {
3131
return Object.keys(obj).reduce(function (acc, key) {
32-
return Object.assign(acc, { [key]: parseJSON(obj[key]) })
32+
acc[key] = parseJSON(obj[key])
33+
return acc
3334
}, {})
3435
}
3536

packages/vanilla/src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ function parseJSON (value) {
1212

1313
function parseObject (obj) {
1414
return Object.keys(obj).reduce(function (acc, key) {
15-
return Object.assign(acc, { [key]: parseJSON(obj[key]) })
15+
acc[key] = parseJSON(obj[key])
16+
return acc
1617
}, {})
1718
}
1819

0 commit comments

Comments
 (0)