(chunks, executionContext)
| 19851 | }; |
| 19852 | |
| 19853 | var flatten = function flatten(chunks, executionContext) { |
| 19854 | return chunks.reduce(function (ruleSet, chunk) { |
| 19855 | /* Remove falsey values */ |
| 19856 | if (chunk === undefined || chunk === null || chunk === false || chunk === '') { |
| 19857 | return ruleSet; |
| 19858 | } |
| 19859 | /* Flatten ruleSet */ |
| 19860 | if (Array.isArray(chunk)) { |
| 19861 | return [].concat(ruleSet, flatten(chunk, executionContext)); |
| 19862 | } |
| 19863 | |
| 19864 | /* Handle other components */ |
| 19865 | if (chunk.hasOwnProperty('styledComponentId')) { |
| 19866 | // $FlowFixMe not sure how to make this pass |
| 19867 | return [].concat(ruleSet, ['.' + chunk.styledComponentId]); |
| 19868 | } |
| 19869 | |
| 19870 | /* Either execute or defer the function */ |
| 19871 | if (typeof chunk === 'function') { |
| 19872 | return executionContext ? ruleSet.concat.apply(ruleSet, flatten([chunk(executionContext)], executionContext)) : ruleSet.concat(chunk); |
| 19873 | } |
| 19874 | |
| 19875 | /* Handle objects */ |
| 19876 | return ruleSet.concat( |
| 19877 | // $FlowFixMe have to add %checks somehow to isPlainObject |
| 19878 | isPlainObject(chunk) ? objToCss(chunk) : chunk.toString()); |
| 19879 | }, []); |
| 19880 | }; |
| 19881 | |
| 19882 | // |
| 19883 | // NOTE: This stylis instance is only used to split rules from SSR'd style tags |
no test coverage detected