{"action":"created","issue":{"url":"https://api.github.com/repos/devongovett/pdfkit/issues/360","labels_url":"https://api.github.com/repos/devongovett/pdfkit/issues/360/labels{/name}","comments_url":"https://api.github.com/repos/devongovett/pdfkit/issues/360/comments","events_url":"https://api.github.com/repos/devongovett/pdfkit/issues/360/events","html_url":"https://github.com/devongovett/pdfkit/issues/360","id":54404763,"number":360,"title":"polygon() function has flaws, bugs, cant pass in dynamically made array.","user":{"login":"rauls","id":266044,"avatar_url":"https://avatars.githubusercontent.com/u/266044?v=3","gravatar_id":"","url":"https://api.github.com/users/rauls","html_url":"https://github.com/rauls","followers_url":"https://api.github.com/users/rauls/followers","following_url":"https://api.github.com/users/rauls/following{/other_user}","gists_url":"https://api.github.com/users/rauls/gists{/gist_id}","starred_url":"https://api.github.com/users/rauls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rauls/subscriptions","organizations_url":"https://api.github.com/users/rauls/orgs","repos_url":"https://api.github.com/users/rauls/repos","events_url":"https://api.github.com/users/rauls/events{/privacy}","received_events_url":"https://api.github.com/users/rauls/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-15T02:20:37Z","updated_at":"2015-01-16T06:03:18Z","closed_at":null,"body":"So .... seeing as this function was deficient, I took a look at it and made my own better one, as I was converting an SVG xml file to PDF and the path() did not accept polygons.\r\n\r\nCode below....\r\n\r\n```\r\nPDFDocument.prototype.polygons = function(points) {\r\n  var point, _i, _len;\r\n  this.moveTo.apply(this, points.shift());\r\n  for (_i = 0, _len = points.length; _i < _len; _i++) {\r\n    if( points[_i] ) {\r\n        this.lineTo.apply(this, points[_i]);\r\n    }\r\n  }\r\n  return this.closePath();\r\n}\r\n```\r\n\r\nThis new polygons() function will now accept code created arrays, plot them... and not barf if an array item is empty. Future enhancements could be to check if the argument points is it self a string of points like \"123,456 332,434 123,22\" and convert to arrays.\r\n\r\nPlease add this to the current ver.\r\n\r\nThanks.\r\n\r\nAnd enjoy everyone.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/devongovett/pdfkit/issues/comments/70212112","html_url":"https://github.com/devongovett/pdfkit/issues/360#issuecomment-70212112","issue_url":"https://api.github.com/repos/devongovett/pdfkit/issues/360","id":70212112,"user":{"login":"rauls","id":266044,"avatar_url":"https://avatars.githubusercontent.com/u/266044?v=3","gravatar_id":"","url":"https://api.github.com/users/rauls","html_url":"https://github.com/rauls","followers_url":"https://api.github.com/users/rauls/followers","following_url":"https://api.github.com/users/rauls/following{/other_user}","gists_url":"https://api.github.com/users/rauls/gists{/gist_id}","starred_url":"https://api.github.com/users/rauls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rauls/subscriptions","organizations_url":"https://api.github.com/users/rauls/orgs","repos_url":"https://api.github.com/users/rauls/repos","events_url":"https://api.github.com/users/rauls/events{/privacy}","received_events_url":"https://api.github.com/users/rauls/received_events","type":"User","site_admin":false},"created_at":"2015-01-16T06:03:18Z","updated_at":"2015-01-16T06:03:18Z","body":"Yes it was a polygon from svg.\r\n\r\npoints=\"185.19,126.308 191.798,126.308 191.798,127.38 186.463,127.38 186.463,130.422 191.435,130.422 191.435,131.494 186.463,131.494 186.463,134.805 191.838,134.805 191.838,135.877 185.19,135.877 \"\r\n\r\nIt didn't render anything for me, when I passed in an array of numbers, maybe it was a last member being null perhaps, because of the space at the end.\r\n"}}