mciparelli/co-redis — pull request #1 by creatorrr (2014-01-06 01:44:41+00:00)
Title: Return result from thunk

Modified thunk function to return result. This enables use of implementations that return streams or promises for instance [redis-scanstreams](https://github.com/brycebaril/redis-scanstreams).

Also generated new commands for redis 2.8.x

Example:
```javascript

var redis = require('redis-scanstreams')(require('redis')), // Extend redis to include a streaming scan implementation
client = require('co-redis')(redis.createClient()),
co = require('co');

co(function* () {
// Get all keys using keys command
yield client.keys('*');

// Get all keys using scan
yield buffer(client.scan({match: '*'})()); // Return stream
})();

function buffer(s) {
return function(done) {
var data = '';

s.on('data', function(chunk) { return data+=chunk; });
s.on('end', function() { return done(data); });
};
}
```