(object)
| 889 | return serialize(object); |
| 890 | |
| 891 | function serialize(object) { |
| 892 | var out; |
| 893 | |
| 894 | if (angular.isElement(object)) { |
| 895 | object = angular.element(object); |
| 896 | out = angular.element('<div></div>'); |
| 897 | angular.forEach(object, function(element) { |
| 898 | out.append(angular.element(element).clone()); |
| 899 | }); |
| 900 | out = out.html(); |
| 901 | } else if (angular.isArray(object)) { |
| 902 | out = []; |
| 903 | angular.forEach(object, function(o) { |
| 904 | out.push(serialize(o)); |
| 905 | }); |
| 906 | out = '[ ' + out.join(', ') + ' ]'; |
| 907 | } else if (angular.isObject(object)) { |
| 908 | if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) { |
| 909 | out = serializeScope(object); |
| 910 | } else if (object instanceof Error) { |
| 911 | out = object.stack || ('' + object.name + ': ' + object.message); |
| 912 | } else { |
| 913 | // TODO(i): this prevents methods being logged, |
| 914 | // we should have a better way to serialize objects |
| 915 | out = angular.toJson(object, true); |
| 916 | } |
| 917 | } else { |
| 918 | out = String(object); |
| 919 | } |
| 920 | |
| 921 | return out; |
| 922 | } |
| 923 | |
| 924 | function serializeScope(scope, offset) { |
| 925 | offset = offset || ' '; |
no test coverage detected