MCPcopy Create free account
hub / github.com/shoutem/theme / normalize

Function normalize

src/StyleNormalizer/normalizeStyle.js:12–33  ·  view source on GitHub ↗

* Normalize style properties shorthands. * * @param style * @returns {*}

(style)

Source from the content-addressed store, hash-verified

10 * @returns {*}
11 */
12function normalize(style) {
13 return _.reduce(
14 style,
15 (normalizedStyle, val, prop) => {
16 /* eslint-disable no-param-reassign */
17 if (_.isPlainObject(val)) {
18 normalizedStyle[prop] = normalize(val);
19 } else if (styleNormalizer.canNormalize(prop)) {
20 normalizedStyle = {
21 ...normalizedStyle,
22 ...styleNormalizer.normalize(prop, val),
23 };
24 } else {
25 normalizedStyle[prop] = val;
26 }
27 /* eslint-enable no-param-reassign */
28
29 return normalizedStyle;
30 },
31 {},
32 );
33}
34
35export default function normalizeStyle(style) {
36 if (_.isArray(style)) {

Callers 1

normalizeStyleFunction · 0.85

Calls 2

canNormalizeMethod · 0.80
normalizeMethod · 0.80

Tested by

no test coverage detected