Getting all likes from a specific user on a news wall with fewer graph API calls
Interesting / fun question.

I don't think there is much to improve there to reduce the API call count.

From a once over, these are some things you might want to look at:


forEach is still slower than the good old for loop, not sure that matters for you.
Don't use console.log in production code
Don't keep commented out code in production code
Does it make sense to keep comparing to my_user_id if you already found a match ? It is not like you could like the same post twice ? (One more (better) argument to not use forEach here)
my_user_id -> myUserId -> id , always apply lowerCamelCase plus keep it simple


Not relevant after comment


You say you are using the likes edge in your comment, so you might want to mention that in your example ex: url = /123/posts/likes ?
If post.likes is not set while using the likes edge, then something serious is going on , consider an early 'return callback(count);`
Same thing for if (response.data)