Created
June 5, 2021 01:32
-
-
Save mosufy/f77f0533610cd11ca0f9b23307872a3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import db from 'db'; | |
export const checkUsernameExists = username => { | |
const user = db.select('id') | |
->from('users') | |
->where('username', username) | |
->first(); | |
return Object.keys(user).length > 0; | |
// returns boolean true | false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment