Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wrapThunk.js 526B

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