"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/lib/tree.js" (7 Feb 2017, 1004 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 (function() {
    2   var _;
    3 
    4   _ = require('underscore-plus');
    5 
    6   module.exports = function(items, options, callback) {
    7     var emptyMessage, i, index, item, itemLine, len, ref, results;
    8     if (options == null) {
    9       options = {};
   10     }
   11     if (_.isFunction(options)) {
   12       callback = options;
   13       options = {};
   14     }
   15     if (callback == null) {
   16       callback = function(item) {
   17         return item;
   18       };
   19     }
   20     if (items.length === 0) {
   21       emptyMessage = (ref = options.emptyMessage) != null ? ref : '(empty)';
   22       return console.log("\u2514\u2500\u2500 " + emptyMessage);
   23     } else {
   24       results = [];
   25       for (index = i = 0, len = items.length; i < len; index = ++i) {
   26         item = items[index];
   27         if (index === items.length - 1) {
   28           itemLine = '\u2514\u2500\u2500 ';
   29         } else {
   30           itemLine = '\u251C\u2500\u2500 ';
   31         }
   32         results.push(console.log("" + itemLine + (callback(item))));
   33       }
   34       return results;
   35     }
   36   };
   37 
   38 }).call(this);