Function
getNumericFontWeight
(fontWeight: FontWeightType)
Source from the content-addressed store, hash-verified
| 238 | } |
| 239 | |
| 240 | function getNumericFontWeight(fontWeight: FontWeightType): number { |
| 241 | let value: number; |
| 242 | |
| 243 | if (typeof fontWeight === 'number') { |
| 244 | value = fontWeight; |
| 245 | } else { |
| 246 | switch (fontWeight) { |
| 247 | case FontWeight.NORMAL: |
| 248 | case undefined: |
| 249 | case null: |
| 250 | value = 400; |
| 251 | break; |
| 252 | case FontWeight.BOLD: |
| 253 | value = 700; |
| 254 | break; |
| 255 | default: |
| 256 | value = parseInt(fontWeight); |
| 257 | break; |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | return value; |
| 262 | } |
Tested by
no test coverage detected