(input)
| 7988 | } |
| 7989 | |
| 7990 | function stringify(input) { |
| 7991 | if (!input) { |
| 7992 | return 'undefined'; // backwards compat for empty reduce |
| 7993 | } |
| 7994 | // for backwards compat with mapreduce, functions/strings are stringified |
| 7995 | // as-is. everything else is JSON-stringified. |
| 7996 | switch (typeof input) { |
| 7997 | case 'function': |
| 7998 | // e.g. a mapreduce map |
| 7999 | return input.toString(); |
| 8000 | case 'string': |
| 8001 | // e.g. a mapreduce built-in _reduce function |
| 8002 | return input.toString(); |
| 8003 | default: |
| 8004 | // e.g. a JSON object in the case of mango queries |
| 8005 | return JSON.stringify(input); |
| 8006 | } |
| 8007 | } |
| 8008 | |
| 8009 | /* create a string signature for a view so we can cache it and uniq it */ |
| 8010 | function createViewSignature(mapFun, reduceFun) { |
no test coverage detected
searching dependent graphs…