1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-06-28 10:20:17 +02:00
TableFilter/src/types.js

60 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-10-12 13:40:08 +02:00
/**
* Types utilities
*/
2014-10-26 11:48:13 +01:00
define(function () {
2014-10-12 13:40:08 +02:00
'use strict';
2014-10-26 11:48:13 +01:00
var Types = {};
2014-10-12 13:40:08 +02:00
var UNDEFINED = void 0;
2014-10-12 13:40:08 +02:00
/**
* Checks if var exists and is an object
* @param {String or Object} v
* @return {Boolean}
*/
2014-10-26 11:48:13 +01:00
Types.isObj = function(v){
2014-10-12 13:40:08 +02:00
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}
*/
2014-10-26 11:48:13 +01:00
Types.isFn = function(fn){
2014-10-12 13:40:08 +02:00
return (fn && fn.constructor == Function);
};
/**
* Checks if passed param is an array
* @param {Array} obj
* @return {Boolean}
*/
2014-10-26 11:48:13 +01:00
Types.isArray = function(obj){
2014-10-12 13:40:08 +02:00
return (obj && obj.constructor == Array);
};
/**
* Determines if passed param is undefined
* @param {Any} o
* @return {Boolean}
*/
Types.isUndef = function(o){
return o === UNDEFINED;
};
2014-10-26 11:48:13 +01:00
return Types;
});