Skip to content

Instantly share code, notes, and snippets.

@panetta-net-au
Last active January 7, 2017 10:58
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 panetta-net-au/c68fe9fcdc0de93c1e3d51099de45573 to your computer and use it in GitHub Desktop.
Save panetta-net-au/c68fe9fcdc0de93c1e3d51099de45573 to your computer and use it in GitHub Desktop.
//Example only. This won't work if keys and results are different lengths.
function batchLoad(keys) {
var results = databaseClient.get(keys);
var orderedResults = [];
for (var i=0; i < keys.length; i++) {
orderedResults.push(results.filter(r => r.id == keys[i])[0]);
}
return orderedResults;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment