From 21444318cb5476297be246dae4091c41921eca07 Mon Sep 17 00:00:00 2001 From: terribleplan Date: Tue, 7 Jul 2015 23:50:07 -0500 Subject: [PATCH 1/2] Create README.md --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..84980fb --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +promise-map-object +==================== +A fairly common pattern is to use `_` to `map` an array into promises, then to call `Q.all` on that array. +This library takes that idea a little bit further and now allows you to map an object's values through promises. + +Usage +===== +```js +var pmo = require("promise-map-object"); + +var a = { + foo: {name: "asdf",age: {$gt: 13}}, + bar: {age:;{$lte: 13}} +} + +pmo(a, function(query) { + return db(query); //some database query promise, or similar +}).then(function(mappedA) { + console.log(mappedA); //res.json, or doing something else with it +}); +``` From 1789f73bcdae23ef661e30d5c72f0df64dea49d5 Mon Sep 17 00:00:00 2001 From: terribleplan Date: Tue, 7 Jul 2015 23:50:43 -0500 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 84980fb..b003405 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ Usage var pmo = require("promise-map-object"); var a = { - foo: {name: "asdf",age: {$gt: 13}}, - bar: {age:;{$lte: 13}} + foo: { name: "asdf", age: {$gt: 13} }, + bar: { age: {$lte: 13} } } pmo(a, function(query) {