mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 18:03:47 +00:00
feat: automation service
This commit is contained in:
committed by
Carlos Valente
parent
a8fe4c8e68
commit
05e61e7bf8
@@ -21,3 +21,20 @@ export function isObject(value: unknown): asserts value is object {
|
||||
throw new Error(`Unexpected payload type: ${String(value)}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function isArray(value: unknown): asserts value is unknown[] {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error(`Unexpected payload type: ${String(value)}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function hasKeys<T extends object, K extends keyof any>(
|
||||
value: T,
|
||||
keys: K[],
|
||||
): asserts value is T & Record<K, unknown> {
|
||||
for (const key of keys) {
|
||||
if (!(key in value)) {
|
||||
throw new Error(`Key not found: ${String(key)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user