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

Function wrapAsyncFunctions

lib/script.js:317–338  ·  view source on GitHub ↗
(asyncFunctions, sandbox, events, done, sandboxRoot)

Source from the content-addressed store, hash-verified

315}
316
317function wrapAsyncFunctions(asyncFunctions, sandbox, events, done, sandboxRoot) {
318 if (!sandboxRoot) sandboxRoot = sandbox;
319
320 if(!asyncFunctions) {
321 // stop if asyncFunctions does not exist
322 return;
323 }
324
325 Object.keys(asyncFunctions).forEach(function(k) {
326 if (typeof asyncFunctions[k] === 'function') {
327 sandbox[k] = wrapAsyncFunction(asyncFunctions[k], sandbox, events, done, sandboxRoot);
328
329 // we need to retain all the properties a function might have, think constructor with static functions
330 wrapAsyncFunctions(asyncFunctions[k], sandbox[k], events, done, sandboxRoot);
331 } else if (asyncFunctions[k] !== null && typeof asyncFunctions[k] === 'object' && !(asyncFunctions[k] instanceof Array)) {
332 sandbox[k] = sandbox[k] || {};
333 wrapAsyncFunctions(asyncFunctions[k], sandbox[k], events, done, sandboxRoot);
334 } else {
335 sandbox[k] = asyncFunctions[k];
336 }
337 });
338}
339
340module.exports = Script;

Callers 1

script.jsFile · 0.85

Calls 1

wrapAsyncFunctionFunction · 0.85

Tested by

no test coverage detected