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

Function getTrailingInlineSeparator

packages/cli/src/batch-transform.ts:1181–1190  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

1179}
1180
1181function getTrailingInlineSeparator(text: string): string {
1182 if (!text) return "";
1183 const trailingWhitespace = text.match(/[\t\n\f\r ]+$/)?.[0] ?? "";
1184 const prefix = text.slice(0, text.length - trailingWhitespace.length);
1185 const punctuationMatch = prefix.match(/(?:[,;:/|]\s*)+$/)?.[0] ?? "";
1186 if (punctuationMatch) {
1187 return punctuationMatch + trailingWhitespace;
1188 }
1189 return trailingWhitespace;
1190}
1191
1192function extractInlineDuplicateSeparator(source: string, nodePath: any): string {
1193 const parentChildren = nodePath.parent?.node?.children;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected