UNPKG

react-map-gl

Version:

React components for MapLibre GL JS and Mapbox GL JS

19 lines 700 B
// This is a simplified version of // https://github.com/facebook/react/blob/4131af3e4bf52f3a003537ec95a1655147c81270/src/renderers/dom/shared/CSSPropertyOperations.js#L62 const unitlessNumber = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/; export function applyReactStyle(element, styles) { if (!element || !styles) { return; } const style = element.style; for (const key in styles) { const value = styles[key]; if (Number.isFinite(value) && !unitlessNumber.test(key)) { style[key] = `${value}px`; } else { style[key] = value; } } } //# sourceMappingURL=apply-react-style.js.map