Skip to content

Commit 4652fe9

Browse files
committed
Merge pull request #1500 from VisualSJ/develop-cc.sys
Issue #1498: bug on cc.isObject
2 parents 90118b7 + 0333274 commit 4652fe9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

frameworks/js-bindings/bindings/script/jsb_boot.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ cc.isString = function(obj) {
101101
* @returns {boolean}
102102
*/
103103
cc.isArray = function(obj) {
104-
return Object.prototype.toString.call(obj) == '[object Array]';
104+
return Array.isArray(obj) ||
105+
(typeof obj === 'object' && objectToString(obj) === '[object Array]');
105106
};
106107

107108
/**
@@ -110,7 +111,7 @@ cc.isArray = function(obj) {
110111
* @returns {boolean}
111112
*/
112113
cc.isUndefined = function(obj) {
113-
return typeof obj == 'undefined';
114+
return typeof obj === 'undefined';
114115
};
115116

116117
/**
@@ -119,9 +120,8 @@ cc.isUndefined = function(obj) {
119120
* @returns {boolean}
120121
*/
121122
cc.isObject = function(obj) {
122-
var type = typeof obj;
123-
124-
return type == 'function' || (obj && type == 'object');
123+
return obj.__nativeObj !== undefined ||
124+
( typeof obj === "object" && Object.prototype.toString.call(obj) === '[object Object]' );
125125
};
126126

127127
/**

0 commit comments

Comments
 (0)