mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
29f909a589
* 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
37 lines
470 B
TypeScript
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;
|