MultiLoader-Template/node_modules/es-toolkit/dist/compat/util/toPlainObject.mjs
3944Realms 768f38fc97 feat: 可使用的构建模板
修改了脚本,使其可以推给Maven仓库
2026-05-03 13:02:19 +08:00

25 lines
640 B
JavaScript

import { keysIn } from '../object/keysIn.mjs';
function toPlainObject(value) {
const plainObject = {};
const valueKeys = keysIn(value);
for (let i = 0; i < valueKeys.length; i++) {
const key = valueKeys[i];
const objValue = value[key];
if (key === '__proto__') {
Object.defineProperty(plainObject, key, {
configurable: true,
enumerable: true,
value: objValue,
writable: true,
});
}
else {
plainObject[key] = objValue;
}
}
return plainObject;
}
export { toPlainObject };