{"action":"created","issue":{"url":"https://api.github.com/repos/ramda/ramda/issues/1389","labels_url":"https://api.github.com/repos/ramda/ramda/issues/1389/labels{/name}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/1389/comments","events_url":"https://api.github.com/repos/ramda/ramda/issues/1389/events","html_url":"https://github.com/ramda/ramda/issues/1389","id":107064959,"number":1389,"title":"safe map maybe mapOr?","user":{"login":"jon49","id":3173098,"avatar_url":"https://avatars.githubusercontent.com/u/3173098?v=3","gravatar_id":"","url":"https://api.github.com/users/jon49","html_url":"https://github.com/jon49","followers_url":"https://api.github.com/users/jon49/followers","following_url":"https://api.github.com/users/jon49/following{/other_user}","gists_url":"https://api.github.com/users/jon49/gists{/gist_id}","starred_url":"https://api.github.com/users/jon49/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jon49/subscriptions","organizations_url":"https://api.github.com/users/jon49/orgs","repos_url":"https://api.github.com/users/jon49/repos","events_url":"https://api.github.com/users/jon49/events{/privacy}","received_events_url":"https://api.github.com/users/jon49/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-17T20:13:06Z","updated_at":"2015-09-23T01:41:28Z","closed_at":null,"body":"Could it be possible to create a safe map that doesn't blow up if it's not an array. Similar to `propOr`.\r\n\r\nE.g.,\r\n\r\n```js\r\nconst mapOr = r.curry((default, f, a) =>\r\n    r.is(Array, a)\r\n        ? r.map(f, a)\r\n    : r.map(f, default)\r\n)\r\n```\r\n\r\nLet me know if you would like me to write a proper `mapOr` function."},"comment":{"url":"https://api.github.com/repos/ramda/ramda/issues/comments/142469572","html_url":"https://github.com/ramda/ramda/issues/1389#issuecomment-142469572","issue_url":"https://api.github.com/repos/ramda/ramda/issues/1389","id":142469572,"user":{"login":"jon49","id":3173098,"avatar_url":"https://avatars.githubusercontent.com/u/3173098?v=3","gravatar_id":"","url":"https://api.github.com/users/jon49","html_url":"https://github.com/jon49","followers_url":"https://api.github.com/users/jon49/followers","following_url":"https://api.github.com/users/jon49/following{/other_user}","gists_url":"https://api.github.com/users/jon49/gists{/gist_id}","starred_url":"https://api.github.com/users/jon49/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jon49/subscriptions","organizations_url":"https://api.github.com/users/jon49/orgs","repos_url":"https://api.github.com/users/jon49/repos","events_url":"https://api.github.com/users/jon49/events{/privacy}","received_events_url":"https://api.github.com/users/jon49/received_events","type":"User","site_admin":false},"created_at":"2015-09-23T01:41:28Z","updated_at":"2015-09-23T01:41:28Z","body":"What I meant by erring out both `path` and `map` was that throwing an error on both of those would be logical. But it doesn't seem logical to throw an error on one but not the other. It seems inconsistent.\r\n\r\nAs in the last example I showed. One might expect to find an array in a nested object but get undefined. Rather than throwing on map it seems to make sense just to return an empty array. This would make the code \"self healing.\" In that way. Rather similar to how browsers are rather lenient. I think that is part of the beauty of JavaScript, in that it is more forgiving. It we want a language that is more exact then we could use something like PureScript.\r\n\r\nI'm not sure how to make checking for undefined more universal.\r\n\r\nAny ways, that's my two cents. :-)"}}