MCPcopy Create free account
hub / github.com/dot-agent/nextpy / format_var

Function format_var

nextpy/utils/format.py:199–214  ·  view source on GitHub ↗

Format the given Var as a javascript value. Args: var: The Var to format. Returns: The formatted Var.

(var: Var)

Source from the content-addressed store, hash-verified

197
198
199def format_var(var: Var) -> str:
200 """Format the given Var as a javascript value.
201
202 Args:
203 var: The Var to format.
204
205 Returns:
206 The formatted Var.
207 """
208 if not var._var_is_local or var._var_is_string:
209 return str(var)
210 if types._issubclass(var._var_type, str):
211 return format_string(var._var_full_name)
212 if is_wrapped(var._var_full_name, "{"):
213 return var._var_full_name
214 return json_dumps(var._var_full_name)
215
216
217def format_route(route: str, format_case=True) -> str:

Callers 1

format_event_chainFunction · 0.85

Calls 3

format_stringFunction · 0.85
is_wrappedFunction · 0.85
json_dumpsFunction · 0.85

Tested by

no test coverage detected