1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-09 18:06:53 +02:00
TableFilter/src-es6/types.js

56 lines
980 B
JavaScript
Raw Normal View History

2014-11-16 01:29:07 +01:00
/**
* Types utilities
*/
var Types = {};
var UNDEFINED = void 0;
/**
* Checks if var exists and is an object
* @param {String or Object} v
* @return {Boolean}
*/
Types.isObj = function(v){
var isO = false;
if(typeof v === 'string'){
if(window[v] && typeof window[v] === 'object'){
isO = true;
}
} else {
if(v && typeof v === 'object'){
isO = true;
}
}
return isO;
};
/**
* Checks if passed parameter is a function
* @param {Function} fn
* @return {Boolean}
*/
Types.isFn = function(fn){
return (fn && fn.constructor == Function);
};
/**
* Checks if passed param is an array
* @param {Array} obj
* @return {Boolean}
*/
Types.isArray = function(obj){
return (obj && obj.constructor == Array);
};
/**
* Determines if passed param is undefined
* @param {Any} o
* @return {Boolean}
*/
Types.isUndef = function(o){
return o === UNDEFINED;
};
exports.Types = Types;