@nebulaglitch/shopbot
Version:
A library to generate shopbot output
29 lines (26 loc) • 889 B
JavaScript
import Code from './code.js';
import Command from './command.js';
import Label from './label.js';
import Variable from './variable.js';
class ShopbotPrinter {
static print(arr, sb = '') {
arr.forEach((current)=>{
if (current instanceof Code) {
sb += current.toString();
} else if (current instanceof Command) {
sb += current.toString();
} else if (current instanceof Label) {
sb += current.toString();
} else if (current instanceof Variable) {
sb += current.toString();
} else if (current instanceof Array) {
sb += '\n';
sb = ShopbotPrinter.print(current, sb);
}
sb += '\n';
});
return sb;
}
}
export { ShopbotPrinter as default };
//# sourceMappingURL=shopbotprinter.js.map