MCPcopy
hub / github.com/amark/gun / callFn

Function callFn

test/mocha.js:4201–4219  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

4199 }
4200
4201 function callFn(fn) {
4202 var result = fn.call(ctx);
4203 if (result && typeof result.then === 'function') {
4204 self.resetTimeout();
4205 result
4206 .then(function() {
4207 done();
4208 },
4209 function(reason) {
4210 done(reason || new Error('Promise rejected with no or falsy reason'));
4211 });
4212 } else {
4213 if (self.asyncOnly) {
4214 return done(new Error('--async-only option in use without declaring `done()` or returning a promise'));
4215 }
4216
4217 done();
4218 }
4219 }
4220
4221 function callFnAsync(fn) {
4222 fn.call(ctx, function(err) {

Callers 1

mocha.jsFile · 0.85

Calls 1

doneFunction · 0.70

Tested by

no test coverage detected