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

Function serialize

test/angular/1.6/angular-mocks.js:981–1012  ·  view source on GitHub ↗
(object)

Source from the content-addressed store, hash-verified

979 return serialize(object);
980
981 function serialize(object) {
982 var out;
983
984 if (angular.isElement(object)) {
985 object = angular.element(object);
986 out = angular.element('<div></div>');
987 angular.forEach(object, function(element) {
988 out.append(angular.element(element).clone());
989 });
990 out = out.html();
991 } else if (angular.isArray(object)) {
992 out = [];
993 angular.forEach(object, function(o) {
994 out.push(serialize(o));
995 });
996 out = '[ ' + out.join(', ') + ' ]';
997 } else if (angular.isObject(object)) {
998 if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) {
999 out = serializeScope(object);
1000 } else if (object instanceof Error) {
1001 out = object.stack || ('' + object.name + ': ' + object.message);
1002 } else {
1003 // TODO(i): this prevents methods being logged,
1004 // we should have a better way to serialize objects
1005 out = angular.toJson(object, true);
1006 }
1007 } else {
1008 out = String(object);
1009 }
1010
1011 return out;
1012 }
1013
1014 function serializeScope(scope, offset) {
1015 offset = offset || ' ';

Callers 1

angular-mocks.jsFile · 0.70

Calls 1

serializeScopeFunction · 0.70

Tested by

no test coverage detected