lib/models/users.js
function findByUsername(username, cb) {
  db.getClient(function(err, client, done) {
    client.query(SELECT_USERNAME, [username], function(err, r) {
      var result = r && r.rows[0];
      if(!err && !result) { err = new exceptions.NotFound(); }
      if(err) {
        cb(err);
        done(err);
      } else {
        cb(null, result);
        done();
      }
    });
  });
}
function findByUsername(username, cb) {
  db.getClient(function(err, client, done) {
    client.query(SELECT_USERNAME, [username], function(err, r) {
      var result = r && r.rows[0];
      if(!err && !result) { err = new exceptions.NotFound(); }
      if(err) {
        cb(err);
        done(err);
      } else {
        cb(null, result);
        done();
      }
    });
  });
}
function findByUsername ( username , cb ) { db . getClient ( function ( err , client , done ) { client . query ( SELECT_USERNAME , [ username ] , function ( err , r ) { var result = r && r . rows [ 0 ] ; if ( ! err && ! result ) { err = new exceptions . NotFound ( ) ; } if ( err ) { cb ( err ) ; done ( err ) ; } else { cb ( null , result ) ; done ( ) ; } } ) ; } ) ; }
Finds a user  by `username`

`cb` is passed with the matching user or exceptions.NotFound

@param {String} username
@param {Function} cb
Finds a user by username