Skip to content

Commit fbd9f92

Browse files
committed
Fixed #31.
1 parent 981b3e7 commit fbd9f92

File tree

6 files changed

+29
-6
lines changed

6 files changed

+29
-6
lines changed

dist/arango.all.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1787,9 +1787,15 @@ module.exports = function promisify(callback) {
17871787
var promise = new Promise(function (resolve, reject) {
17881788
callback = function (err, res) {
17891789
if (err) reject(err);else resolve(res);
1790-
if (cb) cb(err, res);
17911790
};
17921791
});
1792+
if (cb) {
1793+
promise.then(function (result) {
1794+
return cb(null, result);
1795+
}, function (reason) {
1796+
return cb(reason);
1797+
});
1798+
}
17931799
return { callback: callback, promise: promise };
17941800
};
17951801
},{}],11:[function(require,module,exports){

dist/arango.all.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/arango.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1787,9 +1787,15 @@ module.exports = function promisify(callback) {
17871787
var promise = new Promise(function (resolve, reject) {
17881788
callback = function (err, res) {
17891789
if (err) reject(err);else resolve(res);
1790-
if (cb) cb(err, res);
17911790
};
17921791
});
1792+
if (cb) {
1793+
promise.then(function (result) {
1794+
return cb(null, result);
1795+
}, function (reason) {
1796+
return cb(reason);
1797+
});
1798+
}
17931799
return { callback: callback, promise: promise };
17941800
};
17951801
},{}],11:[function(require,module,exports){

dist/arango.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util/promisify.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ module.exports = function promisify(callback) {
77
var promise = new Promise(function (resolve, reject) {
88
callback = function (err, res) {
99
if (err) reject(err);else resolve(res);
10-
if (cb) cb(err, res);
1110
};
1211
});
12+
if (cb) {
13+
promise.then(function (result) {
14+
return cb(null, result);
15+
}, function (reason) {
16+
return cb(reason);
17+
});
18+
}
1319
return { callback: callback, promise: promise };
1420
};

src/util/promisify.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ module.exports = function promisify(callback) {
88
callback = function (err, res) {
99
if (err) reject(err);
1010
else resolve(res);
11-
if (cb) cb(err, res);
1211
};
1312
});
13+
if (cb) {
14+
promise.then(
15+
result => cb(null, result),
16+
reason => cb(reason)
17+
);
18+
}
1419
return {callback, promise};
1520
};

0 commit comments

Comments
 (0)