src/lib/db.js
function getModels(done) {
  if (models) {
    return done(models);
  }

  return orm.initialize(ormConfig, function(err, m) {
    if (err) {
      throw err;
    }

    // make the models available as soon as possible for other functions
    models = m;

    // ignore error if groups already created
    let catcher = (createErr) => { if (createErr && createErr.code !== "E_VALIDATION") { throw createErr; } };

    // create the administrators group
    createGroup("admin", catcher);

    // create the public group
    createGroup("public", catcher);

    return done(models);
  });
}
function getModels(done) {
  if (models) {
    return done(models);
  }

  return orm.initialize(ormConfig, function(err, m) {
    if (err) {
      throw err;
    }

    // make the models available as soon as possible for other functions
    models = m;

    // ignore error if groups already created
    let catcher = (createErr) => { if (createErr && createErr.code !== "E_VALIDATION") { throw createErr; } };

    // create the administrators group
    createGroup("admin", catcher);

    // create the public group
    createGroup("public", catcher);

    return done(models);
  });
}
function getModels ( done ) { if ( models ) { return done ( models ) ; } return orm . initialize ( ormConfig , function ( err , m ) { if ( err ) { throw err ; } // make the models available as soon as possible for other functions models = m ; // ignore error if groups already created let catcher = ( createErr ) => { if ( createErr && createErr . code !== "E_VALIDATION" ) { throw createErr ; } } ; // create the administrators group createGroup ( "admin" , catcher ) ; // create the public group createGroup ( "public" , catcher ) ; return done ( models ) ; } ) ; }
return models. It initializes Waterfall if not yet initialized in
this process.

@param {Function} done - done(models)
return models . It initializes Waterfall if not yet initialized in this process .