MCPcopy Create free account
hub / github.com/Nynxz/ComfyUI-IdeogramHelper / set

Method set

web/main.js:1127–1160  ·  view source on GitHub ↗
(target, key, value, receiver)

Source from the content-addressed store, hash-verified

1125 super(false, isShallow2);
1126 }
1127 set(target, key, value, receiver) {
1128 let oldValue = target[key];
1129 const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
1130 if (!this._isShallow) {
1131 const isOldValueReadonly = /* @__PURE__ */ isReadonly(oldValue);
1132 if (!/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) {
1133 oldValue = /* @__PURE__ */ toRaw(oldValue);
1134 value = /* @__PURE__ */ toRaw(value);
1135 }
1136 if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
1137 if (isOldValueReadonly) {
1138 return true;
1139 } else {
1140 oldValue.value = value;
1141 return true;
1142 }
1143 }
1144 }
1145 const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
1146 const result = Reflect.set(
1147 target,
1148 key,
1149 value,
1150 /* @__PURE__ */ isRef(target) ? target : receiver
1151 );
1152 if (target === /* @__PURE__ */ toRaw(receiver)) {
1153 if (!hadKey) {
1154 trigger(target, "add", key, value);
1155 } else if (hasChanged(value, oldValue)) {
1156 trigger(target, "set", key, value);
1157 }
1158 }
1159 return result;
1160 }
1161 deleteProperty(target, key) {
1162 const hadKey = hasOwn(target, key);
1163 target[key];

Callers 15

mountWidgetFunction · 0.45
trackFunction · 0.45
setFunction · 0.45
createReactiveObjectFunction · 0.45
main.jsFile · 0.45
onWatcherCleanupFunction · 0.45
traverseFunction · 0.45
queuePendingMountFunction · 0.45
getLeavingNodesForTypeFunction · 0.45
setRefFunction · 0.45
definePropertyFunction · 0.45
resolveMergedOptionsFunction · 0.45

Calls 8

isIntegerKeyFunction · 0.85
isReadonlyFunction · 0.85
isShallowFunction · 0.85
toRawFunction · 0.85
isRefFunction · 0.85
hasOwnFunction · 0.85
triggerFunction · 0.85
hasChangedFunction · 0.85

Tested by

no test coverage detected