(cssText)
| 9 | * - No nested rules support |
| 10 | */ |
| 11 | const parse = (cssText) => { |
| 12 | const style = {} |
| 13 | const split = cssText.split(semiWithNl) |
| 14 | for (let i = 0; i < split.length; i++) { |
| 15 | const decl = (split[i] || '').trim() |
| 16 | |
| 17 | if (!decl) continue |
| 18 | const colonIndex = decl.indexOf(':') |
| 19 | if (colonIndex === -1) { |
| 20 | warning(false, `[JSS] Malformed CSS string "${decl}"`) |
| 21 | continue |
| 22 | } |
| 23 | const prop = decl.substr(0, colonIndex).trim() |
| 24 | const value = decl.substr(colonIndex + 1).trim() |
| 25 | style[prop] = value |
| 26 | } |
| 27 | return style |
| 28 | } |
| 29 | |
| 30 | export default parse |
no test coverage detected
searching dependent graphs…