@bookbox/core
Version:
Bookbox — e-book format
21 lines (20 loc) • 522 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.flatList = void 0;
function flatList(elems) {
const stack = [elems];
const result = [];
while (stack.length) {
const current = stack.pop();
if (Array.isArray(current)) {
for (let i = current.length - 1; i >= 0; i--) {
stack.push(current[i]);
}
}
else {
result.push(current);
}
}
return result;
}
exports.flatList = flatList;