8000 util: use Object.keys() in _.extend · Aphasia-GitHub/vue@559768d · GitHub
[go: up one dir, main page]

Skip to content

Commit 559768d

Browse files
committed
util: use Object.keys() in _.extend
1 parent 64395c2 commit 559768d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/util/lang.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ exports.toArray = function (list, start) {
163163
*/
164164

165165
exports.extend = function (to, from) {
166-
for (var key in from) {
167-
to[key] = from[key]
166+
var keys = Object.keys(from)
167+
var i = keys.length
168+
while (i--) {
169+
to[keys[i]] = from[keys[i]]
168170
}
169171
return to
170172
}

0 commit comments

Comments
 (0)
0