@melt-ui/svelte
Version:

14 lines (13 loc) • 376 B
JavaScript
/**
* A utility function that converts a style object to a string.
*
* @param style - The style object to convert
* @returns The style object as a string
*/
export function styleToString(style) {
return Object.keys(style).reduce((str, key) => {
if (style[key] === undefined)
return str;
return str + `${key}:${style[key]};`;
}, '');
}