{"action":"created","issue":{"url":"https://api.github.com/repos/jashkenas/underscore/issues/2771","repository_url":"https://api.github.com/repos/jashkenas/underscore","labels_url":"https://api.github.com/repos/jashkenas/underscore/issues/2771/labels{/name}","comments_url":"https://api.github.com/repos/jashkenas/underscore/issues/2771/comments","events_url":"https://api.github.com/repos/jashkenas/underscore/issues/2771/events","html_url":"https://github.com/jashkenas/underscore/issues/2771","id":333678153,"node_id":"MDU6SXNzdWUzMzM2NzgxNTM=","number":2771,"title":"Missing mapcan function.","user":{"login":"mafiosso","id":591299,"node_id":"MDQ6VXNlcjU5MTI5OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/591299?v=4","gravatar_id":"","url":"https://api.github.com/users/mafiosso","html_url":"https://github.com/mafiosso","followers_url":"https://api.github.com/users/mafiosso/followers","following_url":"https://api.github.com/users/mafiosso/following{/other_user}","gists_url":"https://api.github.com/users/mafiosso/gists{/gist_id}","starred_url":"https://api.github.com/users/mafiosso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mafiosso/subscriptions","organizations_url":"https://api.github.com/users/mafiosso/orgs","repos_url":"https://api.github.com/users/mafiosso/repos","events_url":"https://api.github.com/users/mafiosso/events{/privacy}","received_events_url":"https://api.github.com/users/mafiosso/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-19T13:43:43Z","updated_at":"2018-07-08T08:11:20Z","closed_at":null,"author_association":"NONE","body":"In many cases I need to map some list/array and remove some subset of original items. In Common Lisp there exists useful procedure mapcan which shortens list if iteratee return nil. I suggest simple implementation for underscore:\r\n\r\n```javascript\r\n_.mapcan = function(arr, fn, ctx){\r\n  return _.filter( _.map(arr, fn, ctx),\r\n    function(item){\r\n      if( item === undefined )\r\n        return false;\r\n      return true;\r\n  });\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/jashkenas/underscore/issues/comments/403270860","html_url":"https://github.com/jashkenas/underscore/issues/2771#issuecomment-403270860","issue_url":"https://api.github.com/repos/jashkenas/underscore/issues/2771","id":403270860,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzI3MDg2MA==","user":{"login":"mafiosso","id":591299,"node_id":"MDQ6VXNlcjU5MTI5OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/591299?v=4","gravatar_id":"","url":"https://api.github.com/users/mafiosso","html_url":"https://github.com/mafiosso","followers_url":"https://api.github.com/users/mafiosso/followers","following_url":"https://api.github.com/users/mafiosso/following{/other_user}","gists_url":"https://api.github.com/users/mafiosso/gists{/gist_id}","starred_url":"https://api.github.com/users/mafiosso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mafiosso/subscriptions","organizations_url":"https://api.github.com/users/mafiosso/orgs","repos_url":"https://api.github.com/users/mafiosso/repos","events_url":"https://api.github.com/users/mafiosso/events{/privacy}","received_events_url":"https://api.github.com/users/mafiosso/received_events","type":"User","site_admin":false},"created_at":"2018-07-08T08:11:20Z","updated_at":"2018-07-08T08:11:20Z","author_association":"NONE","body":"It will make me happy :+1: "}}
{"actor":{"display_login":"mafiosso"}}