MCPcopy Create free account
hub / github.com/markmap/markmap / buildCode

Function buildCode

packages/markmap-common/src/html.ts:48–59  ·  view source on GitHub ↗
(
  fn: (...args: T) => void,
  args: T,
)

Source from the content-addressed store, hash-verified

46}
47
48export function buildCode<T extends unknown[]>(
49 fn: (...args: T) => void,
50 args: T,
51): string {
52 const params = args
53 .map((arg) => {
54 if (typeof arg === 'function') return arg.toString();
55 return JSON.stringify(arg ?? null);
56 })
57 .join(',');
58 return `(${fn.toString()})(${params})`;
59}
60
61export function persistJS(items: JSItem[], context?: unknown): string[] {
62 return items.map((item) => {

Callers 1

persistJSFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected