MCPcopy
hub / github.com/BuilderIO/mitosis / getStateObjectString

Function getStateObjectString

packages/core/src/generators/alpine/generate.ts:67–77  ·  view source on GitHub ↗
(json: MitosisComponent)

Source from the content-addressed store, hash-verified

65});
66const replaceStateWithThis = (str: string) => str.replaceAll('state.', 'this.');
67const getStateObjectString = (json: MitosisComponent) =>
68 flow(
69 getStateObjectStringFromComponent,
70 trim,
71 replaceInputRefs(json),
72 renderMountHook(json),
73 renderUpdateHooks(json),
74 replaceStateWithThis,
75 // cleanup bad regexes that result in malformed JSON strings that start with `{,`
76 (x) => (x.startsWith('{,') ? x.replace('{,', '{') : x),
77 )(json);
78
79const bindEventHandlerKey = compose(dashCase, removeOnFromEventName);
80const bindEventHandlerValue = compose(

Callers 1

componentToAlpineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected