167 lines
4.5 KiB
TypeScript
167 lines
4.5 KiB
TypeScript
// Module ID: 2080
|
|
// Function ID: 2081
|
|
// Name: PlainRecord
|
|
// Dependencies: [2081, 38, 2082, 568, 2]
|
|
// Exports: constructInPlace, copyConstruct, merge, objectIsPlainRecordOfType, set, tryReuseExistingInPlacePlainRecord
|
|
|
|
// Module 2080 (PlainRecord)
|
|
import _modDef38 from "module_38" /* 38 */;
|
|
import shallowEqual from "shallowEqual" /* 568 */;
|
|
import js_shim_PlainRecord from "js_shim/PlainRecord" /* 2081 */;
|
|
import SetUtils from "SetUtils" /* 2082 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const shallowEqualDefault = shallowEqual;
|
|
const PlainRecord = js_shim_PlainRecord;
|
|
|
|
function isValueEqual(getTime, getTime2) {
|
|
if (null != getTime) {
|
|
let tmp10;
|
|
if (null != getTime2) {
|
|
tmp10 = getTime === getTime2;
|
|
if (!tmp10) {
|
|
let areSetsEqualResult;
|
|
const _Date = Date;
|
|
if (getTime instanceof Date) {
|
|
const _Date2 = Date;
|
|
if (getTime2 instanceof Date) {
|
|
const time = getTime.getTime();
|
|
areSetsEqualResult = time === getTime2.getTime();
|
|
}
|
|
tmp10 = areSetsEqualResult;
|
|
}
|
|
const _Set = Set;
|
|
if (getTime instanceof Set) {
|
|
const _Set2 = Set;
|
|
if (getTime2 instanceof Set) {
|
|
const obj2 = SetUtils;
|
|
areSetsEqualResult = obj2.areSetsEqual(getTime, getTime2);
|
|
}
|
|
}
|
|
const _Array = Array;
|
|
if (Array.isArray(getTime)) {
|
|
const _Array2 = Array;
|
|
if (Array.isArray(getTime2)) {
|
|
const obj = shallowEqual;
|
|
areSetsEqualResult = obj.areArraysShallowEqual(getTime, getTime2);
|
|
}
|
|
}
|
|
areSetsEqualResult = typeof getTime === "object";
|
|
if (typeof getTime === "object") {
|
|
areSetsEqualResult = typeof getTime2 === "object";
|
|
}
|
|
if (areSetsEqualResult) {
|
|
areSetsEqualResult = shallowEqualDefault(getTime, getTime2);
|
|
}
|
|
}
|
|
}
|
|
return tmp10;
|
|
}
|
|
tmp10 = getTime === getTime2;
|
|
}
|
|
function isPlainRecordDataEqual(arg0, arg1) {
|
|
if (arg0 === arg1) {
|
|
return true;
|
|
} else {
|
|
const _Object = Object;
|
|
const keys = Object.keys(arg0);
|
|
for (const item10010 of keys) {
|
|
if (isValueEqual(arg0[item10010], arg1[item10010])) {
|
|
continue;
|
|
} else {
|
|
obj.return();
|
|
let flag = false;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
const TypeTag = js_shim_PlainRecord.TypeTag;
|
|
const result = size.fileFinishedImporting("lib/PlainRecord.tsx");
|
|
|
|
export default PlainRecord;
|
|
export { TypeTag };
|
|
export const set = function set(arg0, arg1, getTime2) {
|
|
let tmp = arg0;
|
|
if (!isValueEqual(arg0[arg1], getTime2)) {
|
|
const obj = {};
|
|
const merged = Object.assign(arg0);
|
|
obj[arg1] = getTime2;
|
|
tmp = obj;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const merge = function merge(arg0, getTime2) {
|
|
let tmp2 = arg0;
|
|
let tmp3 = null;
|
|
let tmp4 = null;
|
|
const keys = Object.keys();
|
|
if (keys !== undefined) {
|
|
let tmp6 = tmp3;
|
|
tmp4 = tmp3;
|
|
while (keys[tmp] !== undefined) {
|
|
let tmp15 = getTime2[tmp7];
|
|
let tmp9 = undefined === tmp15;
|
|
if (!tmp9) {
|
|
tmp9 = isValueEqual(tmp14, tmp15);
|
|
}
|
|
tmp3 = tmp6;
|
|
if (tmp9) {
|
|
continue;
|
|
} else {
|
|
if (null == tmp6) {
|
|
let obj = {};
|
|
let merged = Object.assign(tmp2);
|
|
obj[tmp7] = tmp15;
|
|
tmp6 = obj;
|
|
} else {
|
|
tmp6[tmp7] = tmp15;
|
|
}
|
|
tmp3 = tmp6;
|
|
continue;
|
|
}
|
|
continue;
|
|
}
|
|
}
|
|
if (null != tmp4) {
|
|
tmp2 = tmp4;
|
|
}
|
|
return tmp2;
|
|
};
|
|
export const tryReuseExistingInPlacePlainRecord = function tryReuseExistingInPlacePlainRecord(arg0, arg1, arg2) {
|
|
let tmp = arg1;
|
|
let tmp3 = null == arg1;
|
|
const tmp2 = _modDef38;
|
|
if (!tmp3) {
|
|
tmp3 = tmp[TypeTag] === arg0;
|
|
}
|
|
tmp2(tmp3, "Existing record type does not match the expected type");
|
|
if (null == tmp) {
|
|
arg2[TypeTag] = arg0;
|
|
tmp = arg2;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const objectIsPlainRecordOfType = function objectIsPlainRecordOfType(arg0, obj) {
|
|
let tmp = typeof obj === "object";
|
|
if (typeof obj === "object") {
|
|
tmp = null != obj;
|
|
}
|
|
if (tmp) {
|
|
tmp = (TypeTag in obj && obj[TypeTag]) === arg0;
|
|
}
|
|
return tmp;
|
|
};
|
|
export const constructInPlace = function constructInPlace(GuildRoleRecordTypeTag, arg1) {
|
|
arg1[TypeTag] = GuildRoleRecordTypeTag;
|
|
return arg1;
|
|
};
|
|
export const copyConstruct = function copyConstruct(arg0, arg1) {
|
|
const obj = {};
|
|
const merged = Object.assign(arg1);
|
|
obj[TypeTag] = arg0;
|
|
return obj;
|
|
};
|
|
export { isValueEqual };
|
|
export { isPlainRecordDataEqual };
|