import { _ as _type_of } from "@swc/helpers/_/_type_of";
export var isObject = function(val) {
    return val !== null && (typeof val === "undefined" ? "undefined" : _type_of(val)) === 'object';
};
// eslint-disable-next-line @typescript-eslint/ban-types
export var isFunction = function(val) {
    return typeof val === 'function';
};
export var isPromise = function(val) {
    return isObject(val) && isFunction(val.then) && isFunction(val.catch);
};
export var upperCaseFirst = function(str) {
    str = str.toLowerCase();
    str = str.replace(/\b\w+\b/g, function(word) {
        return word.substring(0, 1).toUpperCase() + word.substring(1);
    });
    return str;
};
export var clamp = function(num, min, max) {
    return Math.min(Math.max(num, min), max);
};
export function preventDefault(event, isStopPropagation) {
    if (typeof event.cancelable !== 'boolean' || event.cancelable) {
        event.preventDefault();
    }
    if (isStopPropagation) {
        event.stopPropagation();
    }
}
