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

Function stringify

lib/index.es.js:8027–8044  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

8025}
8026
8027function 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 */
8047function 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…