This file contains 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
/** | |
* Merge defaults with user options | |
* @private | |
* @param {Object} defaults Default settings | |
* @param {Object} options User options | |
* @returns {Object} Merged values of defaults and options | |
*/ | |
var extend = function ( defaults, options ) { | |
var extended = {}; | |
var prop; |
This file contains 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
// Ví dụ về callback truyền thống, nỗi kinh hoàng của developer. | |
// link ref: https://anonystick.com/blog-developer/series-callback-javascript-phan-3-async-await-la-gi-va-su-khac-nhau-giua-promise-trong-javascript-vRwGny6a.jsx | |
const verifyUser = function(username, password, callback){ | |
dataBase.verifyUser(username, password, (error, userInfo) => { | |
if (error) { | |
callback(error) | |
}else{ | |
dataBase.getRoles(username, (error, roles) => { | |
if (error){ | |
callback(error) |