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

Function transformPxValue

packages/extension/utils/css.ts:300–306  ·  view source on GitHub ↗
(value: string, transform: (value: number) => string)

Source from the content-addressed store, hash-verified

298}
299
300function transformPxValue(value: string, transform: (value: number) => string) {
301 return value.replace(PX_VALUE_RE, (_, val) => {
302 const parsed = Number(val)
303 if (parsed === 0) return '0'
304 return transform(toDecimalPlace(parsed, 5))
305 })
306}
307
308function scalePxValue(value: string, scale: number): string {
309 return transformPxValue(value, (val) => `${toDecimalPlace(scale * val)}px`)

Callers 3

scalePxValueFunction · 0.85
pxToRemFunction · 0.85
processValueFunction · 0.85

Calls 2

toDecimalPlaceFunction · 0.90
transformFunction · 0.50

Tested by

no test coverage detected