MCPcopy
hub / github.com/GitbookIO/gitbook / dereference

Function dereference

packages/react-openapi/src/decycle.ts:39–51  ·  view source on GitHub ↗
(this: { [k: string]: any }, ref: { $reference: string })

Source from the content-addressed store, hash-verified

37 const refs = new Set();
38
39 function dereference(this: { [k: string]: any }, ref: { $reference: string }) {
40 const parts = ref.$reference.slice(1).split('/');
41 let key: any;
42 let value = this;
43
44 for (let i = 0; i < parts.length; i++) {
45 key = parts[i]?.replace(/~1/g, '/').replace(/~0/g, '~');
46 value = value[key];
47 }
48
49 const parent = parents.get(ref);
50 parent[keys.get(ref)] = value;
51 }
52
53 return function reviver(this: object, key: string | symbol, value: any) {
54 if (key === '$reference') {

Callers 2

traverse.test.tsFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected