{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4624","repository_url":"https://api.github.com/repos/pouchdb/pouchdb","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4624/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4624/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4624/events","html_url":"https://github.com/pouchdb/pouchdb/issues/4624","id":119726181,"number":4624,"title":"'emit' function not defined","user":{"login":"VladyslavGoloshchapov","id":1468675,"avatar_url":"https://avatars.githubusercontent.com/u/1468675?v=3","gravatar_id":"","url":"https://api.github.com/users/VladyslavGoloshchapov","html_url":"https://github.com/VladyslavGoloshchapov","followers_url":"https://api.github.com/users/VladyslavGoloshchapov/followers","following_url":"https://api.github.com/users/VladyslavGoloshchapov/following{/other_user}","gists_url":"https://api.github.com/users/VladyslavGoloshchapov/gists{/gist_id}","starred_url":"https://api.github.com/users/VladyslavGoloshchapov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladyslavGoloshchapov/subscriptions","organizations_url":"https://api.github.com/users/VladyslavGoloshchapov/orgs","repos_url":"https://api.github.com/users/VladyslavGoloshchapov/repos","events_url":"https://api.github.com/users/VladyslavGoloshchapov/events{/privacy}","received_events_url":"https://api.github.com/users/VladyslavGoloshchapov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2015-12-01T14:20:00Z","updated_at":"2017-01-17T02:36:16Z","closed_at":"2015-12-13T19:26:49Z","body":"hello.\n\nI am creating secondary index like this\n\n``` javascript\n                var assetSearchIndex = {\n                    _id: '_design/assetSearchIndex',\n                    views: {\n                        byAssetNum: {\n                            map: function(asset, emit) {\n                                emit(asset.ASSETNUM);\n                            }.toString()\n                        }\n                    }\n                };\n```\n\nHowever when index is being built, I receive multiple errors\n\n```\nTypeError: emit is not a function\n```\n\nAfter some debugging I found out that I should not receive emit as param, because it exists in upper scope, when map function is eval-ed.\n\nI think this is not correct, because:\n1) it is inconsistent with temp index syntax\n2) map is using 'emit' which is not passed nor defined (this also causes eslint validator errors)\n\nThanks,\nVlad\n"},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/273007185","html_url":"https://github.com/pouchdb/pouchdb/issues/4624#issuecomment-273007185","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4624","id":273007185,"user":{"login":"thiagobackadelino","id":14223502,"avatar_url":"https://avatars.githubusercontent.com/u/14223502?v=3","gravatar_id":"","url":"https://api.github.com/users/thiagobackadelino","html_url":"https://github.com/thiagobackadelino","followers_url":"https://api.github.com/users/thiagobackadelino/followers","following_url":"https://api.github.com/users/thiagobackadelino/following{/other_user}","gists_url":"https://api.github.com/users/thiagobackadelino/gists{/gist_id}","starred_url":"https://api.github.com/users/thiagobackadelino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thiagobackadelino/subscriptions","organizations_url":"https://api.github.com/users/thiagobackadelino/orgs","repos_url":"https://api.github.com/users/thiagobackadelino/repos","events_url":"https://api.github.com/users/thiagobackadelino/events{/privacy}","received_events_url":"https://api.github.com/users/thiagobackadelino/received_events","type":"User","site_admin":false},"created_at":"2017-01-17T02:36:16Z","updated_at":"2017-01-17T02:36:16Z","body":"obtive o mesmo problema utilizando typescript e pouchdb , couchdb ao criar Persistent queries.\r\ncomo solução e levando em conta que não será o type script que executara a function e sim o couchdb\r\n \r\n\r\n![](https://cloud.githubusercontent.com/assets/14223502/22002217/dd0823a0-dc28-11e6-89a1-4284dd319c35.png)\r\n"}}
{"actor":{"display_login":"thiagobackadelino"}}