Skip to content

Commit a5d6104

Browse files
committed
feat(mquery): remove function "Query.prototype.thunk"
1 parent bb17c96 commit a5d6104

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

lib/mquery.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2635,23 +2635,6 @@ Query.prototype.exec = async function exec(op) {
26352635
return this['_' + this.op]();
26362636
};
26372637

2638-
/**
2639-
* Returns a thunk which when called runs this.exec()
2640-
*
2641-
* The thunk receives a callback function which will be
2642-
* passed to `this.exec()`
2643-
*
2644-
* @return {Function}
2645-
* @api public
2646-
*/
2647-
2648-
Query.prototype.thunk = function() {
2649-
const _this = this;
2650-
return function(cb) {
2651-
_this.exec(cb);
2652-
};
2653-
};
2654-
26552638
/**
26562639
* Executes the query returning a `Promise` which will be
26572640
* resolved with either the doc(s) or rejected with the error.

test/index.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,26 +2774,6 @@ describe('mquery', function() {
27742774
});
27752775
});
27762776

2777-
describe('thunk', function() {
2778-
it('returns a function', function(done) {
2779-
assert.equal('function', typeof mquery().thunk());
2780-
done();
2781-
});
2782-
2783-
it('passes the fn arg to `exec`', function(done) {
2784-
function cb() {}
2785-
const m = mquery();
2786-
2787-
m.exec = function testing(fn) {
2788-
assert.equal(this, m);
2789-
assert.equal(cb, fn);
2790-
done();
2791-
};
2792-
2793-
m.thunk()(cb);
2794-
});
2795-
});
2796-
27972777
describe('then', function() {
27982778
before(function(done) {
27992779
col.insertMany([{ name: 'then', age: 1 }, { name: 'then', age: 2 }], done);

0 commit comments

Comments
 (0)