MCPcopy Index your code
hub / github.com/castillo-io/angular-css / parse

Function parse

angular-css.js:128–163  ·  view source on GitHub ↗

* Parse: returns array with full all object based on defaults

(obj)

Source from the content-addressed store, hash-verified

126 * Parse: returns array with full all object based on defaults
127 **/
128 function parse(obj) {
129 if (!obj) {
130 return;
131 }
132 // Function syntax
133 if (angular.isFunction(obj)) {
134 obj = angular.copy($injector.invoke(obj));
135 }
136 // String syntax
137 if (angular.isString(obj)) {
138 obj = angular.extend({
139 href: obj
140 }, options);
141 }
142 // Array of strings syntax
143 if (angular.isArray(obj) && angular.isString(obj[0])) {
144 angular.forEach(obj, function (item) {
145 obj = angular.extend({
146 href: item
147 }, options);
148 });
149 }
150 // Object syntax
151 if (angular.isObject(obj) && !angular.isArray(obj)) {
152 obj = angular.extend({}, options, obj);
153 }
154 // Array of objects syntax
155 if (angular.isArray(obj) && angular.isObject(obj[0])) {
156 angular.forEach(obj, function (item) {
157 obj = angular.extend(item, options);
158 });
159 }
160 // Map breakpoint to media attribute
161 mapBreakpointToMedia(obj);
162 return obj;
163 }
164
165 // Add stylesheets to scope
166 $rootScope.stylesheets = [];

Callers 1

angular-css.jsFile · 0.85

Calls 1

mapBreakpointToMediaFunction · 0.85

Tested by

no test coverage detected