From e30055eccdc8b5751a8afa02d0a9a5eb5885ce88 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 11 Apr 2016 03:50:40 -0400 Subject: [PATCH] use isObject --- src/observer/index.js | 3 ++- src/vdom/modules/class.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/observer/index.js b/src/observer/index.js index a1198ccb..c7b55ca7 100644 --- a/src/observer/index.js +++ b/src/observer/index.js @@ -3,6 +3,7 @@ import { arrayMethods } from './array' import { def, isArray, + isObject, isPlainObject, hasProto, hasOwn @@ -160,7 +161,7 @@ function copyAugment (target, src, keys) { */ export function observe (value, vm) { - if (!value || typeof value !== 'object') { + if (!isObject(value)) { return } var ob diff --git a/src/vdom/modules/class.js b/src/vdom/modules/class.js index 33774ddd..d2822b94 100644 --- a/src/vdom/modules/class.js +++ b/src/vdom/modules/class.js @@ -1,10 +1,10 @@ -import { isArray, setClass } from '../../util/index' +import { isArray, isObject, setClass } from '../../util/index' function genClass (data) { if (!data) { return '' } - if (typeof data === 'object') { + if (isObject(data)) { let res = '' for (var key in data) { if (data[key]) res += key + ' '