Skip to content

Commit

Permalink
Observer: only walk object if it is plain
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 30, 2015
1 parent 90fb381 commit d4d61ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/observer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Observer (value) {
: copyAugment
augment(value, arrayMethods, arrayKeys)
this.observeArray(value)
} else {
} else if (_.isPlainObject(value)) {
this.walk(value)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/util/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ exports.isObject = function (obj) {
*/

var toString = Object.prototype.toString
var OBJECT_STRING = '[object Object]'
exports.isPlainObject = function (obj) {
return toString.call(obj) === '[object Object]'
return toString.call(obj) === OBJECT_STRING
}

/**
Expand Down

0 comments on commit d4d61ef

Please sign in to comment.