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

100% Statements 9/9
100% Branches 6/6
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 18  34x 34x   34x 38x   38x 180x   14x 14x       38x    
import { MotionProps } from "../../../motion/types"
import { isMotionValue } from "../../../value/utils/is-motion-value"
import { scrapeMotionValuesFromProps as scrapeHTMLMotionValuesFromProps } from "../../html/utils/scrape-motion-values"
 
export function scrapeMotionValuesFromProps(props: MotionProps) {
    const newValues = scrapeHTMLMotionValuesFromProps(props)
 
    for (const key in props) {
        if (isMotionValue(props[key])) {
            const targetKey =
                key === "x" || key === "y" ? "attr" + key.toUpperCase() : key
            newValues[targetKey] = props[key]
        }
    }
 
    return newValues
}