Created
April 12, 2017 12:45
-
-
Save kharandziuk/94f766bfcd0c8fd5906b1beda22ef63c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Promise = require('bluebird') | |
function gogogo(queryList) { | |
const parts = [] | |
for (const query of queryList) { | |
const type = await getType(query) | |
if (type === 1) { | |
parts.push(getJson(query)) | |
} | |
else if (type === 2) { | |
parts.push( | |
getRawData(query).rawToJson(rawData) | |
) | |
} else { | |
break | |
} | |
} | |
return Promise | |
.all(parts) | |
.reduce(Object.assign, {}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment