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

Function writeStringLiteralValue

packages/cli/src/batch-transform.ts:738–750  ·  view source on GitHub ↗
(node: any, value: string)

Source from the content-addressed store, hash-verified

736}
737
738function writeStringLiteralValue(node: any, value: string): boolean {
739 if (!node) return false;
740 if (node.type === "StringLiteral" || node.type === "Literal") {
741 node.value = value;
742 return true;
743 }
744 if (node.type === "TemplateLiteral" && (node.expressions?.length ?? 0) === 0 && node.quasis?.length === 1) {
745 node.quasis[0].value.raw = value;
746 node.quasis[0].value.cooked = value;
747 return true;
748 }
749 return false;
750}
751
752function getObjectPropertyValueNode(objectExpression: any, propertyName: string): any | null {
753 for (const property of objectExpression?.properties ?? []) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected