UNPKG

526 BJavaScriptView Raw
1'use strict';
2
3/*!
4 * A query thunk is the function responsible for sending the query to MongoDB,
5 * like `Query#_findOne()` or `Query#_execUpdate()`. The `Query#exec()` function
6 * calls a thunk. The term "thunk" here is the traditional Node.js definition:
7 * a function that takes exactly 1 parameter, a callback.
8 *
9 * This function defines common behavior for all query thunks.
10 */
11
12module.exports = function wrapThunk(fn) {
13 return function _wrappedThunk(cb) {
14 ++this._executionCount;
15
16 fn.call(this, cb);
17 };
18};
\No newline at end of file