{"action":"opened","number":283,"pull_request":{"url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls/283","id":159570871,"html_url":"https://github.com/Chalarangelo/30-seconds-of-code/pull/283","diff_url":"https://github.com/Chalarangelo/30-seconds-of-code/pull/283.diff","patch_url":"https://github.com/Chalarangelo/30-seconds-of-code/pull/283.patch","issue_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/283","number":283,"state":"open","locked":false,"title":"[UPDATE] pull.md -> fix hacky approach ","user":{"login":"kingdavidmartins","id":10181183,"avatar_url":"https://avatars2.githubusercontent.com/u/10181183?v=4","gravatar_id":"","url":"https://api.github.com/users/kingdavidmartins","html_url":"https://github.com/kingdavidmartins","followers_url":"https://api.github.com/users/kingdavidmartins/followers","following_url":"https://api.github.com/users/kingdavidmartins/following{/other_user}","gists_url":"https://api.github.com/users/kingdavidmartins/gists{/gist_id}","starred_url":"https://api.github.com/users/kingdavidmartins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingdavidmartins/subscriptions","organizations_url":"https://api.github.com/users/kingdavidmartins/orgs","repos_url":"https://api.github.com/users/kingdavidmartins/repos","events_url":"https://api.github.com/users/kingdavidmartins/events{/privacy}","received_events_url":"https://api.github.com/users/kingdavidmartins/received_events","type":"User","site_admin":false},"body":"<!--- Provide a general summary of your changes in the Title above -->\r\n\r\n<!--- Add the prefix [FIX: #(issue number)], [FEATURE] or [ENHANCEMENT] to the Title -->\r\n\r\n## [UPDATE] pull.md\r\n<!--- Describe your changes in detail -->\r\n**Resolves** #258  \r\n### pull\r\n\r\nMutates the original array to filter out the values specified.\r\n\r\nUse `Array.filter()` and `Array.includes()` to pull out the values that are not needed.\r\nUse `Array.length = 0` to mutate the passed in array by resetting it's length to zero and `Array.push()` to re-populate it with only the pulled values.\r\n\r\n_(For a snippet that does not mutate the original array see [`without`](#without))_\r\n\r\n```js\r\nconst pull = (arr, ...args) => {\r\n  let argState = Array.isArray(args[0]) ? args[0] : args;\r\n  let pulled = arr.filter((v, i) => !argState.includes(v));\r\n  arr.length = 0; \r\n  pulled.forEach(v => arr.push(v));\r\n};\r\n\r\n// let myArray1 = ['a', 'b', 'c', 'a', 'b', 'c'];\r\n// pull(myArray1, 'a', 'c');\r\n// console.log(myArray1) -> [ 'b', 'b' ]\r\n\r\n// let myArray2 = ['a', 'b', 'c', 'a', 'b', 'c'];\r\n// pull(myArray2, ['a', 'c']);\r\n// console.log(myArray2) -> [ 'b', 'b' ]\r\n```\r\n\r\n\r\n## What does your PR belong to?\r\n- [ ] Website\r\n- [x] Snippets\r\n- [ ] General / Things regarding the repository (like CI Integration)\r\n\r\n## Types of changes\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] Enhancement (non-breaking improvement of a snippet)\r\n- [x] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My code follows the code style of this project.\r\n- [ ] My change requires a change to the documentation.\r\n- [ ] I have updated the documentation accordingly.\r\n- [x] I have checked that the changes are working properly\r\n- [x] I have checked that there isn't any PR doing the same\r\n- [x] I have read the **CONTRIBUTING** document.\r\n","created_at":"2017-12-21T03:54:49Z","updated_at":"2017-12-21T03:54:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls/283/commits","review_comments_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls/283/comments","review_comment_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/283/comments","statuses_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/statuses/86c34262912005081445709290a6b072e0717fe5","head":{"label":"kingdavidmartins:fix-pull","ref":"fix-pull","sha":"86c34262912005081445709290a6b072e0717fe5","user":{"login":"kingdavidmartins","id":10181183,"avatar_url":"https://avatars2.githubusercontent.com/u/10181183?v=4","gravatar_id":"","url":"https://api.github.com/users/kingdavidmartins","html_url":"https://github.com/kingdavidmartins","followers_url":"https://api.github.com/users/kingdavidmartins/followers","following_url":"https://api.github.com/users/kingdavidmartins/following{/other_user}","gists_url":"https://api.github.com/users/kingdavidmartins/gists{/gist_id}","starred_url":"https://api.github.com/users/kingdavidmartins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingdavidmartins/subscriptions","organizations_url":"https://api.github.com/users/kingdavidmartins/orgs","repos_url":"https://api.github.com/users/kingdavidmartins/repos","events_url":"https://api.github.com/users/kingdavidmartins/events{/privacy}","received_events_url":"https://api.github.com/users/kingdavidmartins/received_events","type":"User","site_admin":false},"repo":{"id":113945291,"name":"30-seconds-of-code","full_name":"kingdavidmartins/30-seconds-of-code","owner":{"login":"kingdavidmartins","id":10181183,"avatar_url":"https://avatars2.githubusercontent.com/u/10181183?v=4","gravatar_id":"","url":"https://api.github.com/users/kingdavidmartins","html_url":"https://github.com/kingdavidmartins","followers_url":"https://api.github.com/users/kingdavidmartins/followers","following_url":"https://api.github.com/users/kingdavidmartins/following{/other_user}","gists_url":"https://api.github.com/users/kingdavidmartins/gists{/gist_id}","starred_url":"https://api.github.com/users/kingdavidmartins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingdavidmartins/subscriptions","organizations_url":"https://api.github.com/users/kingdavidmartins/orgs","repos_url":"https://api.github.com/users/kingdavidmartins/repos","events_url":"https://api.github.com/users/kingdavidmartins/events{/privacy}","received_events_url":"https://api.github.com/users/kingdavidmartins/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kingdavidmartins/30-seconds-of-code","description":"Curated collection of useful Javascript snippets that you can understand in 30 seconds or less.","fork":true,"url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code","forks_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/forks","keys_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/teams","hooks_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/hooks","issue_events_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/issues/events{/number}","events_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/events","assignees_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/assignees{/user}","branches_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/branches{/branch}","tags_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/tags","blobs_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/git/refs{/sha}","trees_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/statuses/{sha}","languages_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/languages","stargazers_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/stargazers","contributors_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/contributors","subscribers_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/subscribers","subscription_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/subscription","commits_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/commits{/sha}","git_commits_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/git/commits{/sha}","comments_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/comments{/number}","issue_comment_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/issues/comments{/number}","contents_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/contents/{+path}","compare_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/merges","archive_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/downloads","issues_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/issues{/number}","pulls_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/pulls{/number}","milestones_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/milestones{/number}","notifications_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/labels{/name}","releases_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/releases{/id}","deployments_url":"https://api.github.com/repos/kingdavidmartins/30-seconds-of-code/deployments","created_at":"2017-12-12T04:57:42Z","updated_at":"2017-12-12T04:57:44Z","pushed_at":"2017-12-21T03:48:26Z","git_url":"git://github.com/kingdavidmartins/30-seconds-of-code.git","ssh_url":"git@github.com:kingdavidmartins/30-seconds-of-code.git","clone_url":"https://github.com/kingdavidmartins/30-seconds-of-code.git","svn_url":"https://github.com/kingdavidmartins/30-seconds-of-code","homepage":"","size":1040,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"cc0-1.0","name":"Creative Commons Zero v1.0 Universal","spdx_id":"CC0-1.0","url":"https://api.github.com/licenses/cc0-1.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Chalarangelo:master","ref":"master","sha":"6dc1a39bc6cc99fb42f0a318c27529bfc3c52a2f","user":{"login":"Chalarangelo","id":8281875,"avatar_url":"https://avatars2.githubusercontent.com/u/8281875?v=4","gravatar_id":"","url":"https://api.github.com/users/Chalarangelo","html_url":"https://github.com/Chalarangelo","followers_url":"https://api.github.com/users/Chalarangelo/followers","following_url":"https://api.github.com/users/Chalarangelo/following{/other_user}","gists_url":"https://api.github.com/users/Chalarangelo/gists{/gist_id}","starred_url":"https://api.github.com/users/Chalarangelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chalarangelo/subscriptions","organizations_url":"https://api.github.com/users/Chalarangelo/orgs","repos_url":"https://api.github.com/users/Chalarangelo/repos","events_url":"https://api.github.com/users/Chalarangelo/events{/privacy}","received_events_url":"https://api.github.com/users/Chalarangelo/received_events","type":"User","site_admin":false},"repo":{"id":112507086,"name":"30-seconds-of-code","full_name":"Chalarangelo/30-seconds-of-code","owner":{"login":"Chalarangelo","id":8281875,"avatar_url":"https://avatars2.githubusercontent.com/u/8281875?v=4","gravatar_id":"","url":"https://api.github.com/users/Chalarangelo","html_url":"https://github.com/Chalarangelo","followers_url":"https://api.github.com/users/Chalarangelo/followers","following_url":"https://api.github.com/users/Chalarangelo/following{/other_user}","gists_url":"https://api.github.com/users/Chalarangelo/gists{/gist_id}","starred_url":"https://api.github.com/users/Chalarangelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chalarangelo/subscriptions","organizations_url":"https://api.github.com/users/Chalarangelo/orgs","repos_url":"https://api.github.com/users/Chalarangelo/repos","events_url":"https://api.github.com/users/Chalarangelo/events{/privacy}","received_events_url":"https://api.github.com/users/Chalarangelo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Chalarangelo/30-seconds-of-code","description":"Curated collection of useful Javascript snippets that you can understand in 30 seconds or less.","fork":false,"url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code","forks_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/forks","keys_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/teams","hooks_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/hooks","issue_events_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/events{/number}","events_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/events","assignees_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/assignees{/user}","branches_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/branches{/branch}","tags_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/tags","blobs_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/git/refs{/sha}","trees_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/statuses/{sha}","languages_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/languages","stargazers_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/stargazers","contributors_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/contributors","subscribers_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/subscribers","subscription_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/subscription","commits_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/commits{/sha}","git_commits_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/git/commits{/sha}","comments_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/comments{/number}","issue_comment_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/comments{/number}","contents_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/contents/{+path}","compare_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/merges","archive_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/downloads","issues_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues{/number}","pulls_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls{/number}","milestones_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/milestones{/number}","notifications_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/labels{/name}","releases_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/releases{/id}","deployments_url":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/deployments","created_at":"2017-11-29T17:35:03Z","updated_at":"2017-12-21T03:53:21Z","pushed_at":"2017-12-21T00:19:14Z","git_url":"git://github.com/Chalarangelo/30-seconds-of-code.git","ssh_url":"git@github.com:Chalarangelo/30-seconds-of-code.git","clone_url":"https://github.com/Chalarangelo/30-seconds-of-code.git","svn_url":"https://github.com/Chalarangelo/30-seconds-of-code","homepage":"https://chalarangelo.github.io/30-seconds-of-code/","size":1053,"stargazers_count":10493,"watchers_count":10493,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":870,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"cc0-1.0","name":"Creative Commons Zero v1.0 Universal","spdx_id":"CC0-1.0","url":"https://api.github.com/licenses/cc0-1.0"},"forks":870,"open_issues":17,"watchers":10493,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls/283"},"html":{"href":"https://github.com/Chalarangelo/30-seconds-of-code/pull/283"},"issue":{"href":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/283"},"comments":{"href":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/issues/283/comments"},"review_comments":{"href":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls/283/comments"},"review_comment":{"href":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/pulls/283/commits"},"statuses":{"href":"https://api.github.com/repos/Chalarangelo/30-seconds-of-code/statuses/86c34262912005081445709290a6b072e0717fe5"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":2,"additions":8,"deletions":4,"changed_files":2}}
{"actor":{"display_login":"kingdavidmartins"}}