Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.printTree = void 0;
const printTree = (tab = '', children) => {
let str = '';
let last = children.length - 1;
for (; last >= 0; last--)
if (children[last])
break;
for (let i = 0; i <= last; i++) {
const fn = children[i];
if (!fn)
continue;
const isLast = i === last;
const child = fn(tab + (isLast ? ' ' : '│') + ' ');
const branch = child ? (isLast ? '└─' : '├─') : '│';
str += '\n' + tab + branch + (child ? ' ' + child : '');
}
return str;
};
exports.printTree = printTree;