UNPKG

curl-amd

Version:

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.

26 lines (19 loc) 523 B
define(function () { function MethodSpy (method, context) { var count, orig; count = 0; orig = context[method]; context[method] = function () { count++; return orig.apply(context, arguments); }; return { calledNever: function () { return count == 0; }, calledOnce: function () { return count == 1; }, calledTwice: function () { return count == 2; }, calledMany: function (howMany) { return count == howMany; }, callCount: function () { return count; } }; } return MethodSpy; });