Skip to content

Instantly share code, notes, and snippets.

@goog
Created November 22, 2012 03:34
Show Gist options
  • Save goog/4129321 to your computer and use it in GitHub Desktop.
Save goog/4129321 to your computer and use it in GitHub Desktop.
"lists": "{\"likes\": \" function(head,req){ \n\tvar row;\n\tvar likes = req.like.split(\" \"); \n\twhile(row=getRow()) {\n\t keys= row.key.split(\" \"); \n\t for (var i=0;i<likes.length;i++) {\n\t if(keys.indexOf(likes[i]) != -1) \n\t\t{send(row); break;}\n\t\t}\n\t}}\"\n}"
{"likes": " function(head,req){
var row;
var likes = req.like.split(" ");
while(row=getRow()) {
keys= row.key.split(" ");
for (var i=0;i<likes.length;i++) {
if(keys.indexOf(likes[i]) != -1)
{send(row); break;}
}
}}"
}
Note: Try to avoid backslash + double quote and new lines in the design function using temporary views. Using them will raise the error "JSON.parse: bad control character in string literal".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment