MCPcopy
hub / github.com/midrender/revideo / get

Function get

packages/core/src/utils/createRefMap.ts:60–85  ·  view source on GitHub ↗
(target, property)

Source from the content-addressed store, hash-verified

58
59const Handler: ProxyHandler<Map<string, Reference<any>>> = {
60 get(target, property) {
61 if (Reflect.has(target, property)) {
62 return Reflect.get(target, property);
63 }
64
65 if (property === 'mapRefs') {
66 return function <TValue>(
67 callback: (value: any, index: number) => TValue,
68 ): TValue[] {
69 const result: TValue[] = [];
70 for (const value of target.values()) {
71 result.push(callback(value(), result.length));
72 }
73 return result;
74 };
75 }
76
77 if (typeof property === 'string') {
78 let value = target.get(property);
79 if (!value) {
80 value = createRef();
81 target.set(property, value);
82 }
83 return value;
84 }
85 },
86
87 has(target, property) {
88 if (Reflect.has(target, property)) {

Callers

nothing calls this directly

Calls 3

createRefFunction · 0.90
setMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected