Skip to content

Instantly share code, notes, and snippets.

@reggi
Created April 21, 2020 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reggi/6d26da43aea51532d95b12060494cdcd to your computer and use it in GitHub Desktop.
Save reggi/6d26da43aea51532d95b12060494cdcd to your computer and use it in GitHub Desktop.
class MongoOptions () {
static parse () {
// does all the parsing without async eg DNS checking operations
}
static performAsync () {
// follow up handler to check eg DNS (async) tasks
}
static parseAsync () {
// does parsing with
}
}
class MongoClient () {
constructor (uri, options = defaultOptions) {
this.parsedOptions = MongoOptions.parse()
}
connection (uri, options = defaultOptions, callback) {
MongoOptions.parseAsync(uri, options, (parsedOptions) => {
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment