MCPcopy
hub / github.com/bvaughn/react-window / parseNumericStyleValue

Function parseNumericStyleValue

lib/utils/parseNumericStyleValue.ts:3–19  ·  view source on GitHub ↗
(
  value: CSSProperties["height"]
)

Source from the content-addressed store, hash-verified

1import type { CSSProperties } from "react";
2
3export function parseNumericStyleValue(
4 value: CSSProperties["height"]
5): number | undefined {
6 if (value !== undefined) {
7 switch (typeof value) {
8 case "number": {
9 return value;
10 }
11 case "string": {
12 if (value.endsWith("px")) {
13 return parseFloat(value);
14 }
15 break;
16 }
17 }
18 }
19}

Callers 2

useResizeObserverFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…