MCPcopy Create free account
hub / github.com/donghaxkim/react-rewrite / insertSingleVisibleBoundarySpace

Function insertSingleVisibleBoundarySpace

packages/cli/src/transform.ts:959–972  ·  view source on GitHub ↗
(normalized: any[], upcomingChild?: any)

Source from the content-addressed store, hash-verified

957}
958
959function insertSingleVisibleBoundarySpace(normalized: any[], upcomingChild?: any): void {
960 const previous = normalized[normalized.length - 1];
961 if (!previous) return;
962
963 const previousIsPlainText = previous.type === "JSXText";
964 const upcomingIsPlainText = upcomingChild?.type === "JSXText";
965
966 if (previousIsPlainText && upcomingIsPlainText) {
967 if (appendToChildText(previous, " ")) return;
968 if (upcomingChild && prependToChildText(upcomingChild, " ")) return;
969 }
970
971 normalized.push(createSpaceExpressionNode());
972}
973
974function canonicalizeEditedTextSubtree(node: any, source?: string, lineStarts = source ? getLineStarts(source) : undefined): void {
975 const children = node.children;

Callers 1

Calls 3

appendToChildTextFunction · 0.85
prependToChildTextFunction · 0.85

Tested by

no test coverage detected