How to use the @esfx/internal-guards.isDefined function in @esfx/internal-guards

To help you get started, we’ve selected a few @esfx/internal-guards examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github esfx / esfx / packages / reflect-metadata-compat / src / index.ts View on Github external
function isObjectOverload(args: Overloads): args is readonly [object] {
    if (args.length >= 1 && isObject(args[0]) && (args.length === 1 || !isDefined(args[1]))) return true;
    return false;
}
github esfx / esfx / packages / threading-lockable / src / index.ts View on Github external
export function hasInstance(value: unknown): value is Lockable {
        return isObject(value)
            && Lockable.lock in value
            && Lockable.unlock in value
            && (!(Lockable.tryLock in value) || !isDefined(Lockable.tryLock) || isFunction(Lockable.tryLock));
    }
}
github esfx / esfx / packages / reflect-metadata-compat / src / index.ts View on Github external
function decorateClass(decorators: ClassDecorator[], target: Function): Function {
        for (let i = decorators.length - 1; i >= 0; i--) {
            const decorator = decorators[i];
            const decorated = decorator(target);
            if (isDefined(decorated)) {
                if (!isFunction(decorated)) throw new TypeError();
                target = decorated;
            }
        }
        return target;
    }
github esfx / esfx / packages / ref / src / index.ts View on Github external
export function out(get?: () => T, set?: (value: T) => void) {
        if (isDefined(get) || isDefined(set)) {
            if (!isFunction(get)) throw new TypeError("Function expected: get");
            if (!isFunction(set)) throw new TypeError("Function expected: set");
            return outForGetSet(get, set);
        }
        return outForValue();
    }

@esfx/internal-guards

This package provides internal utilities for @esfx and is not intended for use in user-code.

Apache-2.0
Latest version published 2 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages