import { BaseEnumerator } from "./BaseEnumerator";

export class ActionEnumerator extends BaseEnumerator {
	private _action: Function;

	constructor(action: Function) {
		super();
		this._action = action;
	}

	next(value?: any): IteratorResult<any> {
		if (this._action) {
			this._action();
		}
		return { done: true, value: undefined };
	}
}
