{"action":"closed","issue":{"url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/236","repository_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code","labels_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/236/comments","events_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/236/events","html_url":"https://github.com/Chalarangelo/30-seconds-of-code/issues/236","id":282847964,"number":236,"title":"purity of dropElements","user":{"login":"larrybotha","id":1510520,"avatar_url":"https://avatars0.githubusercontent.com/u/1510520?v=4","gravatar_id":"","url":"https://api.github.com/users/larrybotha","html_url":"https://github.com/larrybotha","followers_url":"https://api.github.com/users/larrybotha/followers","following_url":"https://api.github.com/users/larrybotha/following{/other_user}","gists_url":"https://api.github.com/users/larrybotha/gists{/gist_id}","starred_url":"https://api.github.com/users/larrybotha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larrybotha/subscriptions","organizations_url":"https://api.github.com/users/larrybotha/orgs","repos_url":"https://api.github.com/users/larrybotha/repos","events_url":"https://api.github.com/users/larrybotha/events{/privacy}","received_events_url":"https://api.github.com/users/larrybotha/received_events","type":"User","site_admin":false},"labels":[{"id":764709650,"url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/labels/bug","name":"bug","color":"ee0701","default":true},{"id":764709655,"url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-12-18T11:32:18Z","updated_at":"2017-12-19T10:02:38Z","closed_at":"2017-12-19T10:02:38Z","author_association":"NONE","body":"Up until `dropElements` all functions are pure.\r\n\r\n`dropElements`, however, is destructive because of `Array.shift`.\r\n\r\nIt can be made pure using `Array.prototype.slice`:\r\n\r\n```javascript\r\nconst dropElements = (arr, func) => {\r\n  while (arr.length > 0 && !func(arr[0])) arr = arr.slice(1);\r\n  return arr;\r\n};\r\n// dropElements([1, 2, 3, 4], n => n >= 3) -> [3,4]\r\n```\r\n\r\nNot sure if this is even a concern, but I'm happy to make a PR :)"}}
{"actor":{"display_login":"Chalarangelo"}}