Update model and add invalidated cycle

This commit is contained in:
Misode
2020-05-25 14:45:10 +02:00
parent 79a5742dad
commit 56f3766a13
9 changed files with 73 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
type PathElement = (string | number)
export class Path {
export class Path implements Iterable<PathElement> {
private arr: PathElement[]
constructor(arr?: PathElement[]) {
@@ -23,4 +23,14 @@ export class Path {
copy(): Path {
return new Path([...this.arr])
}
toString(): string {
return `[${this.arr.map(e => e.toString()).join(', ')}]`
}
*[Symbol.iterator]() {
for (const e of this.arr) {
yield e
}
}
}