Skip to content

Instantly share code, notes, and snippets.

@kharandziuk
Created April 12, 2017 12:45
Show Gist options
  • Save kharandziuk/94f766bfcd0c8fd5906b1beda22ef63c to your computer and use it in GitHub Desktop.
Save kharandziuk/94f766bfcd0c8fd5906b1beda22ef63c to your computer and use it in GitHub Desktop.
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