UNPKG

ember-source

Version:

A JavaScript framework for creating ambitious web applications

56 lines (52 loc) 1.16 kB
import './debug-to-string-CFb7h0lY.js'; import { g as getLast } from './present-B1rrjAVM.js'; function unwrap(val) { return val; } function expect(val, message) { return val; } function exhausted(value) { } function dict() { return Object.create(null); } function isDict(u) { return u !== null && u !== undefined; } function isIndexable(u) { return typeof u === 'function' || typeof u === 'object' && u !== null; } class StackImpl { stack; current = null; constructor(values = []) { this.stack = values; } get size() { return this.stack.length; } push(item) { this.current = item; this.stack.push(item); } pop() { let item = this.stack.pop(); this.current = getLast(this.stack) ?? null; return item === undefined ? null : item; } nth(from) { let len = this.stack.length; return len < from ? null : unwrap(this.stack[len - from]); } isEmpty() { return this.stack.length === 0; } snapshot() { return [...this.stack]; } toArray() { return this.stack; } } export { StackImpl as S, isIndexable as a, exhausted as b, dict as d, expect as e, isDict as i, unwrap as u };