lib/bootstrap.js
function saveWithInstances(dbPath, list, save) {
  const promises = [];

  // load item defaults
  _.each(list, function (item, itemName) {
    let obj = _.omit(item, 'instances');

    if (_.isObject(item)) {
      obj = _.omit(item, 'instances');

      if (_.size(obj) > 0) {
        promises.push(save(dbPath + itemName, obj));
      }

      if (item && item.instances) {
        // load instances
        _.each(item.instances, function (instance, instanceId) {
          if (_.size(instance) > 0) {
            promises.push(save(dbPath + itemName + '/instances/' + instanceId, instance));
          }
        });
      }
    }
  });

  return bluebird.all(promises);
}
function saveWithInstances(dbPath, list, save) {
  const promises = [];

  // load item defaults
  _.each(list, function (item, itemName) {
    let obj = _.omit(item, 'instances');

    if (_.isObject(item)) {
      obj = _.omit(item, 'instances');

      if (_.size(obj) > 0) {
        promises.push(save(dbPath + itemName, obj));
      }

      if (item && item.instances) {
        // load instances
        _.each(item.instances, function (instance, instanceId) {
          if (_.size(instance) > 0) {
            promises.push(save(dbPath + itemName + '/instances/' + instanceId, instance));
          }
        });
      }
    }
  });

  return bluebird.all(promises);
}
function saveWithInstances ( dbPath , list , save ) { const promises = [ ] ; // load item defaults _ . each ( list , function ( item , itemName ) { let obj = _ . omit ( item , 'instances' ) ; if ( _ . isObject ( item ) ) { obj = _ . omit ( item , 'instances' ) ; if ( _ . size ( obj ) > 0 ) { promises . push ( save ( dbPath + itemName , obj ) ) ; } if ( item && item . instances ) { // load instances _ . each ( item . instances , function ( instance , instanceId ) { if ( _ . size ( instance ) > 0 ) { promises . push ( save ( dbPath + itemName + '/instances/' + instanceId , instance ) ) ; } } ) ; } } } ) ; return bluebird . all ( promises ) ; }
Component specific loading.
@param {string} dbPath
@param {object} list
@param {function} save
@returns {Promise}
Component specific loading .