How to use the treeify.asLines function in treeify

To help you get started, we’ve selected a few treeify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / treeify / treeify-tests.ts View on Github external
import * as treeify from 'treeify';

function log(s: string): void {}

treeify.asTree(
    {
        apples: 'gala', //      ├─ apples: gala
        oranges: 'mandarin' //  └─ oranges: mandarin
    },
    true,
    true
);

treeify.asLines(
    {
        apples: 'gala', //                       ├─ apples: gala
        oranges: 'mandarin', //                  ├─ oranges: mandarin
        grapes: {  //                            └─ grapes
            seedless: 'Thompson, Selma Pete', //     ├─ seedless: Thompson, Selma Pete
            seeded: 'concord' //                     └─ seeded: Concord
        }
    },
    true,
    log
);

treeify.asLines(
    {
        apples: 'gala', //      ├─ apples: gala
        oranges: 'mandarin' //  └─ oranges: mandarin
github node-opcua / node-opcua / packages / node-opcua-samples / bin / simple_client.js View on Github external
crawler.read(nodeId, function (err, obj) {
                console.log(" Time         = ", (new Date()).getTime() - t);
                console.log(" read        = ", crawler.readCounter);
                console.log(" browse      = ", crawler.browseCounter);
                console.log(" transaction = ", crawler.transactionCounter);
                if (!err) {

                    if (false) {
                        // todo : treeify.asTree performance is *very* slow on large object, replace with better implementation
                        //xx console.log(treeify.asTree(obj, true));
                        treeify.asLines(obj, true, true, function (line) {
                            console.log(line);
                        });
                    } else {
                        process.exit(1);
                    }
                }
                client.removeListener("receive_response", print_stat);
                callback(err);
            });
github node-opcua / node-opcua / packages / node-opcua-samples / bin / simple_client.js View on Github external
crawler.read(nodeId, function (err, obj) {
                console.log(" Time         = ", (new Date()).getTime() - t);
                console.log(" read        = ", crawler.readCounter);
                console.log(" browse      = ", crawler.browseCounter);
                console.log(" transaction = ", crawler.transactionCounter);
                if (!err) {

                    if (false) {
                        // todo : treeify.asTree performance is *very* slow on large object, replace with better implementation
                        //xx console.log(treeify.asTree(obj, true));
                        treeify.asLines(obj, true, true, function (line) {
                            console.log(line);
                        });
                    } else {
                      //  process.exit(1);
                    }
                }
                client.removeListener("receive_response", print_stat);
                crawler.dispose();
                callback(err);
            });
github node-opcua / node-opcua / packages / node-opcua-samples / bin / simple_client_ts.ts View on Github external
// xx     console.log("->",(new Date()).getTime()-t,element.browseName.name,element.nodeId.toString());
        // xx });

        const nodeId = "ObjectsFolder";
        console.log("now crawling object folder ...please wait...");

        const obj = await crawler.read(nodeId);
        console.log(" Time        = ", (new Date()).getTime() - t5);
        console.log(" read        = ", crawler.readCounter);
        console.log(" browse      = ", crawler.browseCounter);
        console.log(" browseNext  = ", crawler.browseNextCounter);
        console.log(" transaction = ", crawler.transactionCounter);
        if (false) {
            // todo : treeify.asTree performance is *very* slow on large object, replace with better implementation
            // xx console.log(treeify.asTree(obj, true));
            treeify.asLines(obj, true, true, (line: string) => {
                console.log(line);
            });
        }
        crawler.dispose();
    }
    client.removeListener("receive_response", print_stat);

    // -----------------------------------------------------------------------------------------------------------------
    // enumerate all Condition Types exposed by the server
    // -----------------------------------------------------------------------------------------------------------------

    console.log("--------------------------------------------------------------- Enumerate all Condition Types exposed by the server");
    const conditionTree = await enumerateAllConditionTypes(the_session);
    console.log(treeify.asTree(conditionTree));
    console.log(" -----------------------------------------------------------------------------------------------------------------");
github node-opcua / node-opcua / test / end_to_end / u_test_e2e_client_node_crawler.js View on Github external
crawler.read(nodeId, function (err, obj) {
                        if (!err) {
                            treeify.asLines(obj, true, true, function (line) {
                                console.log(line);
                            });
                        }
                        callback(err);
                    });

treeify

converts a JS object into a nice and readable tree structure for the console

MIT
Latest version published 6 years ago

Package Health Score

55 / 100
Full package analysis

Popular treeify functions