Q = require 'q'
Require the promised version of the client
client = require './client_promises'
Implement using Q.spawn
to run the generator function
Q.spawn ->
try
yield client.login('davide', 'pass')
posts = yield client.getPosts('alberto')
results = []
for post of posts
results.push(yield client.countPostLikes(post))
yield client.logout()
catch e
console.error 'should handle error here ..'
yield
for every promised valueQ.spawn
is not a promise