1 | /** @flow */
|
2 |
|
3 | import type {PluginConfig, PluginResult} from './index';
|
4 |
|
5 | export default function removeNestedStyles(
|
6 | {
|
7 | isNestedStyle,
|
8 | style,
|
9 | }: PluginConfig,
|
10 | ): PluginResult {
|
11 | // eslint-disable-line no-shadow
|
12 | const newStyle = Object.keys(style).reduce(
|
13 | (newStyleInProgress, key) => {
|
14 | const value = style[key];
|
15 | if (!isNestedStyle(value)) {
|
16 | newStyleInProgress[key] = value;
|
17 | }
|
18 | return newStyleInProgress;
|
19 | },
|
20 | {},
|
21 | );
|
22 |
|
23 | return {
|
24 | style: newStyle,
|
25 | };
|
26 | }
|