UNPKG

470 BJavaScriptView Raw
1import flattenStyle from './flattenStyle';
2import getDefaultStyleValue from './getDefaultStyleValue';
3
4// Returns a flattened version of style with only `keys` values.
5export default function getStyleValues(keys, style) {
6 const values = {};
7 const flatStyle = flattenStyle(style);
8
9 (typeof keys === 'string' ? [keys] : keys).forEach(key => {
10 values[key] =
11 key in flatStyle ? flatStyle[key] : getDefaultStyleValue(key, flatStyle);
12 });
13 return values;
14}