MCPcopy Index your code
hub / github.com/angular-ui/ui-router / serialize

Function serialize

test/angular/1.7/angular-mocks.js:1129–1160  ·  view source on GitHub ↗
(object)

Source from the content-addressed store, hash-verified

1127 return serialize(object);
1128
1129 function serialize(object) {
1130 var out;
1131
1132 if (angular.isElement(object)) {
1133 object = angular.element(object);
1134 out = angular.element('<div></div>');
1135 angular.forEach(object, function(element) {
1136 out.append(angular.element(element).clone());
1137 });
1138 out = out.html();
1139 } else if (angular.isArray(object)) {
1140 out = [];
1141 angular.forEach(object, function(o) {
1142 out.push(serialize(o));
1143 });
1144 out = '[ ' + out.join(', ') + ' ]';
1145 } else if (angular.isObject(object)) {
1146 if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) {
1147 out = serializeScope(object);
1148 } else if (object instanceof Error) {
1149 out = object.stack || ('' + object.name + ': ' + object.message);
1150 } else {
1151 // TODO(i): this prevents methods being logged,
1152 // we should have a better way to serialize objects
1153 out = angular.toJson(object, true);
1154 }
1155 } else {
1156 out = String(object);
1157 }
1158
1159 return out;
1160 }
1161
1162 function serializeScope(scope, offset) {
1163 offset = offset || ' ';

Callers 1

angular-mocks.jsFile · 0.70

Calls 1

serializeScopeFunction · 0.70

Tested by

no test coverage detected