MCPcopy
hub / github.com/openai/chatkit-js / wrap

Function wrap

packages/chatkit-react/src/useStableOptions.ts:71–79  ·  view source on GitHub ↗
(parentPath: (string | number)[], key: string | number)

Source from the content-addressed store, hash-verified

69 p.reduce((acc, k) => (acc == null ? acc : acc[k]), root);
70
71 const wrap = (parentPath: (string | number)[], key: string | number) => {
72 return (...args: any[]) => {
73 const latestParent = getByPath(ref.current, parentPath);
74 const latestFn: any = latestParent?.[key];
75 if (typeof latestFn === 'function') {
76 return latestFn.apply(latestParent, args);
77 }
78 };
79 };
80
81 const visit = (v: any): any => {
82 if (typeof v === 'function') {

Callers 1

visitFunction · 0.85

Calls 1

getByPathFunction · 0.85

Tested by

no test coverage detected