{"action":"created","comment":{"url":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/comments/241828489","pull_request_review_id":185205332,"id":241828489,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MTgyODQ4OQ==","diff_hunk":"@@ -0,0 +1,19 @@\n+CreateMethodProperty(Array.prototype, 'flat', function flat() {\n+\tlet depth = isNaN(arguments[0]) ? 1 : Number(arguments[0]);\n+\tconst stack = Array.prototype.slice.call(this);\n+\tconst result = [];\n+\n+\twhile (depth && stack.length) {\n+\t\tconst next = stack.pop();\n+\n+\t\tif (Object(next) instanceof Array) {\n+\t\t\t--depth;\n+\n+\t\t\tArray.prototype.push.apply(stack, next);\n+\t\t} else {\n+\t\t\tresult.unshift(next);\n+\t\t}\n+\t}\n+\n+\treturn result.concat(stack);\n+});","path":"packages/polyfill-library/polyfills/Array/prototype/flat/polyfill.js","position":19,"original_position":19,"commit_id":"132d05c0caaf7a8ba454e8c14f0eccbdb362eadb","original_commit_id":"132d05c0caaf7a8ba454e8c14f0eccbdb362eadb","user":{"login":"caub","id":3134574,"node_id":"MDQ6VXNlcjMxMzQ1NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3134574?v=4","gravatar_id":"","url":"https://api.github.com/users/caub","html_url":"https://github.com/caub","followers_url":"https://api.github.com/users/caub/followers","following_url":"https://api.github.com/users/caub/following{/other_user}","gists_url":"https://api.github.com/users/caub/gists{/gist_id}","starred_url":"https://api.github.com/users/caub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caub/subscriptions","organizations_url":"https://api.github.com/users/caub/orgs","repos_url":"https://api.github.com/users/caub/repos","events_url":"https://api.github.com/users/caub/events{/privacy}","received_events_url":"https://api.github.com/users/caub/received_events","type":"User","site_admin":false},"body":"oh fair enough\r\n```js\r\nfunction flat(a, depth = Infinity) {\r\n  return Array.isArray(a) && depth > 0 ? a.reduce(function(b,c){ return b.concat(flat(c, depth-1)); }, []) : a;\r\n}\r\n```\r\nbut neither this approach or yours works for the empty slots cases, https://github.com/es-shims/Array.prototype.flat would be the correct way to handle them, not sure if important","created_at":"2018-12-14T17:18:13Z","updated_at":"2018-12-14T17:18:13Z","html_url":"https://github.com/Financial-Times/polyfill-service/pull/1821#discussion_r241828489","pull_request_url":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/1821","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/comments/241828489"},"html":{"href":"https://github.com/Financial-Times/polyfill-service/pull/1821#discussion_r241828489"},"pull_request":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/1821"}},"in_reply_to_id":241813013},"pull_request":{"url":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/1821","id":234038752,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0MDM4NzUy","html_url":"https://github.com/Financial-Times/polyfill-service/pull/1821","diff_url":"https://github.com/Financial-Times/polyfill-service/pull/1821.diff","patch_url":"https://github.com/Financial-Times/polyfill-service/pull/1821.patch","issue_url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/1821","number":1821,"state":"open","locked":false,"title":"Add Array.prototype.flat polyfill","user":{"login":"jonathantneal","id":188426,"node_id":"MDQ6VXNlcjE4ODQyNg==","avatar_url":"https://avatars0.githubusercontent.com/u/188426?v=4","gravatar_id":"","url":"https://api.github.com/users/jonathantneal","html_url":"https://github.com/jonathantneal","followers_url":"https://api.github.com/users/jonathantneal/followers","following_url":"https://api.github.com/users/jonathantneal/following{/other_user}","gists_url":"https://api.github.com/users/jonathantneal/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathantneal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathantneal/subscriptions","organizations_url":"https://api.github.com/users/jonathantneal/orgs","repos_url":"https://api.github.com/users/jonathantneal/repos","events_url":"https://api.github.com/users/jonathantneal/events{/privacy}","received_events_url":"https://api.github.com/users/jonathantneal/received_events","type":"User","site_admin":false},"body":"This adds the `flat` method for Arrays.\r\n\r\nResolves #4294","created_at":"2018-11-27T19:50:00Z","updated_at":"2018-12-14T17:18:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f2c2dccb8369f8ddd6b942d44b448663468208a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/1821/commits","review_comments_url":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/1821/comments","review_comment_url":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/1821/comments","statuses_url":"https://api.github.com/repos/Financial-Times/polyfill-service/statuses/132d05c0caaf7a8ba454e8c14f0eccbdb362eadb","head":{"label":"jonathantneal:add/array-prototype-flat","ref":"add/array-prototype-flat","sha":"132d05c0caaf7a8ba454e8c14f0eccbdb362eadb","user":{"login":"jonathantneal","id":188426,"node_id":"MDQ6VXNlcjE4ODQyNg==","avatar_url":"https://avatars0.githubusercontent.com/u/188426?v=4","gravatar_id":"","url":"https://api.github.com/users/jonathantneal","html_url":"https://github.com/jonathantneal","followers_url":"https://api.github.com/users/jonathantneal/followers","following_url":"https://api.github.com/users/jonathantneal/following{/other_user}","gists_url":"https://api.github.com/users/jonathantneal/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathantneal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathantneal/subscriptions","organizations_url":"https://api.github.com/users/jonathantneal/orgs","repos_url":"https://api.github.com/users/jonathantneal/repos","events_url":"https://api.github.com/users/jonathantneal/events{/privacy}","received_events_url":"https://api.github.com/users/jonathantneal/received_events","type":"User","site_admin":false},"repo":{"id":8889488,"node_id":"MDEwOlJlcG9zaXRvcnk4ODg5NDg4","name":"polyfill","full_name":"jonathantneal/polyfill","private":false,"owner":{"login":"jonathantneal","id":188426,"node_id":"MDQ6VXNlcjE4ODQyNg==","avatar_url":"https://avatars0.githubusercontent.com/u/188426?v=4","gravatar_id":"","url":"https://api.github.com/users/jonathantneal","html_url":"https://github.com/jonathantneal","followers_url":"https://api.github.com/users/jonathantneal/followers","following_url":"https://api.github.com/users/jonathantneal/following{/other_user}","gists_url":"https://api.github.com/users/jonathantneal/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathantneal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathantneal/subscriptions","organizations_url":"https://api.github.com/users/jonathantneal/orgs","repos_url":"https://api.github.com/users/jonathantneal/repos","events_url":"https://api.github.com/users/jonathantneal/events{/privacy}","received_events_url":"https://api.github.com/users/jonathantneal/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jonathantneal/polyfill","description":"A polyfill combinator","fork":true,"url":"https://api.github.com/repos/jonathantneal/polyfill","forks_url":"https://api.github.com/repos/jonathantneal/polyfill/forks","keys_url":"https://api.github.com/repos/jonathantneal/polyfill/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jonathantneal/polyfill/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jonathantneal/polyfill/teams","hooks_url":"https://api.github.com/repos/jonathantneal/polyfill/hooks","issue_events_url":"https://api.github.com/repos/jonathantneal/polyfill/issues/events{/number}","events_url":"https://api.github.com/repos/jonathantneal/polyfill/events","assignees_url":"https://api.github.com/repos/jonathantneal/polyfill/assignees{/user}","branches_url":"https://api.github.com/repos/jonathantneal/polyfill/branches{/branch}","tags_url":"https://api.github.com/repos/jonathantneal/polyfill/tags","blobs_url":"https://api.github.com/repos/jonathantneal/polyfill/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jonathantneal/polyfill/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jonathantneal/polyfill/git/refs{/sha}","trees_url":"https://api.github.com/repos/jonathantneal/polyfill/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jonathantneal/polyfill/statuses/{sha}","languages_url":"https://api.github.com/repos/jonathantneal/polyfill/languages","stargazers_url":"https://api.github.com/repos/jonathantneal/polyfill/stargazers","contributors_url":"https://api.github.com/repos/jonathantneal/polyfill/contributors","subscribers_url":"https://api.github.com/repos/jonathantneal/polyfill/subscribers","subscription_url":"https://api.github.com/repos/jonathantneal/polyfill/subscription","commits_url":"https://api.github.com/repos/jonathantneal/polyfill/commits{/sha}","git_commits_url":"https://api.github.com/repos/jonathantneal/polyfill/git/commits{/sha}","comments_url":"https://api.github.com/repos/jonathantneal/polyfill/comments{/number}","issue_comment_url":"https://api.github.com/repos/jonathantneal/polyfill/issues/comments{/number}","contents_url":"https://api.github.com/repos/jonathantneal/polyfill/contents/{+path}","compare_url":"https://api.github.com/repos/jonathantneal/polyfill/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jonathantneal/polyfill/merges","archive_url":"https://api.github.com/repos/jonathantneal/polyfill/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jonathantneal/polyfill/downloads","issues_url":"https://api.github.com/repos/jonathantneal/polyfill/issues{/number}","pulls_url":"https://api.github.com/repos/jonathantneal/polyfill/pulls{/number}","milestones_url":"https://api.github.com/repos/jonathantneal/polyfill/milestones{/number}","notifications_url":"https://api.github.com/repos/jonathantneal/polyfill/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jonathantneal/polyfill/labels{/name}","releases_url":"https://api.github.com/repos/jonathantneal/polyfill/releases{/id}","deployments_url":"https://api.github.com/repos/jonathantneal/polyfill/deployments","created_at":"2013-03-19T21:17:57Z","updated_at":"2018-11-27T19:08:18Z","pushed_at":"2018-11-27T19:45:57Z","git_url":"git://github.com/jonathantneal/polyfill.git","ssh_url":"git@github.com:jonathantneal/polyfill.git","clone_url":"https://github.com/jonathantneal/polyfill.git","svn_url":"https://github.com/jonathantneal/polyfill","homepage":null,"size":21057,"stargazers_count":770,"watchers_count":770,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":20,"open_issues":2,"watchers":770,"default_branch":"master"}},"base":{"label":"Financial-Times:master","ref":"master","sha":"1558706799ee6f77ac66ed0ff0a0f6c05ff81826","user":{"login":"Financial-Times","id":3502508,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MDI1MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/3502508?v=4","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"repo":{"id":21244924,"node_id":"MDEwOlJlcG9zaXRvcnkyMTI0NDkyNA==","name":"polyfill-service","full_name":"Financial-Times/polyfill-service","private":false,"owner":{"login":"Financial-Times","id":3502508,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1MDI1MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/3502508?v=4","gravatar_id":"","url":"https://api.github.com/users/Financial-Times","html_url":"https://github.com/Financial-Times","followers_url":"https://api.github.com/users/Financial-Times/followers","following_url":"https://api.github.com/users/Financial-Times/following{/other_user}","gists_url":"https://api.github.com/users/Financial-Times/gists{/gist_id}","starred_url":"https://api.github.com/users/Financial-Times/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Financial-Times/subscriptions","organizations_url":"https://api.github.com/users/Financial-Times/orgs","repos_url":"https://api.github.com/users/Financial-Times/repos","events_url":"https://api.github.com/users/Financial-Times/events{/privacy}","received_events_url":"https://api.github.com/users/Financial-Times/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Financial-Times/polyfill-service","description":"Automatic polyfill service","fork":false,"url":"https://api.github.com/repos/Financial-Times/polyfill-service","forks_url":"https://api.github.com/repos/Financial-Times/polyfill-service/forks","keys_url":"https://api.github.com/repos/Financial-Times/polyfill-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Financial-Times/polyfill-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Financial-Times/polyfill-service/teams","hooks_url":"https://api.github.com/repos/Financial-Times/polyfill-service/hooks","issue_events_url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/events{/number}","events_url":"https://api.github.com/repos/Financial-Times/polyfill-service/events","assignees_url":"https://api.github.com/repos/Financial-Times/polyfill-service/assignees{/user}","branches_url":"https://api.github.com/repos/Financial-Times/polyfill-service/branches{/branch}","tags_url":"https://api.github.com/repos/Financial-Times/polyfill-service/tags","blobs_url":"https://api.github.com/repos/Financial-Times/polyfill-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Financial-Times/polyfill-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Financial-Times/polyfill-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/Financial-Times/polyfill-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Financial-Times/polyfill-service/statuses/{sha}","languages_url":"https://api.github.com/repos/Financial-Times/polyfill-service/languages","stargazers_url":"https://api.github.com/repos/Financial-Times/polyfill-service/stargazers","contributors_url":"https://api.github.com/repos/Financial-Times/polyfill-service/contributors","subscribers_url":"https://api.github.com/repos/Financial-Times/polyfill-service/subscribers","subscription_url":"https://api.github.com/repos/Financial-Times/polyfill-service/subscription","commits_url":"https://api.github.com/repos/Financial-Times/polyfill-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/Financial-Times/polyfill-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/Financial-Times/polyfill-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/Financial-Times/polyfill-service/contents/{+path}","compare_url":"https://api.github.com/repos/Financial-Times/polyfill-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Financial-Times/polyfill-service/merges","archive_url":"https://api.github.com/repos/Financial-Times/polyfill-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Financial-Times/polyfill-service/downloads","issues_url":"https://api.github.com/repos/Financial-Times/polyfill-service/issues{/number}","pulls_url":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls{/number}","milestones_url":"https://api.github.com/repos/Financial-Times/polyfill-service/milestones{/number}","notifications_url":"https://api.github.com/repos/Financial-Times/polyfill-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Financial-Times/polyfill-service/labels{/name}","releases_url":"https://api.github.com/repos/Financial-Times/polyfill-service/releases{/id}","deployments_url":"https://api.github.com/repos/Financial-Times/polyfill-service/deployments","created_at":"2014-06-26T15:09:49Z","updated_at":"2018-12-14T10:41:45Z","pushed_at":"2018-12-14T16:39:44Z","git_url":"git://github.com/Financial-Times/polyfill-service.git","ssh_url":"git@github.com:Financial-Times/polyfill-service.git","clone_url":"https://github.com/Financial-Times/polyfill-service.git","svn_url":"https://github.com/Financial-Times/polyfill-service","homepage":"https://polyfill.io/v2/docs/","size":21659,"stargazers_count":3373,"watchers_count":3373,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":409,"mirror_url":null,"archived":false,"open_issues_count":142,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":409,"open_issues":142,"watchers":3373,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/1821"},"html":{"href":"https://github.com/Financial-Times/polyfill-service/pull/1821"},"issue":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/1821"},"comments":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/issues/1821/comments"},"review_comments":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/1821/comments"},"review_comment":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/pulls/1821/commits"},"statuses":{"href":"https://api.github.com/repos/Financial-Times/polyfill-service/statuses/132d05c0caaf7a8ba454e8c14f0eccbdb362eadb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"caub"}}