Skip to content

Commit d4d61ef

Browse files
committed
Observer: only walk object if it is plain
1 parent 90fb381 commit d4d61ef

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/observer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function Observer (value) {
2525
: copyAugment
2626
augment(value, arrayMethods, arrayKeys)
2727
this.observeArray(value)
28-
} else {
28+
} else if (_.isPlainObject(value)) {
2929
this.walk(value)
3030
}
3131
}

src/util/lang.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ exports.isObject = function (obj) {
191191
*/
192192

193193
var toString = Object.prototype.toString
194+
var OBJECT_STRING = '[object Object]'
194195
exports.isPlainObject = function (obj) {
195-
return toString.call(obj) === '[object Object]'
196+
return toString.call(obj) === OBJECT_STRING
196197
}
197198

198199
/**

0 commit comments

Comments
 (0)