MCPcopy
hub / github.com/1weiho/open-slide / readJsxNumberAttr

Function readJsxNumberAttr

packages/core/src/editing/edit-ops.ts:59–66  ·  view source on GitHub ↗
(opening: t.JSXOpeningElement, name: string)

Source from the content-addressed store, hash-verified

57}
58
59function readJsxNumberAttr(opening: t.JSXOpeningElement, name: string): number | null {
60 const attr = findJsxAttr(opening, name);
61 const v = attr?.value;
62 if (!v || !t.isJSXExpressionContainer(v)) return null;
63 if (!t.isNumericLiteral(v.expression)) return null;
64 const n = v.expression.value;
65 return Number.isFinite(n) ? n : null;
66}
67
68export type ImportInfo = {
69 node: t.ImportDeclaration;

Callers 1

planReplacePlaceholderFunction · 0.85

Calls 1

findJsxAttrFunction · 0.85

Tested by

no test coverage detected