Async reduce

by Vladymyr Shevchuk

JavaScript

const init = async () => {
	return await [1, 2, 3].reduce(async (accumP, item) => {
  	const accum = await accumP;
    accum[item] = item;
    return accum;
  }, Promise.resolve({}));
};

init()
	.then(data => {
  	console.error('data', data);
  });