Created
December 5, 2013 12:19
-
-
Save imsickofmaps/7804342 to your computer and use it in GitHub Desktop.
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
| self.get_farmer = function(username) { | |
| var p = self.api_call("farmer/", { | |
| actor__user__username: username | |
| }); | |
| p.add_callback(function(result){ | |
| return im.log(result); | |
| }); | |
| p.add_callback(function(result){ | |
| if (result.objects.length === 0){ | |
| return null; | |
| } else { | |
| return result.objects[0]; | |
| } | |
| }); | |
| return p; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lines 5-6 do completely the wrong thing.
im.log()returns the result of logging -- i.e. whether logging succeeded or not. You want to pass the original result on.