{"action":"created","comment":{"url":"https://api.github.com/repos/gulpjs/vinyl/pulls/comments/67609513","id":67609513,"diff_hunk":"@@ -28,6 +28,13 @@ function File(file) {\n   this.contents = file.contents || null;\n \n   this._isVinyl = true;\n+\n+  // Set custom properties\n+  Object.keys(file).forEach(function(key) {\n+    if (this.constructor.isCustomProp(key)) {\n+      this[key] = file[key];\n+    }\n+  }, this);","path":"index.js","position":10,"original_position":10,"commit_id":"85a64dadf6851655042603574ffe5651e53bac40","original_commit_id":"85a64dadf6851655042603574ffe5651e53bac40","user":{"login":"phated","id":992373,"avatar_url":"https://avatars.githubusercontent.com/u/992373?v=3","gravatar_id":"","url":"https://api.github.com/users/phated","html_url":"https://github.com/phated","followers_url":"https://api.github.com/users/phated/followers","following_url":"https://api.github.com/users/phated/following{/other_user}","gists_url":"https://api.github.com/users/phated/gists{/gist_id}","starred_url":"https://api.github.com/users/phated/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phated/subscriptions","organizations_url":"https://api.github.com/users/phated/orgs","repos_url":"https://api.github.com/users/phated/repos","events_url":"https://api.github.com/users/phated/events{/privacy}","received_events_url":"https://api.github.com/users/phated/received_events","type":"User","site_admin":false},"body":"I prefer to avoid this binding.  I know `self` is messier but I'm always nervous about bind performance","created_at":"2016-06-19T02:56:34Z","updated_at":"2016-06-19T02:56:34Z","html_url":"https://github.com/gulpjs/vinyl/pull/92#discussion_r67609513","pull_request_url":"https://api.github.com/repos/gulpjs/vinyl/pulls/92","_links":{"self":{"href":"https://api.github.com/repos/gulpjs/vinyl/pulls/comments/67609513"},"html":{"href":"https://github.com/gulpjs/vinyl/pull/92#discussion_r67609513"},"pull_request":{"href":"https://api.github.com/repos/gulpjs/vinyl/pulls/92"}}},"pull_request":{"url":"https://api.github.com/repos/gulpjs/vinyl/pulls/92","id":72947911,"html_url":"https://github.com/gulpjs/vinyl/pull/92","diff_url":"https://github.com/gulpjs/vinyl/pull/92.diff","patch_url":"https://github.com/gulpjs/vinyl/pull/92.patch","issue_url":"https://api.github.com/repos/gulpjs/vinyl/issues/92","number":92,"state":"open","locked":false,"title":"Make constructor set custom properties","user":{"login":"darsain","id":538801,"avatar_url":"https://avatars.githubusercontent.com/u/538801?v=3","gravatar_id":"","url":"https://api.github.com/users/darsain","html_url":"https://github.com/darsain","followers_url":"https://api.github.com/users/darsain/followers","following_url":"https://api.github.com/users/darsain/following{/other_user}","gists_url":"https://api.github.com/users/darsain/gists{/gist_id}","starred_url":"https://api.github.com/users/darsain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darsain/subscriptions","organizations_url":"https://api.github.com/users/darsain/orgs","repos_url":"https://api.github.com/users/darsain/repos","events_url":"https://api.github.com/users/darsain/events{/privacy}","received_events_url":"https://api.github.com/users/darsain/received_events","type":"User","site_admin":false},"body":"Currently, when doing this:\r\n\r\n```js\r\nvar file = new Vinyl({\r\n  path: __dirname + '/index.js',\r\n  sourceMap: {}\r\n});\r\n```\r\n\r\n`sourceMap` and any other custom properties are ignored. This PR will make constructor extend `this` with all custom props passed in the configuration object.\r\n\r\nIt'll make creating Vinyl files a bit faster and more comfy.\r\n\r\nI'm also moving check for custom properties from that multiline `if` statement to a dedicated static method `File.isCustomProp(key)` which relies on `File.builtInFields` array to check if a key is a custom property.\r\n\r\nThis is than used in `#clone()`, as well as constructor, and could be used in `#toJSON()` method from other PR.\r\n\r\nIt also allows anyone that extends from `Vinyl` to extend their `ExtendedVinyl.builtInFields` with their own props that shouldn't be cloned.","created_at":"2016-06-07T21:02:58Z","updated_at":"2016-06-19T02:56:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d21aa1972d258d2355725f27af6c00c05e440eea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gulpjs/vinyl/pulls/92/commits","review_comments_url":"https://api.github.com/repos/gulpjs/vinyl/pulls/92/comments","review_comment_url":"https://api.github.com/repos/gulpjs/vinyl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gulpjs/vinyl/issues/92/comments","statuses_url":"https://api.github.com/repos/gulpjs/vinyl/statuses/85a64dadf6851655042603574ffe5651e53bac40","head":{"label":"darsain:constructor-custom-props","ref":"constructor-custom-props","sha":"85a64dadf6851655042603574ffe5651e53bac40","user":{"login":"darsain","id":538801,"avatar_url":"https://avatars.githubusercontent.com/u/538801?v=3","gravatar_id":"","url":"https://api.github.com/users/darsain","html_url":"https://github.com/darsain","followers_url":"https://api.github.com/users/darsain/followers","following_url":"https://api.github.com/users/darsain/following{/other_user}","gists_url":"https://api.github.com/users/darsain/gists{/gist_id}","starred_url":"https://api.github.com/users/darsain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darsain/subscriptions","organizations_url":"https://api.github.com/users/darsain/orgs","repos_url":"https://api.github.com/users/darsain/repos","events_url":"https://api.github.com/users/darsain/events{/privacy}","received_events_url":"https://api.github.com/users/darsain/received_events","type":"User","site_admin":false},"repo":{"id":60606397,"name":"vinyl","full_name":"darsain/vinyl","owner":{"login":"darsain","id":538801,"avatar_url":"https://avatars.githubusercontent.com/u/538801?v=3","gravatar_id":"","url":"https://api.github.com/users/darsain","html_url":"https://github.com/darsain","followers_url":"https://api.github.com/users/darsain/followers","following_url":"https://api.github.com/users/darsain/following{/other_user}","gists_url":"https://api.github.com/users/darsain/gists{/gist_id}","starred_url":"https://api.github.com/users/darsain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darsain/subscriptions","organizations_url":"https://api.github.com/users/darsain/orgs","repos_url":"https://api.github.com/users/darsain/repos","events_url":"https://api.github.com/users/darsain/events{/privacy}","received_events_url":"https://api.github.com/users/darsain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/darsain/vinyl","description":"Virtual file format","fork":true,"url":"https://api.github.com/repos/darsain/vinyl","forks_url":"https://api.github.com/repos/darsain/vinyl/forks","keys_url":"https://api.github.com/repos/darsain/vinyl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/darsain/vinyl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/darsain/vinyl/teams","hooks_url":"https://api.github.com/repos/darsain/vinyl/hooks","issue_events_url":"https://api.github.com/repos/darsain/vinyl/issues/events{/number}","events_url":"https://api.github.com/repos/darsain/vinyl/events","assignees_url":"https://api.github.com/repos/darsain/vinyl/assignees{/user}","branches_url":"https://api.github.com/repos/darsain/vinyl/branches{/branch}","tags_url":"https://api.github.com/repos/darsain/vinyl/tags","blobs_url":"https://api.github.com/repos/darsain/vinyl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/darsain/vinyl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/darsain/vinyl/git/refs{/sha}","trees_url":"https://api.github.com/repos/darsain/vinyl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/darsain/vinyl/statuses/{sha}","languages_url":"https://api.github.com/repos/darsain/vinyl/languages","stargazers_url":"https://api.github.com/repos/darsain/vinyl/stargazers","contributors_url":"https://api.github.com/repos/darsain/vinyl/contributors","subscribers_url":"https://api.github.com/repos/darsain/vinyl/subscribers","subscription_url":"https://api.github.com/repos/darsain/vinyl/subscription","commits_url":"https://api.github.com/repos/darsain/vinyl/commits{/sha}","git_commits_url":"https://api.github.com/repos/darsain/vinyl/git/commits{/sha}","comments_url":"https://api.github.com/repos/darsain/vinyl/comments{/number}","issue_comment_url":"https://api.github.com/repos/darsain/vinyl/issues/comments{/number}","contents_url":"https://api.github.com/repos/darsain/vinyl/contents/{+path}","compare_url":"https://api.github.com/repos/darsain/vinyl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/darsain/vinyl/merges","archive_url":"https://api.github.com/repos/darsain/vinyl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/darsain/vinyl/downloads","issues_url":"https://api.github.com/repos/darsain/vinyl/issues{/number}","pulls_url":"https://api.github.com/repos/darsain/vinyl/pulls{/number}","milestones_url":"https://api.github.com/repos/darsain/vinyl/milestones{/number}","notifications_url":"https://api.github.com/repos/darsain/vinyl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/darsain/vinyl/labels{/name}","releases_url":"https://api.github.com/repos/darsain/vinyl/releases{/id}","deployments_url":"https://api.github.com/repos/darsain/vinyl/deployments","created_at":"2016-06-07T10:59:24Z","updated_at":"2016-06-07T10:59:25Z","pushed_at":"2016-06-13T22:57:52Z","git_url":"git://github.com/darsain/vinyl.git","ssh_url":"git@github.com:darsain/vinyl.git","clone_url":"https://github.com/darsain/vinyl.git","svn_url":"https://github.com/darsain/vinyl","homepage":null,"size":99,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"gulpjs:master","ref":"master","sha":"e19855d4cac6102ee63b4f8c1fdbc37e49e3c911","user":{"login":"gulpjs","id":6200624,"avatar_url":"https://avatars.githubusercontent.com/u/6200624?v=3","gravatar_id":"","url":"https://api.github.com/users/gulpjs","html_url":"https://github.com/gulpjs","followers_url":"https://api.github.com/users/gulpjs/followers","following_url":"https://api.github.com/users/gulpjs/following{/other_user}","gists_url":"https://api.github.com/users/gulpjs/gists{/gist_id}","starred_url":"https://api.github.com/users/gulpjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gulpjs/subscriptions","organizations_url":"https://api.github.com/users/gulpjs/orgs","repos_url":"https://api.github.com/users/gulpjs/repos","events_url":"https://api.github.com/users/gulpjs/events{/privacy}","received_events_url":"https://api.github.com/users/gulpjs/received_events","type":"Organization","site_admin":false},"repo":{"id":15349676,"name":"vinyl","full_name":"gulpjs/vinyl","owner":{"login":"gulpjs","id":6200624,"avatar_url":"https://avatars.githubusercontent.com/u/6200624?v=3","gravatar_id":"","url":"https://api.github.com/users/gulpjs","html_url":"https://github.com/gulpjs","followers_url":"https://api.github.com/users/gulpjs/followers","following_url":"https://api.github.com/users/gulpjs/following{/other_user}","gists_url":"https://api.github.com/users/gulpjs/gists{/gist_id}","starred_url":"https://api.github.com/users/gulpjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gulpjs/subscriptions","organizations_url":"https://api.github.com/users/gulpjs/orgs","repos_url":"https://api.github.com/users/gulpjs/repos","events_url":"https://api.github.com/users/gulpjs/events{/privacy}","received_events_url":"https://api.github.com/users/gulpjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gulpjs/vinyl","description":"Virtual file format","fork":false,"url":"https://api.github.com/repos/gulpjs/vinyl","forks_url":"https://api.github.com/repos/gulpjs/vinyl/forks","keys_url":"https://api.github.com/repos/gulpjs/vinyl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gulpjs/vinyl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gulpjs/vinyl/teams","hooks_url":"https://api.github.com/repos/gulpjs/vinyl/hooks","issue_events_url":"https://api.github.com/repos/gulpjs/vinyl/issues/events{/number}","events_url":"https://api.github.com/repos/gulpjs/vinyl/events","assignees_url":"https://api.github.com/repos/gulpjs/vinyl/assignees{/user}","branches_url":"https://api.github.com/repos/gulpjs/vinyl/branches{/branch}","tags_url":"https://api.github.com/repos/gulpjs/vinyl/tags","blobs_url":"https://api.github.com/repos/gulpjs/vinyl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gulpjs/vinyl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gulpjs/vinyl/git/refs{/sha}","trees_url":"https://api.github.com/repos/gulpjs/vinyl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gulpjs/vinyl/statuses/{sha}","languages_url":"https://api.github.com/repos/gulpjs/vinyl/languages","stargazers_url":"https://api.github.com/repos/gulpjs/vinyl/stargazers","contributors_url":"https://api.github.com/repos/gulpjs/vinyl/contributors","subscribers_url":"https://api.github.com/repos/gulpjs/vinyl/subscribers","subscription_url":"https://api.github.com/repos/gulpjs/vinyl/subscription","commits_url":"https://api.github.com/repos/gulpjs/vinyl/commits{/sha}","git_commits_url":"https://api.github.com/repos/gulpjs/vinyl/git/commits{/sha}","comments_url":"https://api.github.com/repos/gulpjs/vinyl/comments{/number}","issue_comment_url":"https://api.github.com/repos/gulpjs/vinyl/issues/comments{/number}","contents_url":"https://api.github.com/repos/gulpjs/vinyl/contents/{+path}","compare_url":"https://api.github.com/repos/gulpjs/vinyl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gulpjs/vinyl/merges","archive_url":"https://api.github.com/repos/gulpjs/vinyl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gulpjs/vinyl/downloads","issues_url":"https://api.github.com/repos/gulpjs/vinyl/issues{/number}","pulls_url":"https://api.github.com/repos/gulpjs/vinyl/pulls{/number}","milestones_url":"https://api.github.com/repos/gulpjs/vinyl/milestones{/number}","notifications_url":"https://api.github.com/repos/gulpjs/vinyl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gulpjs/vinyl/labels{/name}","releases_url":"https://api.github.com/repos/gulpjs/vinyl/releases{/id}","deployments_url":"https://api.github.com/repos/gulpjs/vinyl/deployments","created_at":"2013-12-20T22:26:37Z","updated_at":"2016-06-18T17:32:23Z","pushed_at":"2016-06-13T22:57:53Z","git_url":"git://github.com/gulpjs/vinyl.git","ssh_url":"git@github.com:gulpjs/vinyl.git","clone_url":"https://github.com/gulpjs/vinyl.git","svn_url":"https://github.com/gulpjs/vinyl","homepage":null,"size":146,"stargazers_count":660,"watchers_count":660,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":9,"forks":45,"open_issues":9,"watchers":660,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gulpjs/vinyl/pulls/92"},"html":{"href":"https://github.com/gulpjs/vinyl/pull/92"},"issue":{"href":"https://api.github.com/repos/gulpjs/vinyl/issues/92"},"comments":{"href":"https://api.github.com/repos/gulpjs/vinyl/issues/92/comments"},"review_comments":{"href":"https://api.github.com/repos/gulpjs/vinyl/pulls/92/comments"},"review_comment":{"href":"https://api.github.com/repos/gulpjs/vinyl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gulpjs/vinyl/pulls/92/commits"},"statuses":{"href":"https://api.github.com/repos/gulpjs/vinyl/statuses/85a64dadf6851655042603574ffe5651e53bac40"}}}}
{"actor":{"display_login":"phated"}}