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

Function serializeObject

lib/test/angular/1.8.0/angular.js:2678–2699  ·  view source on GitHub ↗
(obj, maxDepth)

Source from the content-addressed store, hash-verified

2676/* exported toDebugString */
2677
2678function serializeObject(obj, maxDepth) {
2679 var seen = [];
2680
2681 // There is no direct way to stringify object until reaching a specific depth
2682 // and a very deep object can cause a performance issue, so we copy the object
2683 // based on this specific depth and then stringify it.
2684 if (isValidObjectMaxDepth(maxDepth)) {
2685 // This file is also included in `angular-loader`, so `copy()` might not always be available in
2686 // the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed.
2687 obj = angular.copy(obj, null, maxDepth);
2688 }
2689 return JSON.stringify(obj, function(key, val) {
2690 val = toJsonReplacer(key, val);
2691 if (isObject(val)) {
2692
2693 if (seen.indexOf(val) >= 0) return '...';
2694
2695 seen.push(val);
2696 }
2697 return val;
2698 });
2699}
2700
2701function toDebugString(obj, maxDepth) {
2702 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