{"size": 1071, "ext": "js", "max_stars_repo_path": "heroku/node_modules/cli-ux/lib/styled/tree.js", "max_stars_repo_name": "brandtjl/sample_app", "max_stars_repo_stars_event_min_datetime": "2020-01-12T23:57:22.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T16:35:17.000Z", "max_issues_repo_path": "heroku/node_modules/cli-ux/lib/styled/tree.js", "max_issues_repo_name": "brandtjl/sample_app", "max_issues_repo_issues_event_min_datetime": "2020-01-13T00:45:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-20T04:10:05.000Z", "max_forks_repo_path": "heroku/node_modules/cli-ux/lib/styled/tree.js", "max_forks_repo_name": "brandtjl/sample_app", "max_forks_repo_forks_event_min_datetime": "2020-01-21T21:12:03.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-24T01:15:50.000Z"}
{"max_stars_count": 19, "max_issues_count": 59, "max_forks_count": 7, "avg_line_length": 25.5, "max_line_length": 62, "alphanum_fraction": 0.4883286648}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const treeify = require('treeify');
class Tree {
    constructor() {
        this.nodes = {};
    }
    insert(child, value = new Tree()) {
        this.nodes[child] = value;
        return this;
    }
    search(key) {
        for (let child of Object.keys(this.nodes)) {
            if (child === key) {
                return this.nodes[child];
            }
            else {
                let c = this.nodes[child].search(key);
                if (c)
                    return c;
            }
        }
    }
    // tslint:disable-next-line:no-console
    display(logger = console.log) {
        const addNodes = function (nodes) {
            let tree = {};
            for (let p of Object.keys(nodes)) {
                tree[p] = addNodes(nodes[p].nodes);
            }
            return tree;
        };
        let tree = addNodes(this.nodes);
        logger(treeify.asTree(tree));
    }
}
exports.Tree = Tree;
function tree() {
    return new Tree();
}
exports.default = tree;
