MCPcopy
hub / github.com/google-labs-code/design.md / parseDimension

Function parseDimension

packages/cli/src/linter/model/handler.ts:285–295  ·  view source on GitHub ↗

* Parse a dimension string like "42px" or "1.5rem".

(raw: string)

Source from the content-addressed store, hash-verified

283 * Parse a dimension string like "42px" or "1.5rem".
284 */
285function parseDimension(raw: string): ResolvedDimension {
286 const parts = parseDimensionParts(raw);
287 if (!parts) {
288 throw new Error(`Invalid dimension: ${raw}`);
289 }
290 return {
291 type: 'dimension',
292 value: parts.value,
293 unit: parts.unit,
294 };
295}
296
297/**
298 * Parse a typography properties object into a ResolvedTypography.

Callers 2

executeMethod · 0.85
parseTypographyFunction · 0.85

Calls 1

parseDimensionPartsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…