MCPcopy Create free account
hub / github.com/ampproject/amphtml / step

Function step

testing/yield.js:23–38  ·  view source on GitHub ↗
(method, result)

Source from the content-addressed store, hash-verified

21 return fn(message, (done) => {
22 const iterator = runnable();
23 function step(method, result) {
24 let state;
25 try {
26 state = iterator[method](result);
27 } catch (e) {
28 // catch any assertion errors and pass to `done`
29 // otherwise the messages are swallowed
30 return done(e);
31 }
32 if (state.done) {
33 Promise.resolve(state.value).then(() => done(), done);
34 return;
35 }
36
37 Promise.resolve(state.value).then(_next, _throw);
38 }
39
40 function _next(value) {
41 step('next', value);

Callers 2

_nextFunction · 0.85
_throwFunction · 0.85

Calls 3

doneFunction · 0.85
resolveMethod · 0.80
thenMethod · 0.45

Tested by

no test coverage detected