MCPcopy
hub / github.com/SparkPost/heml / getProp

Function getProp

packages/heml-inline/src/styleHelper.js:10–23  ·  view source on GitHub ↗

* Gets the value of a prop in a given inline style string * @param {String} style inline styles * @param {String} prop prop to get * * @return {String} style

(style = '', prop)

Source from the content-addressed store, hash-verified

8 * @return {String} style
9 */
10function getProp (style = '', prop) {
11 prop = prop.trim().toLowerCase()
12 const decls = style.split(';')
13
14 let value = false
15
16 decls.forEach((decl) => {
17 if (decl.trim().toLowerCase().startsWith(`${prop}:`)) {
18 value = decl.split(':')[1].trim()
19 }
20 })
21
22 return value
23}
24
25/**
26 * Sets the value of a prop in a given inline style string

Callers 2

preferMaxWidthFunction · 0.90
fixWidthsForFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected