(input)
| 8025 | } |
| 8026 | |
| 8027 | function stringify(input) { |
| 8028 | if (!input) { |
| 8029 | return 'undefined'; // backwards compat for empty reduce |
| 8030 | } |
| 8031 | // for backwards compat with mapreduce, functions/strings are stringified |
| 8032 | // as-is. everything else is JSON-stringified. |
| 8033 | switch (typeof input) { |
| 8034 | case 'function': |
| 8035 | // e.g. a mapreduce map |
| 8036 | return input.toString(); |
| 8037 | case 'string': |
| 8038 | // e.g. a mapreduce built-in _reduce function |
| 8039 | return input.toString(); |
| 8040 | default: |
| 8041 | // e.g. a JSON object in the case of mango queries |
| 8042 | return JSON.stringify(input); |
| 8043 | } |
| 8044 | } |
| 8045 | |
| 8046 | /* create a string signature for a view so we can cache it and uniq it */ |
| 8047 | function createViewSignature(mapFun, reduceFun) { |
no test coverage detected
searching dependent graphs…