Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 4x 4x 4x 4x 68x 53x 2x 13x 19x 9x 110x | export enum TaskStatusType {
TODO = 'TODO',
IN_PROGRESS = 'IN_PROGRESS',
DONE = 'DONE'
}
export class TaskStatus {
private constructor(private readonly value: TaskStatusType) {}
static todo(): TaskStatus {
return new TaskStatus(TaskStatusType.TODO);
}
static inProgress(): TaskStatus {
return new TaskStatus(TaskStatusType.IN_PROGRESS);
}
static done(): TaskStatus {
return new TaskStatus(TaskStatusType.DONE);
}
static fromString(status: string): TaskStatus {
const statusType = TaskStatusType[status as keyof typeof TaskStatusType];
if (!statusType) {
throw new Error(`Invalid task status: ${status}`);
}
return new TaskStatus(statusType);
}
toString(): string {
return this.value;
}
isTodo(): boolean {
return this.value === TaskStatusType.TODO;
}
isDone(): boolean {
return this.value === TaskStatusType.DONE;
}
equals(other: TaskStatus): boolean {
return this.value === other.value;
}
}
|