UNPKG

@throw-out-error/minecraft-mcfunction

Version:

A simple way to create your mcfunction files using Typescript syntax.

36 lines 1.26 kB
"use strict"; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var _stack; Object.defineProperty(exports, "__esModule", { value: true }); const scope_1 = __importDefault(require("./scope")); class Stack { constructor() { _stack.set(this, []); } push(scope) { __classPrivateFieldGet(this, _stack).unshift(scope !== null && scope !== void 0 ? scope : new scope_1.default()); } pop() { if (__classPrivateFieldGet(this, _stack).length < 1) { throw Error('Empty stack'); } return __classPrivateFieldGet(this, _stack).shift(); } peek() { if (__classPrivateFieldGet(this, _stack).length < 1) { throw Error('Empty stack'); } return __classPrivateFieldGet(this, _stack)[0]; } } exports.default = Stack; _stack = new WeakMap(); //# sourceMappingURL=stack.js.map