MCPcopy Create free account
hub / github.com/chain/Core / next

Function next

sdk/node/src/shared.js:175–202  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173 let item
174
175 const next = () => {
176 if (index >= page.items.length) {
177 if (page.lastPage) {
178 done()
179 } else {
180 nextParams = page.next
181 nextPage()
182 }
183 return
184 }
185
186 item = page.items[index]
187 index++
188
189 // Pass the next item to the processor, as well as two loop
190 // operations:
191 //
192 // - next(): Continue to next item
193 // - done(err): Then terminate the loop by fulfilling the outer promise
194 //
195 // The process can also terminate the loop by returning a promise
196 // that will reject.
197
198 let res = processor(item, next, done)
199 if (res && typeof res.catch === 'function') {
200 res.catch(reject)
201 }
202 }
203
204 next()
205 }).catch(reject) // fail processor loop on query failure

Callers 10

callbacks.jsFile · 0.85
promises.jsFile · 0.85
nextPageFunction · 0.85
nextPageMethod · 0.85
accounts.jsFile · 0.85
assets.jsFile · 0.85
unspentOutputs.jsFile · 0.85
processingLoopFunction · 0.85
queries.jsFile · 0.85
actions.jsFile · 0.85

Calls 2

doneFunction · 0.85
nextPageFunction · 0.85

Tested by

no test coverage detected