Skip to content

Instantly share code, notes, and snippets.

@peterjuras
Created July 28, 2016 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjuras/49344df648408ca880b932460d9c8531 to your computer and use it in GitHub Desktop.
Save peterjuras/49344df648408ca880b932460d9c8531 to your computer and use it in GitHub Desktop.
Azure Functions Promise test
// Version A
module.exports = function(context) {
var urls = [];
if (urls.length === 0) {
context.done();
}
}
// Version B
module.exports = function(context) {
var urls = [];
// Promise.all([]) should resolve immediately with an empty array!
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
Promise.all(urls).then(() => context.done());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment