UNPKG

@hedgedoc/html-to-react

Version:

Parse HTML into React components

21 lines 757 B
export function convertInlineStyleToMap(inlineStyle = '') { if (inlineStyle === '') { return {}; } return inlineStyle.split(';').reduce((styleObject, stylePropertyValue) => { const [property, value] = stylePropertyValue .split(/^([^:]+):/) .filter((val, i) => i > 0) .map((item) => item.trim()); if (value === undefined) { return styleObject; } const replacedProperty = property .toLowerCase() .replace(/^-ms-/, 'ms-') .replace(/-(.)/g, (_, character) => character.toUpperCase()); styleObject[replacedProperty] = value; return styleObject; }, {}); } //# sourceMappingURL=convertInlineStyleToMap.js.map