MCPcopy
hub / github.com/angular-ui/ui-router / serializeObject

Function serializeObject

test/angular/1.6/angular.js:2659–2680  ·  view source on GitHub ↗
(obj, maxDepth)

Source from the content-addressed store, hash-verified

2657/* exported toDebugString */
2658
2659function serializeObject(obj, maxDepth) {
2660 var seen = [];
2661
2662 // There is no direct way to stringify object until reaching a specific depth
2663 // and a very deep object can cause a performance issue, so we copy the object
2664 // based on this specific depth and then stringify it.
2665 if (isValidObjectMaxDepth(maxDepth)) {
2666 // This file is also included in `angular-loader`, so `copy()` might not always be available in
2667 // the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed.
2668 obj = angular.copy(obj, null, maxDepth);
2669 }
2670 return JSON.stringify(obj, function(key, val) {
2671 val = toJsonReplacer(key, val);
2672 if (isObject(val)) {
2673
2674 if (seen.indexOf(val) >= 0) return '...';
2675
2676 seen.push(val);
2677 }
2678 return val;
2679 });
2680}
2681
2682function toDebugString(obj, maxDepth) {
2683 if (typeof obj === 'function') {

Callers 1

toDebugStringFunction · 0.70

Calls 3

isValidObjectMaxDepthFunction · 0.70
toJsonReplacerFunction · 0.70
isObjectFunction · 0.70

Tested by

no test coverage detected