Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
subscribe(onSignaled: () => void): CancelSubscription {
if (!isFunction(onSignaled)) throw new TypeError("Function expected: onSignaled");
return this._state.subscribe(onSignaled);
}
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;
}
constructor(factory: () => T) {
if (!isFunction(factory)) throw new TypeError("Function expected: factory");
this._state = factory === noop
? noopFactoryState
: createFactoryState(factory, /*args*/ undefined);
}
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;
}
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();
}
export function create(unsubscribe: () => void): CancelSubscription {
if (!isFunction(unsubscribe)) throw new TypeError("Function expected: unsubscribe");
return createCancelSubscription(unsubscribe);
}
}
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();
}