{"action":"created","issue":{"url":"https://api.github.com/repos/chaijs/chai/issues/782","repository_url":"https://api.github.com/repos/chaijs/chai","labels_url":"https://api.github.com/repos/chaijs/chai/issues/782/labels{/name}","comments_url":"https://api.github.com/repos/chaijs/chai/issues/782/comments","events_url":"https://api.github.com/repos/chaijs/chai/issues/782/events","html_url":"https://github.com/chaijs/chai/pull/782","id":174936564,"number":782,"title":"Add fix suggestions when accessing a nonexistent property in proxy mode","user":{"login":"not-an-aardvark","id":11638619,"avatar_url":"https://avatars.githubusercontent.com/u/11638619?v=3","gravatar_id":"","url":"https://api.github.com/users/not-an-aardvark","html_url":"https://github.com/not-an-aardvark","followers_url":"https://api.github.com/users/not-an-aardvark/followers","following_url":"https://api.github.com/users/not-an-aardvark/following{/other_user}","gists_url":"https://api.github.com/users/not-an-aardvark/gists{/gist_id}","starred_url":"https://api.github.com/users/not-an-aardvark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/not-an-aardvark/subscriptions","organizations_url":"https://api.github.com/users/not-an-aardvark/orgs","repos_url":"https://api.github.com/users/not-an-aardvark/repos","events_url":"https://api.github.com/users/not-an-aardvark/events{/privacy}","received_events_url":"https://api.github.com/users/not-an-aardvark/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/chaijs/chai/milestones/6","html_url":"https://github.com/chaijs/chai/milestones/4.0","labels_url":"https://api.github.com/repos/chaijs/chai/milestones/6/labels","id":1985737,"number":6,"title":"4.0","description":"","creator":{"login":"keithamus","id":118266,"avatar_url":"https://avatars.githubusercontent.com/u/118266?v=3","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":0,"state":"open","created_at":"2016-09-06T09:34:06Z","updated_at":"2016-09-06T09:35:00Z","due_on":"2016-10-31T00:00:00Z","closed_at":null},"comments":1,"created_at":"2016-09-04T07:50:24Z","updated_at":"2016-09-06T23:09:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chaijs/chai/pulls/782","html_url":"https://github.com/chaijs/chai/pull/782","diff_url":"https://github.com/chaijs/chai/pull/782.diff","patch_url":"https://github.com/chaijs/chai/pull/782.patch"},"body":"fixes #771 \r\n\r\nAs suggested in #771, when a nonexistent property is accessed in proxy mode, this computes the levenshtein distance to all possible properties in order to suggest the best fix to the user.\r\n\r\n```js\r\nchai.expect(false).to.be.fals; // Error: Invalid Chai property: fals. Did you mean \"false\"?\r\nchai.expect('foo').to.be.undefind; // Error: Invalid Chai property: undefind. Did you mean \"undefined\"?\r\n```\r\n\r\nI decided to not suggest a fix if the closest property has a string distance of 4 or more, simply because the suggestion probably will not be very useful at that point.\r\n\r\n```js\r\nchai.expect('foo').to.be.fdsakfdsafsagsadgagsdfasf // error thrown, no fix suggested\r\n```"},"comment":{"url":"https://api.github.com/repos/chaijs/chai/issues/comments/245124344","html_url":"https://github.com/chaijs/chai/pull/782#issuecomment-245124344","issue_url":"https://api.github.com/repos/chaijs/chai/issues/782","id":245124344,"user":{"login":"lucasfcosta","id":6868147,"avatar_url":"https://avatars.githubusercontent.com/u/6868147?v=3","gravatar_id":"","url":"https://api.github.com/users/lucasfcosta","html_url":"https://github.com/lucasfcosta","followers_url":"https://api.github.com/users/lucasfcosta/followers","following_url":"https://api.github.com/users/lucasfcosta/following{/other_user}","gists_url":"https://api.github.com/users/lucasfcosta/gists{/gist_id}","starred_url":"https://api.github.com/users/lucasfcosta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucasfcosta/subscriptions","organizations_url":"https://api.github.com/users/lucasfcosta/orgs","repos_url":"https://api.github.com/users/lucasfcosta/repos","events_url":"https://api.github.com/users/lucasfcosta/events{/privacy}","received_events_url":"https://api.github.com/users/lucasfcosta/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T23:09:51Z","updated_at":"2016-09-06T23:09:51Z","body":"Hi @not-an-aardvark, thanks for your contribution, I'd like to frame this code and hang it on my wall! It looks really elegant!\r\nWhenever I see an intelligent recursion such as this one my heart beats stronger.\r\n\r\nI've gotta confess I needed half an hour to truly understand how that works, but it was totally worth it.\r\n\r\nJust in case anyone else in the future also needs some help with this, take a look at [this link](http://www.levenshtein.net/), it's an excellent learning resource.\r\n\r\nLGTM!"}}
{"actor":{"display_login":"lucasfcosta"}}