Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
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));
}
}
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();
}