MCPcopy Index your code
hub / github.com/deployd/deployd / before

Function before

test-app/public/sinon.js:20669–20684  ·  view source on GitHub ↗

* Creates a function that invokes `func`, with the `this` binding and arguments * of the created function, while it's called less than `n` times. Subsequent * calls to the created function return the result of the last `func` invocation. * * @static * @me

(n, func)

Source from the content-addressed store, hash-verified

20667 * // => Allows adding up to 4 contacts to the list.
20668 */
20669 function before(n, func) {
20670 var result;
20671 if (typeof func != 'function') {
20672 throw new TypeError(FUNC_ERROR_TEXT);
20673 }
20674 n = toInteger(n);
20675 return function() {
20676 if (--n > 0) {
20677 result = func.apply(this, arguments);
20678 }
20679 if (n <= 1) {
20680 func = undefined;
20681 }
20682 return result;
20683 };
20684 }
20685
20686 /**
20687 * Creates a function that invokes `func` with the `this` binding of `thisArg`

Callers 5

keys.unit.jsFile · 0.85
db-remote.unit.jsFile · 0.85
support.jsFile · 0.85
onceFunction · 0.85
collection.test.jsFile · 0.85

Calls 1

toIntegerFunction · 0.85

Tested by

no test coverage detected