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

Function serializeObject

test/angular/1.7/angular.js:2657–2678  ·  view source on GitHub ↗
(obj, maxDepth)

Source from the content-addressed store, hash-verified

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