UNPKG

skutter

Version:

Skutter: Opinionated BDD Browser based test framework

31 lines (30 loc) 666 B
"use strict"; class Stack { constructor() { this._stack = []; } get topItem() { if (this._stack.length === 0) { return undefined; } return this._stack[this._stack.length - 1]; } get length() { return this._stack.length; } reset() { this._stack = []; } push(item) { if (!item) { throw new Error("[Stack].[push] Attempting to push a null object onto the inspection stack!"); } this._stack.push(item); } pop() { if (this._stack.length > 0) { return this._stack.pop(); } } } exports.Stack = Stack;