Coffeescript 推入列表时未获得结果
我有这个咖啡脚本代码Coffeescript 推入列表时未获得结果,coffeescript,Coffeescript,我有这个咖啡脚本代码 emails = [] for mail in profile.emails emails.push mail.value if !emails[0] options = url: "https://api.github.com/user/emails?access_token=" + accessToken headers: "user-
emails = []
for mail in profile.emails
emails.push mail.value
if !emails[0]
options =
url: "https://api.github.com/user/emails?access_token=" + accessToken
headers:
"user-agent": "zmgc.net"
Accept: "application/vnd.github.v3"
request options, (error, response, body)->
unless error
try
user_emails = JSON.parse body
email = user_emails[0].email
console.log email
emails.push email
catch ex
return done(ex)
当我进入if!电子邮件[0]
并尝试将值推送到电子邮件列表,我得到一个空字符串
我遗漏了什么?调用是异步的,因此在我的代码中,这是最后一个调用,这就是我无法获得它的原因。现在修好了