datapilot-cli
Version:
Enterprise-grade streaming multi-format data analysis with comprehensive statistical insights and intelligent relationship detection - supports CSV, JSON, Excel, TSV, Parquet - memory-efficient, cross-platform
25 lines (20 loc) • 426 B
JavaScript
class TypedStack {
constructor(type) {
this._type = type;
this._stack = [];
}
get size() {
return this._stack.length;
}
pop() {
const tos = this._stack.pop();
return tos || new this._type();
}
push(instance) {
if (!(instance instanceof this._type)) {
throw new Error('Invalid type pushed to TypedStack');
}
this._stack.push(instance);
}
}
module.exports = TypedStack;