{"action":"created","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/814","labels_url":"https://api.github.com/repos/lodash/lodash/issues/814/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/814/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/814/events","html_url":"https://github.com/lodash/lodash/issues/814","id":50882145,"number":814,"title":"Arity of curried function not taken into account when multiple values provided","user":{"login":"my8bird","id":25788,"avatar_url":"https://avatars.githubusercontent.com/u/25788?v=3","gravatar_id":"","url":"https://api.github.com/users/my8bird","html_url":"https://github.com/my8bird","followers_url":"https://api.github.com/users/my8bird/followers","following_url":"https://api.github.com/users/my8bird/following{/other_user}","gists_url":"https://api.github.com/users/my8bird/gists{/gist_id}","starred_url":"https://api.github.com/users/my8bird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/my8bird/subscriptions","organizations_url":"https://api.github.com/users/my8bird/orgs","repos_url":"https://api.github.com/users/my8bird/repos","events_url":"https://api.github.com/users/my8bird/events{/privacy}","received_events_url":"https://api.github.com/users/my8bird/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lodash/lodash/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-12-03T19:38:42Z","updated_at":"2015-03-11T17:26:19Z","closed_at":"2014-12-05T08:16:22Z","body":"The following example shows a bug where setting the arity of the curried function does not prevent the function from using more then that number of arguments.\r\n\r\nHere I create a curried function of arity two which allows me to have a set of things and then keep checking if an item is in it.  This is needed since `_.contains` provides a third argument of a starting index which I need to avoid if I want my function to work as part of a `_.filter` or other such method which provides more then a single argument to the callback\r\n\r\n__bug__ Example\r\n```javascript\r\n_.curry(_.contains, 2)([1,3,5])(1)\r\n// -> true\r\n_.curry(_.contains, 2)([1,3,5])(1, 2)\r\n// -> false\r\n```\r\n\r\n__usage__ Example\r\n```javascript\r\n_.filter(some_items, _.curry(_.contains, 2)(allowed_items));\r\n```\r\n\r\nI tried using `_.partial` but this also has the third argument issue and there it makes more sense, IMO."},"comment":{"url":"https://api.github.com/repos/lodash/lodash/issues/comments/78312045","html_url":"https://github.com/lodash/lodash/issues/814#issuecomment-78312045","issue_url":"https://api.github.com/repos/lodash/lodash/issues/814","id":78312045,"user":{"login":"jdalton","id":4303,"avatar_url":"https://avatars.githubusercontent.com/u/4303?v=3","gravatar_id":"","url":"https://api.github.com/users/jdalton","html_url":"https://github.com/jdalton","followers_url":"https://api.github.com/users/jdalton/followers","following_url":"https://api.github.com/users/jdalton/following{/other_user}","gists_url":"https://api.github.com/users/jdalton/gists{/gist_id}","starred_url":"https://api.github.com/users/jdalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdalton/subscriptions","organizations_url":"https://api.github.com/users/jdalton/orgs","repos_url":"https://api.github.com/users/jdalton/repos","events_url":"https://api.github.com/users/jdalton/events{/privacy}","received_events_url":"https://api.github.com/users/jdalton/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T17:26:19Z","updated_at":"2015-03-11T17:26:19Z","body":"> Why doesn't this work? Is this a bug?\r\n\r\nNot a bug, by using `curryRight` the args your passing are:\r\n```\r\n// contains('b') is\r\ncontains(_, 'b');\r\n// contains('b')(['a', 'b', 'c']) is\r\ncontains(['a', 'b', 'c'], 'b');\r\n// contains('b')(['a', 'b', 'c'], 2);\r\ncontains(['a', 'b', 'c'], 2, 'b');\r\n```\r\n\r\nSince `2` is not in the array it returns `false`.\r\n"}}