{"action":"created","issue":{"url":"https://api.github.com/repos/lodash/lodash/issues/1376","labels_url":"https://api.github.com/repos/lodash/lodash/issues/1376/labels{/name}","comments_url":"https://api.github.com/repos/lodash/lodash/issues/1376/comments","events_url":"https://api.github.com/repos/lodash/lodash/issues/1376/events","html_url":"https://github.com/lodash/lodash/issues/1376","id":98254465,"number":1376,"title":"Allow _.matches or _.matchesProperty to invoke property that is a function","user":{"login":"joeheyming","id":1858116,"avatar_url":"https://avatars.githubusercontent.com/u/1858116?v=3","gravatar_id":"","url":"https://api.github.com/users/joeheyming","html_url":"https://github.com/joeheyming","followers_url":"https://api.github.com/users/joeheyming/followers","following_url":"https://api.github.com/users/joeheyming/following{/other_user}","gists_url":"https://api.github.com/users/joeheyming/gists{/gist_id}","starred_url":"https://api.github.com/users/joeheyming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeheyming/subscriptions","organizations_url":"https://api.github.com/users/joeheyming/orgs","repos_url":"https://api.github.com/users/joeheyming/repos","events_url":"https://api.github.com/users/joeheyming/events{/privacy}","received_events_url":"https://api.github.com/users/joeheyming/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lodash/lodash/labels/change","name":"change","color":"eb6420"},{"url":"https://api.github.com/repos/lodash/lodash/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-30T20:17:26Z","updated_at":"2015-07-30T20:45:17Z","closed_at":"2015-07-30T20:25:23Z","body":"Lets say I have an object:\r\n```js\r\nFoo = function(name) {\r\n  this.name = name;\r\n}\r\n\r\nFoo.prototype.getName = function() {\r\n  return this.name;\r\n}\r\n```\r\nGiven these objects:\r\n```js\r\na = new Foo('abc')\r\nb = new Foo('123')\r\n```\r\nI already know I can filter like this:\r\n```js\r\nfound = _.filter([a,b], function(item) {\r\n  return item.getName() == 'abc';\r\n});\r\n```\r\nBut I want to do this without an anonymous function, like\r\n```js\r\n_.filter([a,b], _.matchesProperty('getName', 'abc'));\r\n```\r\nor maybe `_.matchesGetter('getName': 'abc')`  where getter implies the function doesn't take any arguments.\r\n\r\n\r\nI am aware, I could just say `_.filter([a,b], {'name': 'abc'})`, but sometimes I am using an external library like knockout where you have pure computed functions \r\n```js\r\nthis.excitingName = ko.computed(function() {\r\n  return this.name() + '!!!';\r\n}, this);\r\n```\r\nso it would be ideal to say `_.filter([a,b], {'excitingName': 'Joe!!!'});` \r\n\r\n no need for unnecessary anonymous functions...\r\n"},"comment":{"url":"https://api.github.com/repos/lodash/lodash/issues/comments/126480772","html_url":"https://github.com/lodash/lodash/issues/1376#issuecomment-126480772","issue_url":"https://api.github.com/repos/lodash/lodash/issues/1376","id":126480772,"user":{"login":"joeheyming","id":1858116,"avatar_url":"https://avatars.githubusercontent.com/u/1858116?v=3","gravatar_id":"","url":"https://api.github.com/users/joeheyming","html_url":"https://github.com/joeheyming","followers_url":"https://api.github.com/users/joeheyming/followers","following_url":"https://api.github.com/users/joeheyming/following{/other_user}","gists_url":"https://api.github.com/users/joeheyming/gists{/gist_id}","starred_url":"https://api.github.com/users/joeheyming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeheyming/subscriptions","organizations_url":"https://api.github.com/users/joeheyming/orgs","repos_url":"https://api.github.com/users/joeheyming/repos","events_url":"https://api.github.com/users/joeheyming/events{/privacy}","received_events_url":"https://api.github.com/users/joeheyming/received_events","type":"User","site_admin":false},"created_at":"2015-07-30T20:45:17Z","updated_at":"2015-07-30T20:45:17Z","body":"nm, got it: x = _.filter([a,b], _.matches(_.callback(Foo.prototype.name), 'abc'))"}}