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

Function serialize

test/angular/1.2/angular-mocks.js:831–862  ·  view source on GitHub ↗
(object)

Source from the content-addressed store, hash-verified

829 return serialize(object);
830
831 function serialize(object) {
832 var out;
833
834 if (angular.isElement(object)) {
835 object = angular.element(object);
836 out = angular.element('<div></div>');
837 angular.forEach(object, function(element) {
838 out.append(angular.element(element).clone());
839 });
840 out = out.html();
841 } else if (angular.isArray(object)) {
842 out = [];
843 angular.forEach(object, function(o) {
844 out.push(serialize(o));
845 });
846 out = '[ ' + out.join(', ') + ' ]';
847 } else if (angular.isObject(object)) {
848 if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) {
849 out = serializeScope(object);
850 } else if (object instanceof Error) {
851 out = object.stack || ('' + object.name + ': ' + object.message);
852 } else {
853 // TODO(i): this prevents methods being logged,
854 // we should have a better way to serialize objects
855 out = angular.toJson(object, true);
856 }
857 } else {
858 out = String(object);
859 }
860
861 return out;
862 }
863
864 function serializeScope(scope, offset) {
865 offset = offset || ' ';

Callers 1

angular-mocks.jsFile · 0.70

Calls 1

serializeScopeFunction · 0.70

Tested by

no test coverage detected