class Utils {
    static isFunction(obj) {
        return typeof obj === 'function';
    }

    static isEqual(obj1, obj2) {
        return JSON.stringify(obj1) === JSON.stringify(obj2);
    }

    static debounce(func, wait) {
        let timeout;
        return function executedFunction(...args) {
            const later = () => {
                clearTimeout(timeout);
                func(...args);
            };
            clearTimeout(timeout);
            timeout = setTimeout(later, wait);
        };
    }

    static isEmpty(obj) {
        if (obj == null) return true;
        if (Array.isArray(obj) || typeof obj === 'string') return obj.length === 0;
        return Object.keys(obj).length === 0;
    }

    static isValidNumber (num) {
        return typeof num === 'number' && !isNaN(num);
    }

    static isString(val) {
        return typeof val === 'string';
    }
}

export default Utils;
