0

私はこのコードを持っています:

 $ = $root.cheerio.load(body)
 results = $('#selector').map (index, element)->
      items = []
      $(this).find('.item_link').each (i, el)->
        console.log("asdf")
        items[i] =  $(this).attr('title')

      result=
        name: $(this).find('.the_name_link').attr('title') 
        #HERE I'd like to do something with items but it's not working
      return result

    return callback(null,results)

したがって、このコードが実行されると、基本的にエラーは発生せず、私のインターフェイスでは次の結果が得られます

[
    {
        "name": "The Name I was looking for"
        }
]

しかし、各ブロックのコードは決して実行されないようです (コンソール出力 'asdf' はありません)。私は何を間違っていますか?

4

1 に答える 1