unpkg/public/react-motion@0.5.2/lib/stripStyle.js.flow

17 lines
489 B
Plaintext

/* @flow */
// turn {x: {val: 1, stiffness: 1, damping: 2}, y: 2} generated by
// `{x: spring(1, {stiffness: 1, damping: 2}), y: 2}` into {x: 1, y: 2}
import type {Style, PlainStyle} from './Types';
export default function stripStyle(style: Style): PlainStyle {
let ret = {};
for (const key in style) {
if (!Object.prototype.hasOwnProperty.call(style, key)) {
continue;
}
ret[key] = typeof style[key] === 'number' ? style[key] : style[key].val;
}
return ret;
}