MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / parseBackgroundShorthand

Function parseBackgroundShorthand

packages/extension/utils/css.ts:234–258  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

232}
233
234export function parseBackgroundShorthand(value: string) {
235 const result: {
236 image?: string
237 size?: string
238 repeat?: string
239 position?: string
240 } = {}
241
242 const urlMatch = value.match(BG_URL_RE)
243 if (urlMatch) result.image = urlMatch[0]
244
245 const sizeMatch = value.match(BG_SIZE_RE)
246 if (sizeMatch) result.size = sizeMatch[1]
247
248 const repeatMatch = value.match(BG_REPEAT_RE)
249 if (repeatMatch) {
250 const [, repeatToken] = repeatMatch
251 result.repeat = repeatToken.trim()
252 }
253
254 const posMatch = value.match(BG_POS_RE)
255 if (posMatch) result.position = posMatch[0].trim()
256
257 return result
258}
259
260function parseBoxValues(value: string): [string, string, string, string] {
261 const parts = value.trim().split(WHITESPACE_RE)

Callers 3

css.test.tsFile · 0.90
cleanFigmaSpecificStylesFunction · 0.90
expandShorthandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected