{"action":"created","issue":{"url":"https://api.github.com/repos/teambition/then.js/issues/6","labels_url":"https://api.github.com/repos/teambition/then.js/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/teambition/then.js/issues/6/comments","events_url":"https://api.github.com/repos/teambition/then.js/issues/6/events","html_url":"https://github.com/teambition/then.js/issues/6","id":37562506,"number":6,"title":"series/each 为何不能获得上一个cont的返回值","user":{"login":"goddyZhao","id":164988,"avatar_url":"https://avatars.githubusercontent.com/u/164988?v=3","gravatar_id":"","url":"https://api.github.com/users/goddyZhao","html_url":"https://github.com/goddyZhao","followers_url":"https://api.github.com/users/goddyZhao/followers","following_url":"https://api.github.com/users/goddyZhao/following{/other_user}","gists_url":"https://api.github.com/users/goddyZhao/gists{/gist_id}","starred_url":"https://api.github.com/users/goddyZhao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goddyZhao/subscriptions","organizations_url":"https://api.github.com/users/goddyZhao/orgs","repos_url":"https://api.github.com/users/goddyZhao/repos","events_url":"https://api.github.com/users/goddyZhao/events{/privacy}","received_events_url":"https://api.github.com/users/goddyZhao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-07-10T13:33:44Z","updated_at":"2015-08-18T04:04:48Z","closed_at":null,"body":"Case：\r\n\r\n```javascript\r\nT(function (cont) {\r\n  cont(null, 1);\r\n}\r\n.series([\r\n  function (cont) {....} // 这里其实想要获得1这个值\r\n  function (cont) {.....}\r\n])\r\n```\r\n\r\n现在的workaround就是对于series的操作是同步的就利用全局变量cache住值，异步就得再加一个then，然后用全局变量cache。\r\n\r\n最理想的是：\r\n\r\n```javascript\r\nT(function (cont) {\r\n  cont(null, 1);\r\n}\r\n.series([\r\n  function (cont, val, index) {....} // 这样就可以直接访问val了\r\n  function (cont, val, index) {.....}\r\n])\r\n```\r\n\r\n另外，作为series，数组中的操作都是串行的，说明意图是操作是有依赖性的，那就应该支持：series中上一个的return值要传递到下一个操作中，否则有得要用全局变量来cache"},"comment":{"url":"https://api.github.com/repos/teambition/then.js/issues/comments/132065704","html_url":"https://github.com/teambition/then.js/issues/6#issuecomment-132065704","issue_url":"https://api.github.com/repos/teambition/then.js/issues/6","id":132065704,"user":{"login":"Kevin-Xi","id":1751988,"avatar_url":"https://avatars.githubusercontent.com/u/1751988?v=3","gravatar_id":"","url":"https://api.github.com/users/Kevin-Xi","html_url":"https://github.com/Kevin-Xi","followers_url":"https://api.github.com/users/Kevin-Xi/followers","following_url":"https://api.github.com/users/Kevin-Xi/following{/other_user}","gists_url":"https://api.github.com/users/Kevin-Xi/gists{/gist_id}","starred_url":"https://api.github.com/users/Kevin-Xi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kevin-Xi/subscriptions","organizations_url":"https://api.github.com/users/Kevin-Xi/orgs","repos_url":"https://api.github.com/users/Kevin-Xi/repos","events_url":"https://api.github.com/users/Kevin-Xi/events{/privacy}","received_events_url":"https://api.github.com/users/Kevin-Xi/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T04:04:48Z","updated_at":"2015-08-18T04:04:48Z","body":"LS+1，另外，关于“series中无参数时会读取上一轮结果”这个特性，想知道这是一种trick还是可以稳定依赖的？因为代码中“在上一个then链中异步获得一个数组，在下一个each中处理”这样的逻辑比较多。"}}