You cannot make a synchronous result from an asynchronous operation in Javascript. You just can't do it. If any part of your operation is asynchronous, the whole result should be asynchronous, and you should either use a callback, promise, or some other such mechanism to communicate when the operation is completed, and the result is ready.
If your async operation already returns a promise (what it looks like), you should simply return this from the wrapper function:
function myWrapperFunction() { var accumulator = {}; var myPromise = doAsynchronousThingThatSideEffectsAccumulator(accumulator);
You may also note that a feature that works with side effects is rarely the best design template. You can also skip the entry and return it through the allowed promises and completely eliminate side effects.
source share