support nested arrow functions - fixes #60

This commit is contained in:
Sebastian McKenzie
2014-10-14 08:07:03 +11:00
parent b377278c2c
commit a9d101e3da
3 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
module.exports = {
init() {
return new Promise((resolve, reject) => {
MongoClient.connect(config.mongodb, (err, db) => {
if (err) {
return reject(err);
}
this.db = db;
resolve(this);
});
});
}
};

View File

@@ -0,0 +1,14 @@
module.exports = {
init: function() {
var _this = this;
return new Promise(function(resolve, reject) {
MongoClient.connect(config.mongodb, function(err, db) {
if (err) {
return reject(err);
}
_this.db = db;
resolve(_this);
});
});
}
};