2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-15 11:59:37 +03:00
Files
bbob/packages/bbob-parser/src/NodeList.ts
T
Nikolay Kost 29f909a589 fix(296): parse with lost repeated closing tag (#297)
* fix: extract node list ot separate file, fix nested parsing

* chore:  node list tests

* fix: nested tags parsing

* chore: changeset

* chore: remove unused files

* chore: disable publish on every commit
2025-10-14 04:11:19 +02:00

37 lines
470 B
TypeScript

class NodeList<Value> {
private readonly n: Value[];
constructor() {
this.n = [];
}
last() {
const len = this.n.length
if (len > 0) {
return this.n[len - 1];
}
return undefined;
}
has() {
return this.n.length > 0;
}
flush() {
return this.n.length ? this.n.pop() : undefined;
}
push(value: Value) {
this.n.push(value);
}
ref() {
return this.n;
}
}
export { NodeList };
export default NodeList;