Commit 591284ab authored by nanahira's avatar nanahira

new

parent 5abeb30d
export * from './src/workflow'; export * from './src/workflow';
export * from './src/dual-object'; export * from './src/dual-object';
export * from './src/workflow-dispatcher'; export * from './src/workflow-dispatcher';
export * from './src/round-robin';
export class RoundRobin<T> {
private index = 0;
constructor(public items: T[]) {
if (items.length === 0) {
throw new Error('RoundRobin requires at least one item');
}
}
next(): T {
const nextIndex = this.index % this.items.length;
this.index = (this.index + 1) % this.items.length;
return this.items[nextIndex];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment