1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-10 02:16:40 +02:00
TableFilter/src/types.js

63 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-11-16 01:29:07 +01:00
/**
* Types utilities
*/
2015-05-30 14:23:33 +02:00
const UNDEFINED = void 0;
2014-11-16 01:29:07 +01:00
2015-05-30 14:23:33 +02:00
export default {
/**
* Check if argument exists and is an object
2015-05-30 14:23:33 +02:00
* @param {String or Object} v
* @return {Boolean}
*/
isObj(v){
let isO = false;
if(typeof v === 'string'){
if(window[v] && typeof window[v] === 'object'){
isO = true;
}
} else {
if(v && typeof v === 'object'){
isO = true;
}
2014-11-16 01:29:07 +01:00
}
2015-05-30 14:23:33 +02:00
return isO;
},
2014-11-16 01:29:07 +01:00
2015-05-30 14:23:33 +02:00
/**
* Check if argument is a function
2015-05-30 14:23:33 +02:00
* @param {Function} fn
* @return {Boolean}
*/
isFn(fn){
return (fn && fn.constructor == Function);
},
2014-11-16 01:29:07 +01:00
2015-05-30 14:23:33 +02:00
/**
* Check if argument is an array
2015-05-30 14:23:33 +02:00
* @param {Array} obj
* @return {Boolean}
*/
isArray(obj){
return (obj && obj.constructor == Array);
},
2014-11-16 01:29:07 +01:00
2015-05-30 14:23:33 +02:00
/**
* Determine if argument is undefined
2015-05-30 14:23:33 +02:00
* @param {Any} o
* @return {Boolean}
*/
isUndef(o){
return o === UNDEFINED;
},
2014-11-16 01:29:07 +01:00
/**
* Determine if argument is null
* @param {Any} o
* @return {Boolean}
*/
isNull(o){
return o === null;
}
2015-05-30 14:23:33 +02:00
};