Created
January 19, 2018 00:38
-
-
Save KoryNunn/09c661d60ad2674de2ae834279e77660 to your computer and use it in GitHub Desktop.
https://www.toptal.com/javascript/asynchronous-javascript-async-await-tutorial but using normal callbacks, that don't catch exceptions, and implicitly handle rejections, using righto, also faster, and optimisable, because it doesn't use try/catch
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
const verifyUser = function(username, password, callback){ | |
const userInfo = righto(dataBase.verifyUser, username, password); | |
const rolesInfo = righto(dataBase.getRoles, userInfo); | |
const logStatus = righto(dataBase.logAccess, userInfo, righto.after(rolesInfo)); | |
const result = righto.mate(userInfo, righto.after(logStatus)); | |
result(callback); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment