* Create a class string. * @name createClass * @function * @param {AnserJsonEntry} bundle * @return {String} class name(s)
(bundle: AnserJsonEntry)
| 33 | * @return {String} class name(s) |
| 34 | */ |
| 35 | function createClass(bundle: AnserJsonEntry): string | null { |
| 36 | let classNames = ""; |
| 37 | |
| 38 | if (bundle.bg) { |
| 39 | classNames += `${bundle.bg}-bg `; |
| 40 | } |
| 41 | if (bundle.fg) { |
| 42 | classNames += `${bundle.fg}-fg `; |
| 43 | } |
| 44 | if (bundle.decoration) { |
| 45 | classNames += `ansi-${bundle.decoration} `; |
| 46 | } |
| 47 | |
| 48 | if (classNames === "") { |
| 49 | return null; |
| 50 | } |
| 51 | |
| 52 | classNames = classNames.substring(0, classNames.length - 1); |
| 53 | return classNames; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Create the style attribute. |
no outgoing calls
no test coverage detected