MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / isStaticRules

Function isStaticRules

code/styling/public/app.js:21690–21715  ·  view source on GitHub ↗
(rules, attrs)

Source from the content-addressed store, hash-verified

21688var areStylesCacheable = IS_BROWSER;
21689
21690var isStaticRules = function isStaticRules(rules, attrs) {
21691 for (var i = 0; i < rules.length; i += 1) {
21692 var rule = rules[i];
21693
21694 // recursive case
21695 if (Array.isArray(rule) && !isStaticRules(rule)) {
21696 return false;
21697 } else if (typeof rule === 'function' && !isStyledComponent(rule)) {
21698 // functions are allowed to be static if they're just being
21699 // used to get the classname of a nested styled copmonent
21700 return false;
21701 }
21702 }
21703
21704 if (attrs !== undefined) {
21705 // eslint-disable-next-line guard-for-in, no-restricted-syntax
21706 for (var key in attrs) {
21707 var value = attrs[key];
21708 if (typeof value === 'function') {
21709 return false;
21710 }
21711 }
21712 }
21713
21714 return true;
21715};
21716
21717var isHRMEnabled = typeof module !== 'undefined' && module.hot && process.env.NODE_ENV !== 'production';
21718

Callers 1

ComponentStyleFunction · 0.85

Calls 1

isStyledComponentFunction · 0.85

Tested by

no test coverage detected