/* c8 ignore start */
export function isLike(value) {
    return !!value;
}
export function isArray(value) {
    return Array.isArray(value);
}
function isObjectLike(node) {
    return !!node && (typeof node === "object" || typeof node === "function");
}
export function isPromise(input) {
    return isObjectLike(input) && typeof input.then === "function";
}
export function ok(value, message) {
    if (!value) {
        throw new Error(message ?? "Expected value");
    }
}
export function isAsyncIterable(value) {
    return !!(isLike(value) &&
        typeof value[Symbol.asyncIterator] === "function");
}
export function isIterable(value) {
    return !!(isLike(value) &&
        typeof value[Symbol.iterator] === "function");
}
export function isNumberString(value) {
    return ((typeof value === "string" && /^-?\d+(?:\.\d+)?$/.test(value)) ||
        typeof value === "number");
}
export function isTrueString(value) {
    return (value === 1 ||
        value === true ||
        value === "1" ||
        value === "true");
}
export function isFalseString(value) {
    return (value === 0 ||
        value === false ||
        value === "0" ||
        value === "false");
}
export function isSignalled(event) {
    return !!(isLike(event) &&
        event.signal &&
        typeof event.signal.aborted === "boolean");
}
export function isMatchingObjects(a, b) {
    if (a === b)
        return true;
    if (!a || !b)
        return false;
    if (typeof a !== "object" || typeof b !== "object")
        return false;
    const aEntries = Object.entries(a);
    const bMap = new Map(Object.entries(b));
    if (aEntries.length !== bMap.size)
        return false;
    return aEntries.every(([key, value]) => {
        const otherValue = bMap.get(key);
        if (typeof value === "object") {
            return isMatchingObjects(value, otherValue);
        }
        return value === otherValue;
    });
}
//# sourceMappingURL=is.js.map