All files / src/render/html/utils scrape-motion-values.ts

100% Statements 9/9
100% Branches 4/4
100% Functions 1/1
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  35x 35x   35x 2071x 2071x   2071x 1263x 1135x       2071x    
import { MotionProps } from "../../../motion/types"
import { isForcedMotionValue } from "../../../motion/utils/is-forced-motion-value"
import { isMotionValue } from "../../../value/utils/is-motion-value"
 
export function scrapeMotionValuesFromProps(props: MotionProps) {
    const { style } = props
    const newValues = {}
 
    for (const key in style) {
        if (isMotionValue(style[key]) || isForcedMotionValue(key, props)) {
            newValues[key] = style[key]
        }
    }
 
    return newValues
}