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

Function serializeObject

lib/test/angular/1.6.7/angular.js:2643–2664  ·  view source on GitHub ↗
(obj, maxDepth)

Source from the content-addressed store, hash-verified

2641/* exported toDebugString */
2642
2643function serializeObject(obj, maxDepth) {
2644 var seen = [];
2645
2646 // There is no direct way to stringify object until reaching a specific depth
2647 // and a very deep object can cause a performance issue, so we copy the object
2648 // based on this specific depth and then stringify it.
2649 if (isValidObjectMaxDepth(maxDepth)) {
2650 // This file is also included in `angular-loader`, so `copy()` might not always be available in
2651 // the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed.
2652 obj = angular.copy(obj, null, maxDepth);
2653 }
2654 return JSON.stringify(obj, function(key, val) {
2655 val = toJsonReplacer(key, val);
2656 if (isObject(val)) {
2657
2658 if (seen.indexOf(val) >= 0) return '...';
2659
2660 seen.push(val);
2661 }
2662 return val;
2663 });
2664}
2665
2666function toDebugString(obj, maxDepth) {
2667 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