react-native-netclient
Version:
A network library which provides the most fastest & efficient way to handle the HTTP request and response. It acts like a rest client and supports on both ios & android. It uses the core fetch react native API. This library follows the oops standard for a
29 lines (21 loc) • 684 B
JavaScript
export default class TypeCheck{
static isObject(obj) {
return (Object.prototype.toString.call(obj) === '[object Object]');
}
static isArray(arr) {
return (Object.prototype.toString.call(arr) === '[object Array]');
}
static isString(str) {
return (Object.prototype.toString.call(str) === '[object String]');
}
static isEmpty(value) {
return (value === undefined || value === null || value.trim() === '');
}
static isEmptyObject(value) {
return (value === undefined || value === null);
}
static isValidUrl(url) {
let regx = /^(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}/;
return regx.test(url)
}
}