MCPcopy Create free account
hub / github.com/OpenWebCAD/node-occ / prepareObject

Method prepareObject

lib/fastbuilder.js:73–105  ·  view source on GitHub ↗
(obj, cmd, uuid, index)

Source from the content-addressed store, hash-verified

71 }
72
73 prepareObject(obj, cmd, uuid, index) {
74
75 if (obj === undefined) {
76
77 return;
78
79 }
80 if (typeof obj === "string") {
81
82 return;
83
84 }
85
86 assert(!obj.hasOwnProperty("cmd"), ` object should not have been inserted already ( old cmd : ${obj.cmd})`);
87 assert(!obj.hasOwnProperty("uuid"), ` object should not have been inserted already ( old uuid : ${obj.uuid})`);
88
89 // store the resulting object in cache
90 obj.cmd = cmd;
91 obj.uuid = uuid;
92 if (index) {
93
94 obj.uuid = hash(`${uuid}[${index}]`);
95 obj.uuid_index = index;
96
97 }
98 debugLog(" adding object to cache ", uuid, "cmd =", cmd, " index = ", index);
99
100 this.mapObject[obj.uuid] = obj;
101
102 // prepare the resulting object
103 this.installProxyMethods(obj);
104
105 }
106
107 __performedCachedOperation(originalObject, originalMethod, methodName, theArguments, callAsConstructor) {
108

Callers 1

Calls 3

installProxyMethodsMethod · 0.95
hashFunction · 0.85
debugLogFunction · 0.70

Tested by

no test coverage detected