{"action":"opened","issue":{"url":"https://api.github.com/repos/JackuB/diff-match-patch/issues/9","repository_url":"https://api.github.com/repos/JackuB/diff-match-patch","labels_url":"https://api.github.com/repos/JackuB/diff-match-patch/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/JackuB/diff-match-patch/issues/9/comments","events_url":"https://api.github.com/repos/JackuB/diff-match-patch/issues/9/events","html_url":"https://github.com/JackuB/diff-match-patch/issues/9","id":303811571,"number":9,"title":"patch_toText, unified diff like output","user":{"login":"mariusk","id":218612,"avatar_url":"https://avatars3.githubusercontent.com/u/218612?v=4","gravatar_id":"","url":"https://api.github.com/users/mariusk","html_url":"https://github.com/mariusk","followers_url":"https://api.github.com/users/mariusk/followers","following_url":"https://api.github.com/users/mariusk/following{/other_user}","gists_url":"https://api.github.com/users/mariusk/gists{/gist_id}","starred_url":"https://api.github.com/users/mariusk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mariusk/subscriptions","organizations_url":"https://api.github.com/users/mariusk/orgs","repos_url":"https://api.github.com/users/mariusk/repos","events_url":"https://api.github.com/users/mariusk/events{/privacy}","received_events_url":"https://api.github.com/users/mariusk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-09T11:31:51Z","updated_at":"2018-03-09T11:31:51Z","closed_at":null,"author_association":"NONE","body":"The docs says this method should create something that looks like a unified diff. When I try it I just get \"[object ...]\" blah blah output. Looking at the actual source code for the method, it doesn't do much, it simply tries to output some of the objects in the diff. Here's the actual source code:\r\n\r\n```javascript\r\n/**\r\n * Take a list of patches and return a textual representation.\r\n * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.\r\n * @return {string} Text representation of patches.\r\n */\r\ndiff_match_patch.prototype.patch_toText = function(patches) {\r\n  var text = [];\r\n  for (var x = 0; x < patches.length; x++) {\r\n    text[x] = patches[x];\r\n  }\r\n  return text.join('');\r\n};\r\n```\r\nSo `patches[x]` is a javascript object, and the `text.join` method just creates these faulty \"object\" strings. I can't find any code that does anything like the comments in the source code mentions. So I guess either we need some more code or the docs should be updated and mark this method as faulty."}}
{"actor":{"display_login":"mariusk"}}