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