Skip to content

Instantly share code, notes, and snippets.

@cj3kim cj3kim/gist:4142737
Created Nov 25, 2012

Embed
What would you like to do?
riak reduce function
function(values) {
var str = "";
for(var val in values) {
if (val.constructor == Object) {
for (var key in val) {
str += val[key];
}
} else {
str += val;
}
}
return [str];
}
@cj3kim

This comment has been minimized.

Copy link
Owner Author

commented Nov 25, 2012

["hello", "hello", "hello", "hello", {"key"=>"value"}, {"boo"=>"tired"}, "hello", "this is a test", {"key"=>"value"}, {"key"=>"value"}, {"hello"=>"world"}, "", "hello", {"bar"=>"baz"}, "hello", {"very"=>"tired"}, "this is a test", {"key"=>"value"}, {"key"=>"value"}, "hello", "hello", {"person1"=>{"first_name"=>"Carol", "last_name"=>"Chan"}}, "key=value", {"hello"=>"world"}, {"key"=>"value"}, "hello", {"woof"=>"i love you"}, {"hello"=>"world"}, {"key"=>"value"}, "", "hello", "hello", {"key"=>"value"}, "this is a test", {"key"=>"value"}, "hello", "this is a test", {"hello"=>"world"}, {"hello"=>"world"}, {"key"=>"value"}, {"lol"=>"lol)\n"}, {"key"=>"value"}, "hello", "hello", "hello", {"key"=>"value"}, "hello", "hello", "hello", {"meow"=>"very awake"}, {"key"=>"value"}, {"hello"=>"awake"}, "hello", "hello", {"key"=>"value"}, "hello", "hello"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.