Skip to content

Instantly share code, notes, and snippets.

@neonstalwart
Forked from dmachi/wrapperStore
Created August 18, 2011 16:48
Show Gist options
  • Save neonstalwart/1154503 to your computer and use it in GitHub Desktop.
Save neonstalwart/1154503 to your computer and use it in GitHub Desktop.
getting started with wrapping two stores with one
var store = function(substores,options){
return {
query: function(query, options){
return when(promise.all(substores.map(function (store) {
return when(store.query(query, options));
}), function (results) {
return results.reduce(function (out, arr) {
return out.concat(arr);
}, []);
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment