File size: 516 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import { type Dict, walkObject } from "../utils"
import { type SystemContext } from "./types"
export function createNormalizeFn(context: {
utility: SystemContext["utility"]
normalize: SystemContext["normalizeValue"]
}) {
const { utility, normalize } = context
const { hasShorthand, resolveShorthand } = utility
return function (styles: Dict) {
return walkObject(styles, normalize, {
stop: (value) => Array.isArray(value),
getKey: hasShorthand ? resolveShorthand : undefined,
})
}
}
|