1 2 var comb = exports; 3 4 /** 5 * Determines if obj is a boolean 6 * 7 * @param {Anything} obj the thing to test if it is a boolean 8 * 9 * @returns {Boolean} true if it is a boolean false otherwise 10 */ 11 comb.isBoolean = function(obj) { 12 var undef, type = typeof obj; 13 return obj != undef && type == "boolean" || type == "Boolean"; 14 }; 15 16 /** 17 * Determines if obj is undefined 18 * 19 * @param {Anything} obj the thing to test if it is undefined 20 * @returns {Boolean} true if it is undefined false otherwise 21 */ 22 comb.isUndefined = function(obj) { 23 var undef; 24 return obj !== null && obj === undef; 25 }; 26 27 /** 28 * Determines if obj is undefined or null 29 * 30 * @param {Anything} obj the thing to test if it is undefined or null 31 * @returns {Boolean} true if it is undefined or null false otherwise 32 */ 33 comb.isUndefinedOrNull = function(obj){ 34 return comb.isUndefined(obj) || comb.isNull(obj); 35 } 36 37 /** 38 * Determines if obj is null 39 * 40 * @param {Anything} obj the thing to test if it is null 41 * 42 * @returns {Boolean} true if it is null false otherwise 43 */ 44 comb.isNull = function(obj) { 45 var undef; 46 return obj !== undef && obj == null; 47 }; 48 49 /** 50 * Determines if obj is an instance of a particular class 51 * 52 * @param {Anything} obj the thing to test if it and instnace of a class 53 * @param {Object} Clazz used to determine if the object is an instance of 54 * 55 * @returns {Boolean} true if it is an instance of the clazz false otherwise 56 */ 57 comb.isInstanceOf = function(obj, clazz) { 58 if (typeof clazz == "function") { 59 return obj instanceof clazz; 60 }else{ 61 return false; 62 } 63 };