mikefowler / instajam

Instajam is a JavaScript wrapper for the Instagram API. You provide the access token, we provide the jam. Or whatever.
http://mikefowler.github.io/instajam
MIT License
132 stars 33 forks source link

Getting a user's data by supplying a username #8

Closed orhan closed 9 years ago

orhan commented 9 years ago

The User.prototype.get function is broken for queries with particular usernames. For example, if try to get the user "abcd" and there are multiple usernames which begin with "abcd", the function will return 'false'.

Also, the data returned from this query is not the same as querying for a user with a supplied id. After supplying an id, you get more data, such as the media and follower counts, which does not happen if you search for a user with a given name/string.

The function, as it is now, will go through the results and look for an exact match between the supplied username and the users in the result set and then query the API again with the user's id, after finding a match.

mikefowler commented 9 years ago

@orhnsnmz, this looks like a good change. Please address the comments above and I'll happily merge this in.

orhan commented 9 years ago

@mikefowler sorry for the hold-up. I have committed your requested changes now. :)

mikefowler commented 9 years ago

Thanks, @orhnsnmz!