(name)
| 287 | } |
| 288 | |
| 289 | function convertFontWeightToNumber(name) { |
| 290 | const fontWeightPatterns = [ |
| 291 | { num: 100, pattern: /^Thin$/i }, |
| 292 | { num: 200, pattern: /^(Extra|Ultra)-?light$/i }, |
| 293 | { num: 300, pattern: /^Light$/i }, |
| 294 | { num: 400, pattern: /^(Normal|Regular|Roman|Book)$/i }, |
| 295 | { num: 500, pattern: /^Medium$/i }, |
| 296 | { num: 600, pattern: /^(Semi|Demi)-?bold$/i }, |
| 297 | { num: 700, pattern: /^Bold$/i }, |
| 298 | { num: 800, pattern: /^(Extra|Ultra)-?bold$/i }, |
| 299 | { num: 900, pattern: /^(Black|Heavy)$/i }, |
| 300 | ] |
| 301 | |
| 302 | if (/^[1-9]00$/.test(name)) { |
| 303 | return Number(name) |
| 304 | } |
| 305 | |
| 306 | const matches = fontWeightPatterns.filter(fontWeight => fontWeight.pattern.test(name)) |
| 307 | |
| 308 | if (matches.length) { |
| 309 | return String(matches[0].num) |
| 310 | } |
| 311 | return name |
| 312 | } |
| 313 | |
| 314 | function isFontWeightProperty(prop) { |
| 315 | return prop === 'fontWeight' |
no test coverage detected