File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,63 @@ cc.extend = function(target) {
103103 return target ;
104104} ;
105105
106+ /**
107+ * Check the obj whether is function or not
108+ * @param {* } obj
109+ * @returns {boolean }
110+ */
111+ cc . isFunction = function ( obj ) {
112+ return typeof obj == 'function' ;
113+ } ;
114+
115+ /**
116+ * Check the obj whether is number or not
117+ * @param {* } obj
118+ * @returns {boolean }
119+ */
120+ cc . isNumber = function ( obj ) {
121+ return typeof obj == 'number' || Object . prototype . toString . call ( obj ) == '[object Number]' ;
122+ } ;
123+
124+ /**
125+ * Check the obj whether is string or not
126+ * @param {* } obj
127+ * @returns {boolean }
128+ */
129+ cc . isString = function ( obj ) {
130+ return typeof obj == 'string' || Object . prototype . toString . call ( obj ) == '[object String]' ;
131+ } ;
132+
133+ /**
134+ * Check the obj whether is array or not
135+ * @param {* } obj
136+ * @returns {boolean }
137+ */
138+ cc . isArray = function ( obj ) {
139+ return Object . prototype . toString . call ( obj ) == '[object Array]' ;
140+ } ;
141+
142+ /**
143+ * Check the obj whether is undefined or not
144+ * @param {* } obj
145+ * @returns {boolean }
146+ */
147+
148+ cc . isUndefined = function ( obj ) {
149+ return typeof obj == 'undefined' ;
150+ } ;
151+
152+ /**
153+ * Check the obj whether is object or not
154+ * @param {* } obj
155+ * @returns {boolean }
156+ */
157+ cc . isObject = function ( obj ) {
158+ var type = typeof obj ;
159+
160+ return type == 'function' || ( obj && type == 'object' ) ;
161+ }
162+
106163/**
107164 * Check the url whether cross origin
108165 * @param {String } url
You can’t perform that action at this time.
0 commit comments