{"comment":{"created_at":"2011-10-12T19:28:19Z","body":"There are a couple functions recently added to assist in this case.\r\n\r\n```javascript\r\nreturn Q.ncall(doSomething, a, b)\r\n```\r\n\r\nOr\r\n\r\n```javascript\r\nreturn Q.node(doSomething)(a, b)\r\n```\r\n\r\nI have been playing with the idea of adding deferred.node() like your suggestion for a couple days. I’ll keep that in mind, but I hope that these functions help for now.\r\n","updated_at":"2011-10-12T19:28:19Z","url":"https://api.github.com/repos/kriskowal/q/issues/comments/2383352","id":2383352,"user":{"avatar_url":"https://secure.gravatar.com/avatar/3c6753e1e589735a0a3a6d417d9553cd?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/kriskowal","id":60294,"login":"kriskowal"}},"action":"created","issue":{"number":27,"created_at":"2011-10-12T18:54:57Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"I often find myself wrapping Node-style API methods in promises, and doing something like the following:\r\n\r\n```javascript\r\n var def = Q.defer();\r\n doSomething(a, b, function(err, result) {\r\n    if (err) {\r\n        def.reject(err);\r\n    } else {\r\n        def.resolve(result);\r\n    }\r\n });\r\n return def.promise;\r\n```\r\n\r\nIt would be great if I could do this instead:\r\n\r\n```javascript\r\nvar def = Q.defer();\r\ndoSomething(a, b, def.callback());\r\nreturn def.promise;\r\n```\r\n\r\nWould that be possible?","comments":1,"title":"feature request: deferred provides Node-style callback","updated_at":"2011-10-12T19:28:19Z","url":"https://api.github.com/repos/kriskowal/q/issues/27","id":1890834,"assignee":null,"milestone":null,"closed_at":"2011-10-12T19:28:19Z","user":{"avatar_url":"https://secure.gravatar.com/avatar/43f5704396907367804661fad69f8193?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","url":"https://api.github.com/users/csosborn","id":180079,"login":"csosborn"},"html_url":"https://github.com/kriskowal/q/issues/27","labels":[],"state":"closed"},"legacy":{"issue_id":1890834,"comment_id":2383352}}