whole_func_string: function setPackagesState(app, dependencies, cb) {
    var zealPacks = {};
    let promises = [];
  
    _.forEach(dependencies, function(val, key) {
      buildPackagesList(app, zealPacks, val, key, promises);
    });
    /* app.debug('Installed themes: %O', app.locals.themes);
    app.debug('Installed apps: %O', app.locals.apps); */
    Promise.all(promises).then(() => {
      app.emit('zealder packages loaded');
  
      // if callback passed
      if (cb) cb(zealPacks);
    });
  }
func_code_string: function setPackagesState(app, dependencies, cb) {
    var zealPacks = {};
    let promises = [];
  
    _.forEach(dependencies, function(val, key) {
      buildPackagesList(app, zealPacks, val, key, promises);
    });
    /* app.debug('Installed themes: %O', app.locals.themes);
    app.debug('Installed apps: %O', app.locals.apps); */
    Promise.all(promises).then(() => {
      app.emit('zealder packages loaded');
  
      // if callback passed
      if (cb) cb(zealPacks);
    });
  }
func_documentation_string: for saving packages info to state