Skip to content

Instantly share code, notes, and snippets.

@wharley
Created May 25, 2017 11:53
Show Gist options
  • Save wharley/7bcbb25adce357b23b28fc60420d2699 to your computer and use it in GitHub Desktop.
Save wharley/7bcbb25adce357b23b28fc60420d2699 to your computer and use it in GitHub Desktop.
const models = require('../../loading/loading');
const Promise = require('bluebird');
module.exports = Promise.method(function userExists(userAttributes) {
return models.User
.findOne({
where: {
email: userAttributes.email
}
}).then((user) => {
if (!user) return false;
return user;
}).catch((error) => {
console.log(error);
throw error;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment