diff --git a/CHANGES b/CHANGES index 7e4bca2b..b53b3d53 100644 --- a/CHANGES +++ b/CHANGES @@ -5,7 +5,10 @@ Deprecations: please begin using the version of `defined` exported from the latter module. -Next Minor Version: +0.2.3 + - Added `keys` message to promises and to the promise API. + +0.2.2 - Added boilerplate to `q/queue` and `q/util`. - Fixed missing dependency to `q/queue`. diff --git a/lib/q.js b/lib/q.js index 36ff1eaf..3421112f 100644 --- a/lib/q.js +++ b/lib/q.js @@ -285,6 +285,9 @@ function ref(object) { if (!method) throw new Error("No such method " + name + " on object " + object); if (!method.apply) throw new Error("Property " + name + " on object " + object + " is not a method"); return object[name].apply(object, args); + }, + "keys": function () { + return Object.keys(object); } }, undefined, function valueOf() { return object; @@ -443,6 +446,14 @@ exports.del = Method("del"); */ exports.post = Method("post"); +/** + * Requests the names of the owned properties of a promised + * object in a future turn. + * @param object promise or immediate reference for target object + * @return promise for the keys of the eventually resolved object + */ +exports.keys = Method("keys"); + /** * Guarantees that the give promise resolves to a defined, non-null value. */ diff --git a/package.json b/package.json index 1df9891e..4472a7ae 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "q", "description": "defer/when-style promises (CommonJS/Promises/B)", - "version": "0.2.1", + "version": "0.2.3", "homepage": "http://github.com/kriskowal/q/", "author": "Kris Kowal (http://github.com/kriskowal/)", "contributors": [