Created
May 6, 2011 22:15
-
-
Save lifecoder/959896 to your computer and use it in GitHub Desktop.
Named nested functions after return
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CategoryRepository.prototype.findAll = function(callback) { | |
return this.db.collection('categories', onCollectionReady); | |
function onCollectionReady(error, collection) { | |
if (error) return callback(error); | |
collection.find(onCursorReady); | |
} | |
function onCursorReady(error, cursor) { | |
console.log('onCursorReady'); | |
if (error) return callback(error, null); | |
cursor.toArray(callback); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment