(hash: string)
| 410 | const entryKeys = ['cond', 'recipe', 'layer', 'slot'] as const |
| 411 | |
| 412 | const getEntryFromHash = (hash: string) => { |
| 413 | const parts = hash.split(StyleEncoder.separator) |
| 414 | const prop = parts[0] |
| 415 | |
| 416 | const rawValue = parts[1].replace('value:', '') |
| 417 | const value = parseValue(rawValue) |
| 418 | |
| 419 | const entry = { prop, value } as StyleEntry |
| 420 | |
| 421 | parts.forEach((part) => { |
| 422 | const key = entryKeys.find((k) => part.startsWith(k)) |
| 423 | if (key) { |
| 424 | entry[key] = part.slice(key.length + 1) |
| 425 | } |
| 426 | }) |
| 427 | |
| 428 | return entry |
| 429 | } |
| 430 | |
| 431 | const startsWithZero = /^0\d+$/ |
| 432 | const parseValue = (value: string) => { |
no test coverage detected