Skip to content

Instantly share code, notes, and snippets.

@cj3kim
Created November 25, 2012 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cj3kim/4142737 to your computer and use it in GitHub Desktop.
Save cj3kim/4142737 to your computer and use it in GitHub Desktop.
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
Copy link
Author

cj3kim 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