templates-mo
Version:
Templates is a scaffolding framework that makes code generation simple, dynamic, and reusable. Generate files, parts of your app, or whole project structures—without the repetitive copy-pasting
34 lines (33 loc) • 796 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stack = void 0;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
class Stack {
constructor() {
this._stack = [];
this._stack = [];
}
push(...args) {
this._stack.push(...args);
}
// remove an item from the top of the stack
pop() {
var _a;
return (_a = this._stack.pop()) !== null && _a !== void 0 ? _a : null;
}
stack() {
return this._stack;
}
next() {
const len = this.size();
if (!len) {
return null;
}
return this._stack[len - 1];
}
// return the number of items in the stack
size() {
return this._stack.length;
}
}
exports.Stack = Stack;