Skip to content

Instantly share code, notes, and snippets.

@ihfazhillah
Created November 30, 2017 15:21
Show Gist options
  • Save ihfazhillah/2138bcc48c6fe0b5298e86f4ed83f094 to your computer and use it in GitHub Desktop.
Save ihfazhillah/2138bcc48c6fe0b5298e86f4ed83f094 to your computer and use it in GitHub Desktop.
const validator = require("email-validator");
module.exports = function(context, callback) {
/*
* module to check email, context.data.input is a scaphold's CreateUserInput.
* email is must be valid email, using email-validator
*/
const userInput = context.data.input;
if (!validator.validate(userInput.email)) {
callback("not valid email provided", null);
}
callback(null, context.data.input);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment