Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function applyTimings(fn: any, settings: any): any {
if (settings) {
if (fn.length === 1) {
return core.wrap(function(done) {
if (settings.retries !== undefined) { this.retries(settings.retries); }
if (settings.slow !== undefined) { this.slow(settings.slow); }
if (settings.timeout !== undefined) { this.timeout(settings.timeout); }
return fn.call(this, done);
}, fn);
} else {
return core.wrap(function() {
if (settings.retries !== undefined) { this.retries(settings.retries); }
if (settings.slow !== undefined) { this.slow(settings.slow); }
if (settings.timeout !== undefined) { this.timeout(settings.timeout); }
return fn.call(this);
}, fn);
}
} else {
return fn;
}
}