Skip to content

Instantly share code, notes, and snippets.

@belukov
Created May 6, 2016 15:32
Show Gist options
  • Select an option

  • Save belukov/2294fc4e0b0ba0cefe59a4d56010f6e1 to your computer and use it in GitHub Desktop.

Select an option

Save belukov/2294fc4e0b0ba0cefe59a4d56010f6e1 to your computer and use it in GitHub Desktop.
(function(localCallback) {
if(curCategory) {
curCategory.getChilds(function (err, childs) {
// ...
var conds = {};
// ... many code for cimplicated conds ...
return localCallback(null, conds);
})
} else {
return localCallback(null, {});
}
})(function(err, conditions) {
if(err) // ...
// some code for both cases
SomeModel.find(conditions, function() {
// ...
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment