Created
November 17, 2020 06:57
-
-
Save Yamo93/9c15e972ef04751afd0191482b59ba17 to your computer and use it in GitHub Desktop.
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
function initializeDatabase(database) { | |
if (typeof database.init !== 'function') { | |
throw 'Engine has no init method'; | |
} | |
database.init(); | |
} | |
const mySqlEngine = { | |
type: 'mysql', | |
init: function () { | |
// ... | |
} | |
}; | |
const postgresEngine = { | |
type: 'postgres', | |
init: function () { | |
// ... | |
} | |
}; | |
initializeDatabase(mySqlEngine); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment