MCPcopy
hub / github.com/apache/pouchdb / stringify

Function stringify

lib/index-browser.js:7994–8011  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

7992}
7993
7994function 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 */
8014function 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…