{"action":"closed","number":15,"pull_request":{"url":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls/15","id":156005517,"html_url":"https://github.com/Phil-Factor/PSYaml/pull/15","diff_url":"https://github.com/Phil-Factor/PSYaml/pull/15.diff","patch_url":"https://github.com/Phil-Factor/PSYaml/pull/15.patch","issue_url":"https://api.github.com/repos/Phil-Factor/PSYaml/issues/15","number":15,"state":"closed","locked":false,"title":"Fix issue #13 'Single-element arrays are not preserved'","user":{"login":"vyrp","id":3949802,"avatar_url":"https://avatars0.githubusercontent.com/u/3949802?v=4","gravatar_id":"","url":"https://api.github.com/users/vyrp","html_url":"https://github.com/vyrp","followers_url":"https://api.github.com/users/vyrp/followers","following_url":"https://api.github.com/users/vyrp/following{/other_user}","gists_url":"https://api.github.com/users/vyrp/gists{/gist_id}","starred_url":"https://api.github.com/users/vyrp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vyrp/subscriptions","organizations_url":"https://api.github.com/users/vyrp/orgs","repos_url":"https://api.github.com/users/vyrp/repos","events_url":"https://api.github.com/users/vyrp/events{/privacy}","received_events_url":"https://api.github.com/users/vyrp/received_events","type":"User","site_admin":false},"body":"In Powershell, if a function returns an array of only one element, it gets unwrapped. This is the root cause of issue #13.\r\n\r\nThis Pull Request fixes it by correctly returning the array.\r\n\r\nSimple example:\r\n\r\n```powershell\r\nfunction F($l) { return $l }\r\n\r\n$result = F(@(\"a\", \"b\"))\r\n$result                     # a\r\n                            # b\r\n$result.GetType().Name      # Object[]\r\n$result[0].GetType().Name   # String\r\n\r\n$result = F(@(\"a\"))\r\n$result                     # a\r\n$result.GetType().Name      # String (Ouch!)\r\n\r\n$result = F(@())\r\n$result                     #\r\n$result.GetType().Name      # ERROR! You cannot call a method on a null-valued expression.\r\n```\r\n```powershell\r\nfunction Better-F($l) { return ,$l }\r\n\r\n$result = Better-F(@(\"a\", \"b\"))\r\n$result                     # a\r\n                            # b\r\n$result.GetType().Name      # Object[]\r\n$result[0].GetType().Name   # String\r\n\r\n$result = Better-F(@(\"a\"))\r\n$result                     # a\r\n$result.GetType().Name      # Object[] (FIXED!)\r\n$result[0].GetType().Name   # String\r\n\r\n$result = Better-F(@())\r\n$result                     #\r\n$result.GetType().Name      # Object[]\r\n```","created_at":"2017-12-02T08:38:47Z","updated_at":"2017-12-02T15:06:37Z","closed_at":"2017-12-02T15:06:37Z","merged_at":"2017-12-02T15:06:37Z","merge_commit_sha":"4a2756c0cb76b2a3404f5eac0a9289eb3b9210e4","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls/15/commits","review_comments_url":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls/15/comments","review_comment_url":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Phil-Factor/PSYaml/issues/15/comments","statuses_url":"https://api.github.com/repos/Phil-Factor/PSYaml/statuses/5a0a303a6c627ee2fc47186d4744d23fe27d1e6e","head":{"label":"vyrp:master","ref":"master","sha":"5a0a303a6c627ee2fc47186d4744d23fe27d1e6e","user":{"login":"vyrp","id":3949802,"avatar_url":"https://avatars0.githubusercontent.com/u/3949802?v=4","gravatar_id":"","url":"https://api.github.com/users/vyrp","html_url":"https://github.com/vyrp","followers_url":"https://api.github.com/users/vyrp/followers","following_url":"https://api.github.com/users/vyrp/following{/other_user}","gists_url":"https://api.github.com/users/vyrp/gists{/gist_id}","starred_url":"https://api.github.com/users/vyrp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vyrp/subscriptions","organizations_url":"https://api.github.com/users/vyrp/orgs","repos_url":"https://api.github.com/users/vyrp/repos","events_url":"https://api.github.com/users/vyrp/events{/privacy}","received_events_url":"https://api.github.com/users/vyrp/received_events","type":"User","site_admin":false},"repo":{"id":112824645,"name":"PSYaml","full_name":"vyrp/PSYaml","owner":{"login":"vyrp","id":3949802,"avatar_url":"https://avatars0.githubusercontent.com/u/3949802?v=4","gravatar_id":"","url":"https://api.github.com/users/vyrp","html_url":"https://github.com/vyrp","followers_url":"https://api.github.com/users/vyrp/followers","following_url":"https://api.github.com/users/vyrp/following{/other_user}","gists_url":"https://api.github.com/users/vyrp/gists{/gist_id}","starred_url":"https://api.github.com/users/vyrp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vyrp/subscriptions","organizations_url":"https://api.github.com/users/vyrp/orgs","repos_url":"https://api.github.com/users/vyrp/repos","events_url":"https://api.github.com/users/vyrp/events{/privacy}","received_events_url":"https://api.github.com/users/vyrp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vyrp/PSYaml","description":"A Powershell module to convert YAML documents to and from PowerShell objects","fork":true,"url":"https://api.github.com/repos/vyrp/PSYaml","forks_url":"https://api.github.com/repos/vyrp/PSYaml/forks","keys_url":"https://api.github.com/repos/vyrp/PSYaml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vyrp/PSYaml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vyrp/PSYaml/teams","hooks_url":"https://api.github.com/repos/vyrp/PSYaml/hooks","issue_events_url":"https://api.github.com/repos/vyrp/PSYaml/issues/events{/number}","events_url":"https://api.github.com/repos/vyrp/PSYaml/events","assignees_url":"https://api.github.com/repos/vyrp/PSYaml/assignees{/user}","branches_url":"https://api.github.com/repos/vyrp/PSYaml/branches{/branch}","tags_url":"https://api.github.com/repos/vyrp/PSYaml/tags","blobs_url":"https://api.github.com/repos/vyrp/PSYaml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vyrp/PSYaml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vyrp/PSYaml/git/refs{/sha}","trees_url":"https://api.github.com/repos/vyrp/PSYaml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vyrp/PSYaml/statuses/{sha}","languages_url":"https://api.github.com/repos/vyrp/PSYaml/languages","stargazers_url":"https://api.github.com/repos/vyrp/PSYaml/stargazers","contributors_url":"https://api.github.com/repos/vyrp/PSYaml/contributors","subscribers_url":"https://api.github.com/repos/vyrp/PSYaml/subscribers","subscription_url":"https://api.github.com/repos/vyrp/PSYaml/subscription","commits_url":"https://api.github.com/repos/vyrp/PSYaml/commits{/sha}","git_commits_url":"https://api.github.com/repos/vyrp/PSYaml/git/commits{/sha}","comments_url":"https://api.github.com/repos/vyrp/PSYaml/comments{/number}","issue_comment_url":"https://api.github.com/repos/vyrp/PSYaml/issues/comments{/number}","contents_url":"https://api.github.com/repos/vyrp/PSYaml/contents/{+path}","compare_url":"https://api.github.com/repos/vyrp/PSYaml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vyrp/PSYaml/merges","archive_url":"https://api.github.com/repos/vyrp/PSYaml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vyrp/PSYaml/downloads","issues_url":"https://api.github.com/repos/vyrp/PSYaml/issues{/number}","pulls_url":"https://api.github.com/repos/vyrp/PSYaml/pulls{/number}","milestones_url":"https://api.github.com/repos/vyrp/PSYaml/milestones{/number}","notifications_url":"https://api.github.com/repos/vyrp/PSYaml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vyrp/PSYaml/labels{/name}","releases_url":"https://api.github.com/repos/vyrp/PSYaml/releases{/id}","deployments_url":"https://api.github.com/repos/vyrp/PSYaml/deployments","created_at":"2017-12-02T08:09:39Z","updated_at":"2017-12-02T08:09:41Z","pushed_at":"2017-12-02T08:22:23Z","git_url":"git://github.com/vyrp/PSYaml.git","ssh_url":"git@github.com:vyrp/PSYaml.git","clone_url":"https://github.com/vyrp/PSYaml.git","svn_url":"https://github.com/vyrp/PSYaml","homepage":null,"size":161,"stargazers_count":0,"watchers_count":0,"language":"PowerShell","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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Phil-Factor:master","ref":"master","sha":"4a00d1665a7cefaa7c8f85beba56e25864856252","user":{"login":"Phil-Factor","id":917048,"avatar_url":"https://avatars0.githubusercontent.com/u/917048?v=4","gravatar_id":"","url":"https://api.github.com/users/Phil-Factor","html_url":"https://github.com/Phil-Factor","followers_url":"https://api.github.com/users/Phil-Factor/followers","following_url":"https://api.github.com/users/Phil-Factor/following{/other_user}","gists_url":"https://api.github.com/users/Phil-Factor/gists{/gist_id}","starred_url":"https://api.github.com/users/Phil-Factor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phil-Factor/subscriptions","organizations_url":"https://api.github.com/users/Phil-Factor/orgs","repos_url":"https://api.github.com/users/Phil-Factor/repos","events_url":"https://api.github.com/users/Phil-Factor/events{/privacy}","received_events_url":"https://api.github.com/users/Phil-Factor/received_events","type":"User","site_admin":false},"repo":{"id":67434095,"name":"PSYaml","full_name":"Phil-Factor/PSYaml","owner":{"login":"Phil-Factor","id":917048,"avatar_url":"https://avatars0.githubusercontent.com/u/917048?v=4","gravatar_id":"","url":"https://api.github.com/users/Phil-Factor","html_url":"https://github.com/Phil-Factor","followers_url":"https://api.github.com/users/Phil-Factor/followers","following_url":"https://api.github.com/users/Phil-Factor/following{/other_user}","gists_url":"https://api.github.com/users/Phil-Factor/gists{/gist_id}","starred_url":"https://api.github.com/users/Phil-Factor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phil-Factor/subscriptions","organizations_url":"https://api.github.com/users/Phil-Factor/orgs","repos_url":"https://api.github.com/users/Phil-Factor/repos","events_url":"https://api.github.com/users/Phil-Factor/events{/privacy}","received_events_url":"https://api.github.com/users/Phil-Factor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Phil-Factor/PSYaml","description":"A Powershell module to convert YAML documents to and from PowerShell objects","fork":false,"url":"https://api.github.com/repos/Phil-Factor/PSYaml","forks_url":"https://api.github.com/repos/Phil-Factor/PSYaml/forks","keys_url":"https://api.github.com/repos/Phil-Factor/PSYaml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Phil-Factor/PSYaml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Phil-Factor/PSYaml/teams","hooks_url":"https://api.github.com/repos/Phil-Factor/PSYaml/hooks","issue_events_url":"https://api.github.com/repos/Phil-Factor/PSYaml/issues/events{/number}","events_url":"https://api.github.com/repos/Phil-Factor/PSYaml/events","assignees_url":"https://api.github.com/repos/Phil-Factor/PSYaml/assignees{/user}","branches_url":"https://api.github.com/repos/Phil-Factor/PSYaml/branches{/branch}","tags_url":"https://api.github.com/repos/Phil-Factor/PSYaml/tags","blobs_url":"https://api.github.com/repos/Phil-Factor/PSYaml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Phil-Factor/PSYaml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Phil-Factor/PSYaml/git/refs{/sha}","trees_url":"https://api.github.com/repos/Phil-Factor/PSYaml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Phil-Factor/PSYaml/statuses/{sha}","languages_url":"https://api.github.com/repos/Phil-Factor/PSYaml/languages","stargazers_url":"https://api.github.com/repos/Phil-Factor/PSYaml/stargazers","contributors_url":"https://api.github.com/repos/Phil-Factor/PSYaml/contributors","subscribers_url":"https://api.github.com/repos/Phil-Factor/PSYaml/subscribers","subscription_url":"https://api.github.com/repos/Phil-Factor/PSYaml/subscription","commits_url":"https://api.github.com/repos/Phil-Factor/PSYaml/commits{/sha}","git_commits_url":"https://api.github.com/repos/Phil-Factor/PSYaml/git/commits{/sha}","comments_url":"https://api.github.com/repos/Phil-Factor/PSYaml/comments{/number}","issue_comment_url":"https://api.github.com/repos/Phil-Factor/PSYaml/issues/comments{/number}","contents_url":"https://api.github.com/repos/Phil-Factor/PSYaml/contents/{+path}","compare_url":"https://api.github.com/repos/Phil-Factor/PSYaml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Phil-Factor/PSYaml/merges","archive_url":"https://api.github.com/repos/Phil-Factor/PSYaml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Phil-Factor/PSYaml/downloads","issues_url":"https://api.github.com/repos/Phil-Factor/PSYaml/issues{/number}","pulls_url":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls{/number}","milestones_url":"https://api.github.com/repos/Phil-Factor/PSYaml/milestones{/number}","notifications_url":"https://api.github.com/repos/Phil-Factor/PSYaml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Phil-Factor/PSYaml/labels{/name}","releases_url":"https://api.github.com/repos/Phil-Factor/PSYaml/releases{/id}","deployments_url":"https://api.github.com/repos/Phil-Factor/PSYaml/deployments","created_at":"2016-09-05T16:01:02Z","updated_at":"2017-12-02T09:22:25Z","pushed_at":"2017-12-02T15:06:37Z","git_url":"git://github.com/Phil-Factor/PSYaml.git","ssh_url":"git@github.com:Phil-Factor/PSYaml.git","clone_url":"https://github.com/Phil-Factor/PSYaml.git","svn_url":"https://github.com/Phil-Factor/PSYaml","homepage":null,"size":204,"stargazers_count":24,"watchers_count":24,"language":"PowerShell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":9,"license":null,"forks":12,"open_issues":9,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls/15"},"html":{"href":"https://github.com/Phil-Factor/PSYaml/pull/15"},"issue":{"href":"https://api.github.com/repos/Phil-Factor/PSYaml/issues/15"},"comments":{"href":"https://api.github.com/repos/Phil-Factor/PSYaml/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Phil-Factor/PSYaml/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/Phil-Factor/PSYaml/statuses/5a0a303a6c627ee2fc47186d4744d23fe27d1e6e"}},"author_association":"NONE","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"Phil-Factor","id":917048,"avatar_url":"https://avatars0.githubusercontent.com/u/917048?v=4","gravatar_id":"","url":"https://api.github.com/users/Phil-Factor","html_url":"https://github.com/Phil-Factor","followers_url":"https://api.github.com/users/Phil-Factor/followers","following_url":"https://api.github.com/users/Phil-Factor/following{/other_user}","gists_url":"https://api.github.com/users/Phil-Factor/gists{/gist_id}","starred_url":"https://api.github.com/users/Phil-Factor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phil-Factor/subscriptions","organizations_url":"https://api.github.com/users/Phil-Factor/orgs","repos_url":"https://api.github.com/users/Phil-Factor/repos","events_url":"https://api.github.com/users/Phil-Factor/events{/privacy}","received_events_url":"https://api.github.com/users/Phil-Factor/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":1,"deletions":0,"changed_files":1}}
{"actor":{"display_login":"Phil-Factor"}}