unmemoize.js 681 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = unmemoize;
  6. /**
  7. * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,
  8. * unmemoized form. Handy for testing.
  9. *
  10. * @name unmemoize
  11. * @static
  12. * @memberOf module:Utils
  13. * @method
  14. * @see [async.memoize]{@link module:Utils.memoize}
  15. * @category Util
  16. * @param {AsyncFunction} fn - the memoized function
  17. * @returns {AsyncFunction} a function that calls the original unmemoized function
  18. */
  19. function unmemoize(fn) {
  20. return function () {
  21. return (fn.unmemoized || fn).apply(null, arguments);
  22. };
  23. }
  24. module.exports = exports["default"];