UNPKG

html-tokenizer

Version:

Small, fast, event-driven, fault-tolerant html tokenizer. Works in node or browsers.

31 lines 650 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Mutable FILO stack object. */ class Stack { constructor() { this.items = []; } push(t) { this.items.push(t); } pop() { return this.items.pop(); } peek(n = 0) { const idx = this.items.length + -1 + -n; return this.items[idx]; } size() { return this.items.length; } *drain() { for (let i = this.items.length; i > 0; i--) { yield this.items[i - 1]; } this.items.length = 0; } } exports.default = Stack; //# sourceMappingURL=stack.js.map