(obj, maxDepth)
| 2655 | /* exported toDebugString */ |
| 2656 | |
| 2657 | function 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 | |
| 2680 | function toDebugString(obj, maxDepth) { |
| 2681 | if (typeof obj === 'function') { |
no test coverage detected