{"action":"created","comment":{"url":"https://api.github.com/repos/hapijs/hoek/pulls/comments/65065441","id":65065441,"diff_hunk":"@@ -974,3 +984,23 @@ exports.shallow = function (source) {\n \n     return target;\n };\n+\n+\n+exports.promiseWrap = function (bind, method, args, transform) {\n+\n+    return new Promise((resolve, reject) => {\n+\n+        const callback = function (error, result) {\n+\n+            if (Array.isArray(transform)) {\n+                result = exports.transform(Array.from(arguments), transform);\n+                error instanceof Error ? reject(result) : resolve(result);","path":"lib/index.js","position":31,"original_position":31,"commit_id":"be2b72330dccd1d01015e8182377cc139e55ca86","original_commit_id":"be2b72330dccd1d01015e8182377cc139e55ca86","user":{"login":"catalint","id":787730,"avatar_url":"https://avatars.githubusercontent.com/u/787730?v=3","gravatar_id":"","url":"https://api.github.com/users/catalint","html_url":"https://github.com/catalint","followers_url":"https://api.github.com/users/catalint/followers","following_url":"https://api.github.com/users/catalint/following{/other_user}","gists_url":"https://api.github.com/users/catalint/gists{/gist_id}","starred_url":"https://api.github.com/users/catalint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catalint/subscriptions","organizations_url":"https://api.github.com/users/catalint/orgs","repos_url":"https://api.github.com/users/catalint/repos","events_url":"https://api.github.com/users/catalint/events{/privacy}","received_events_url":"https://api.github.com/users/catalint/received_events","type":"User","site_admin":false},"body":"it's good to be there for such use cases https://github.com/hapijs/catbox/blob/master/lib/policy.js#L217 when sending an error but also some other data","created_at":"2016-05-30T12:31:00Z","updated_at":"2016-05-30T12:31:00Z","html_url":"https://github.com/hapijs/hoek/pull/188#discussion_r65065441","pull_request_url":"https://api.github.com/repos/hapijs/hoek/pulls/188","_links":{"self":{"href":"https://api.github.com/repos/hapijs/hoek/pulls/comments/65065441"},"html":{"href":"https://github.com/hapijs/hoek/pull/188#discussion_r65065441"},"pull_request":{"href":"https://api.github.com/repos/hapijs/hoek/pulls/188"}}},"pull_request":{"url":"https://api.github.com/repos/hapijs/hoek/pulls/188","id":67858220,"html_url":"https://github.com/hapijs/hoek/pull/188","diff_url":"https://github.com/hapijs/hoek/pull/188.diff","patch_url":"https://github.com/hapijs/hoek/pull/188.patch","issue_url":"https://api.github.com/repos/hapijs/hoek/issues/188","number":188,"state":"open","locked":false,"title":".wrap complex","user":{"login":"catalint","id":787730,"avatar_url":"https://avatars.githubusercontent.com/u/787730?v=3","gravatar_id":"","url":"https://api.github.com/users/catalint","html_url":"https://github.com/catalint","followers_url":"https://api.github.com/users/catalint/followers","following_url":"https://api.github.com/users/catalint/following{/other_user}","gists_url":"https://api.github.com/users/catalint/gists{/gist_id}","starred_url":"https://api.github.com/users/catalint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catalint/subscriptions","organizations_url":"https://api.github.com/users/catalint/orgs","repos_url":"https://api.github.com/users/catalint/repos","events_url":"https://api.github.com/users/catalint/events{/privacy}","received_events_url":"https://api.github.com/users/catalint/received_events","type":"User","site_admin":false},"body":"beside the simple wrap from hapi , this also allows optional promise wrapping of methods that have `callback(error,multiple,params)`\r\n\r\n```js\r\nconst bar = function (options, callback) {\r\n\r\n    if (!callback) {\r\n        return Hoek.promiseWrap(this, bar, [options], ['error', 'value']);\r\n    }\r\n\r\n    callback(null, 'success');\r\n};\r\n\r\nreturn bar().then((result) => {\r\n\r\n    // result is {error: null , value: 'success'}\r\n});\r\n```\r\n\r\nhad to also add to `.tranform` this ability ... don't know if I could of done this in another way\r\n```js\r\nconst result = Hoek.transform([1, 2, 3], ['a', 'b', 'c']);\r\n// Results in { a: 1, b: 2, c: 3 }\r\n```\r\n\r\nhttps://github.com/hapijs/hoek/issues/176","created_at":"2016-04-26T10:03:17Z","updated_at":"2016-05-30T12:31:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1cc90412c6be78aa8266bb4bb5ac064bb5b4091","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hapijs/hoek/pulls/188/commits","review_comments_url":"https://api.github.com/repos/hapijs/hoek/pulls/188/comments","review_comment_url":"https://api.github.com/repos/hapijs/hoek/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hapijs/hoek/issues/188/comments","statuses_url":"https://api.github.com/repos/hapijs/hoek/statuses/be2b72330dccd1d01015e8182377cc139e55ca86","head":{"label":"catalint:feature/wrap-complex","ref":"feature/wrap-complex","sha":"be2b72330dccd1d01015e8182377cc139e55ca86","user":{"login":"catalint","id":787730,"avatar_url":"https://avatars.githubusercontent.com/u/787730?v=3","gravatar_id":"","url":"https://api.github.com/users/catalint","html_url":"https://github.com/catalint","followers_url":"https://api.github.com/users/catalint/followers","following_url":"https://api.github.com/users/catalint/following{/other_user}","gists_url":"https://api.github.com/users/catalint/gists{/gist_id}","starred_url":"https://api.github.com/users/catalint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catalint/subscriptions","organizations_url":"https://api.github.com/users/catalint/orgs","repos_url":"https://api.github.com/users/catalint/repos","events_url":"https://api.github.com/users/catalint/events{/privacy}","received_events_url":"https://api.github.com/users/catalint/received_events","type":"User","site_admin":false},"repo":{"id":55477886,"name":"hoek","full_name":"catalint/hoek","owner":{"login":"catalint","id":787730,"avatar_url":"https://avatars.githubusercontent.com/u/787730?v=3","gravatar_id":"","url":"https://api.github.com/users/catalint","html_url":"https://github.com/catalint","followers_url":"https://api.github.com/users/catalint/followers","following_url":"https://api.github.com/users/catalint/following{/other_user}","gists_url":"https://api.github.com/users/catalint/gists{/gist_id}","starred_url":"https://api.github.com/users/catalint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catalint/subscriptions","organizations_url":"https://api.github.com/users/catalint/orgs","repos_url":"https://api.github.com/users/catalint/repos","events_url":"https://api.github.com/users/catalint/events{/privacy}","received_events_url":"https://api.github.com/users/catalint/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/catalint/hoek","description":"Node utilities shared amongst the extended hapi universe","fork":true,"url":"https://api.github.com/repos/catalint/hoek","forks_url":"https://api.github.com/repos/catalint/hoek/forks","keys_url":"https://api.github.com/repos/catalint/hoek/keys{/key_id}","collaborators_url":"https://api.github.com/repos/catalint/hoek/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/catalint/hoek/teams","hooks_url":"https://api.github.com/repos/catalint/hoek/hooks","issue_events_url":"https://api.github.com/repos/catalint/hoek/issues/events{/number}","events_url":"https://api.github.com/repos/catalint/hoek/events","assignees_url":"https://api.github.com/repos/catalint/hoek/assignees{/user}","branches_url":"https://api.github.com/repos/catalint/hoek/branches{/branch}","tags_url":"https://api.github.com/repos/catalint/hoek/tags","blobs_url":"https://api.github.com/repos/catalint/hoek/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/catalint/hoek/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/catalint/hoek/git/refs{/sha}","trees_url":"https://api.github.com/repos/catalint/hoek/git/trees{/sha}","statuses_url":"https://api.github.com/repos/catalint/hoek/statuses/{sha}","languages_url":"https://api.github.com/repos/catalint/hoek/languages","stargazers_url":"https://api.github.com/repos/catalint/hoek/stargazers","contributors_url":"https://api.github.com/repos/catalint/hoek/contributors","subscribers_url":"https://api.github.com/repos/catalint/hoek/subscribers","subscription_url":"https://api.github.com/repos/catalint/hoek/subscription","commits_url":"https://api.github.com/repos/catalint/hoek/commits{/sha}","git_commits_url":"https://api.github.com/repos/catalint/hoek/git/commits{/sha}","comments_url":"https://api.github.com/repos/catalint/hoek/comments{/number}","issue_comment_url":"https://api.github.com/repos/catalint/hoek/issues/comments{/number}","contents_url":"https://api.github.com/repos/catalint/hoek/contents/{+path}","compare_url":"https://api.github.com/repos/catalint/hoek/compare/{base}...{head}","merges_url":"https://api.github.com/repos/catalint/hoek/merges","archive_url":"https://api.github.com/repos/catalint/hoek/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/catalint/hoek/downloads","issues_url":"https://api.github.com/repos/catalint/hoek/issues{/number}","pulls_url":"https://api.github.com/repos/catalint/hoek/pulls{/number}","milestones_url":"https://api.github.com/repos/catalint/hoek/milestones{/number}","notifications_url":"https://api.github.com/repos/catalint/hoek/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/catalint/hoek/labels{/name}","releases_url":"https://api.github.com/repos/catalint/hoek/releases{/id}","deployments_url":"https://api.github.com/repos/catalint/hoek/deployments","created_at":"2016-04-05T07:37:18Z","updated_at":"2016-04-05T07:37:19Z","pushed_at":"2016-05-30T11:07:33Z","git_url":"git://github.com/catalint/hoek.git","ssh_url":"git@github.com:catalint/hoek.git","clone_url":"https://github.com/catalint/hoek.git","svn_url":"https://github.com/catalint/hoek","homepage":"","size":672,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"hapijs:master","ref":"master","sha":"6c18f05d1ea82b109439bf2d519acc14ac716c5f","user":{"login":"hapijs","id":3774533,"avatar_url":"https://avatars.githubusercontent.com/u/3774533?v=3","gravatar_id":"","url":"https://api.github.com/users/hapijs","html_url":"https://github.com/hapijs","followers_url":"https://api.github.com/users/hapijs/followers","following_url":"https://api.github.com/users/hapijs/following{/other_user}","gists_url":"https://api.github.com/users/hapijs/gists{/gist_id}","starred_url":"https://api.github.com/users/hapijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapijs/subscriptions","organizations_url":"https://api.github.com/users/hapijs/orgs","repos_url":"https://api.github.com/users/hapijs/repos","events_url":"https://api.github.com/users/hapijs/events{/privacy}","received_events_url":"https://api.github.com/users/hapijs/received_events","type":"Organization","site_admin":false},"repo":{"id":5831189,"name":"hoek","full_name":"hapijs/hoek","owner":{"login":"hapijs","id":3774533,"avatar_url":"https://avatars.githubusercontent.com/u/3774533?v=3","gravatar_id":"","url":"https://api.github.com/users/hapijs","html_url":"https://github.com/hapijs","followers_url":"https://api.github.com/users/hapijs/followers","following_url":"https://api.github.com/users/hapijs/following{/other_user}","gists_url":"https://api.github.com/users/hapijs/gists{/gist_id}","starred_url":"https://api.github.com/users/hapijs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hapijs/subscriptions","organizations_url":"https://api.github.com/users/hapijs/orgs","repos_url":"https://api.github.com/users/hapijs/repos","events_url":"https://api.github.com/users/hapijs/events{/privacy}","received_events_url":"https://api.github.com/users/hapijs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hapijs/hoek","description":"Node utilities shared amongst the extended hapi universe","fork":false,"url":"https://api.github.com/repos/hapijs/hoek","forks_url":"https://api.github.com/repos/hapijs/hoek/forks","keys_url":"https://api.github.com/repos/hapijs/hoek/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hapijs/hoek/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hapijs/hoek/teams","hooks_url":"https://api.github.com/repos/hapijs/hoek/hooks","issue_events_url":"https://api.github.com/repos/hapijs/hoek/issues/events{/number}","events_url":"https://api.github.com/repos/hapijs/hoek/events","assignees_url":"https://api.github.com/repos/hapijs/hoek/assignees{/user}","branches_url":"https://api.github.com/repos/hapijs/hoek/branches{/branch}","tags_url":"https://api.github.com/repos/hapijs/hoek/tags","blobs_url":"https://api.github.com/repos/hapijs/hoek/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hapijs/hoek/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hapijs/hoek/git/refs{/sha}","trees_url":"https://api.github.com/repos/hapijs/hoek/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hapijs/hoek/statuses/{sha}","languages_url":"https://api.github.com/repos/hapijs/hoek/languages","stargazers_url":"https://api.github.com/repos/hapijs/hoek/stargazers","contributors_url":"https://api.github.com/repos/hapijs/hoek/contributors","subscribers_url":"https://api.github.com/repos/hapijs/hoek/subscribers","subscription_url":"https://api.github.com/repos/hapijs/hoek/subscription","commits_url":"https://api.github.com/repos/hapijs/hoek/commits{/sha}","git_commits_url":"https://api.github.com/repos/hapijs/hoek/git/commits{/sha}","comments_url":"https://api.github.com/repos/hapijs/hoek/comments{/number}","issue_comment_url":"https://api.github.com/repos/hapijs/hoek/issues/comments{/number}","contents_url":"https://api.github.com/repos/hapijs/hoek/contents/{+path}","compare_url":"https://api.github.com/repos/hapijs/hoek/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hapijs/hoek/merges","archive_url":"https://api.github.com/repos/hapijs/hoek/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hapijs/hoek/downloads","issues_url":"https://api.github.com/repos/hapijs/hoek/issues{/number}","pulls_url":"https://api.github.com/repos/hapijs/hoek/pulls{/number}","milestones_url":"https://api.github.com/repos/hapijs/hoek/milestones{/number}","notifications_url":"https://api.github.com/repos/hapijs/hoek/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hapijs/hoek/labels{/name}","releases_url":"https://api.github.com/repos/hapijs/hoek/releases{/id}","deployments_url":"https://api.github.com/repos/hapijs/hoek/deployments","created_at":"2012-09-16T17:07:35Z","updated_at":"2016-05-24T03:58:38Z","pushed_at":"2016-05-30T11:07:33Z","git_url":"git://github.com/hapijs/hoek.git","ssh_url":"git@github.com:hapijs/hoek.git","clone_url":"https://github.com/hapijs/hoek.git","svn_url":"https://github.com/hapijs/hoek","homepage":"","size":819,"stargazers_count":224,"watchers_count":224,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":55,"mirror_url":null,"open_issues_count":3,"forks":55,"open_issues":3,"watchers":224,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hapijs/hoek/pulls/188"},"html":{"href":"https://github.com/hapijs/hoek/pull/188"},"issue":{"href":"https://api.github.com/repos/hapijs/hoek/issues/188"},"comments":{"href":"https://api.github.com/repos/hapijs/hoek/issues/188/comments"},"review_comments":{"href":"https://api.github.com/repos/hapijs/hoek/pulls/188/comments"},"review_comment":{"href":"https://api.github.com/repos/hapijs/hoek/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hapijs/hoek/pulls/188/commits"},"statuses":{"href":"https://api.github.com/repos/hapijs/hoek/statuses/be2b72330dccd1d01015e8182377cc139e55ca86"}}}}
{"actor":{"display_login":"catalint"}}