Skip to content

Instantly share code, notes, and snippets.

@mosufy
Created June 5, 2021 01:42
Show Gist options
  • Save mosufy/29ae9b8ccbe52ad82e124f61830502b7 to your computer and use it in GitHub Desktop.
Save mosufy/29ae9b8ccbe52ad82e124f61830502b7 to your computer and use it in GitHub Desktop.
export const createNewAccount = async (params) => {
if (!validateCreateNewAccountParameters(params))
throw new Error('Validation error');
if (await checkUsernameExists(params.username))
throw new Error('Username already exists');
if (await checkEmailExists(params.email))
throw new Error('Email already exists');
return insertUser(params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment