MCPcopy Create free account
hub / github.com/chakra-ui/panda / getEntryFromHash

Function getEntryFromHash

packages/core/src/style-decoder.ts:412–429  ·  view source on GitHub ↗
(hash: string)

Source from the content-addressed store, hash-verified

410const entryKeys = ['cond', 'recipe', 'layer', 'slot'] as const
411
412const 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
431const startsWithZero = /^0\d+$/
432const parseValue = (value: string) => {

Callers 1

StyleDecoderClass · 0.85

Calls 2

parseValueFunction · 0.85
forEachMethod · 0.80

Tested by

no test coverage detected