How to use the @esfx/internal-guards.isFunction 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 / async-barrier / src / index.ts View on Github external
constructor(participantCount: number, postPhaseAction?: (barrier: AsyncBarrier) => void | PromiseLike) {
        if (!isNumber(participantCount)) throw new TypeError("Number expected: participantCount.");
        if ((participantCount |= 0) < 0) throw new RangeError("Argument out of range: participantCount.");
        if (!isMissing(postPhaseAction) && !isFunction(postPhaseAction)) throw new TypeError("Function expected: postPhaseAction.");

        this._participantCount = participantCount;
        this._remainingParticipants = participantCount;
        this._postPhaseAction = postPhaseAction;
    }
github esfx / esfx / packages / async-canceltoken / src / index.ts View on Github external
subscribe(onSignaled: () => void): CancelSubscription {
        if (!isFunction(onSignaled)) throw new TypeError("Function expected: onSignaled");
        return this._state.subscribe(onSignaled);
    }
github esfx / esfx / packages / reflect-metadata-compat / src / index.ts View on Github external
function isDecorateClassOverload(args: DecorateOverloads): args is readonly [ClassDecorator[], Function] {
        if (args.length >= 2 && Array.isArray(args[0]) && isFunction(args[1]) && (args.length === 2 || !isDefined(args[2])) && (args.length === 3 || !isDefined(args[3]))) return true;
        return false;
    }
github esfx / esfx / packages / lazy / src / index.ts View on Github external
constructor(factory: () => T) {
        if (!isFunction(factory)) throw new TypeError("Function expected: factory");
        this._state = factory === noop
            ? noopFactoryState
            : createFactoryState(factory, /*args*/ undefined);
    }
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();
    }
github esfx / esfx / packages / cancelable / src / index.ts View on Github external
export function create(unsubscribe: () => void): CancelSubscription {
        if (!isFunction(unsubscribe)) throw new TypeError("Function expected: unsubscribe");
        return createCancelSubscription(unsubscribe);
    }
}
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