MCPcopy Index your code
hub / github.com/apache/pouchdb / stringify

Function stringify

lib/index.js:8032–8049  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

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

Callers 1

createViewSignatureFunction · 0.70

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…