MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / StringIterator

Class StringIterator

src/back/util/map.ts:14–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14export class StringIterator implements IKeyIterator<string> {
15
16 private _value = '';
17 private _pos = 0;
18
19 reset(key: string): this {
20 this._value = key;
21 this._pos = 0;
22 return this;
23 }
24
25 next(): this {
26 this._pos += 1;
27 return this;
28 }
29
30 hasNext(): boolean {
31 return this._pos < this._value.length - 1;
32 }
33
34 cmp(a: string): number {
35 const aCode = a.charCodeAt(0);
36 const thisCode = this._value.charCodeAt(this._pos);
37 return aCode - thisCode;
38 }
39
40 value(): string {
41 return this._value[this._pos];
42 }
43}
44
45export class PathIterator implements IKeyIterator<string> {
46

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected