* 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)
| 8 | * @return {String} style |
| 9 | */ |
| 10 | function 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 |
no outgoing calls
no test coverage detected