source: node_modules/es-toolkit/dist/compat/util/toPlainObject.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 749 bytes
RevLine 
[a762898]1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const keysIn = require('../object/keysIn.js');
6
7function toPlainObject(value) {
8 const plainObject = {};
9 const valueKeys = keysIn.keysIn(value);
10 for (let i = 0; i < valueKeys.length; i++) {
11 const key = valueKeys[i];
12 const objValue = value[key];
13 if (key === '__proto__') {
14 Object.defineProperty(plainObject, key, {
15 configurable: true,
16 enumerable: true,
17 value: objValue,
18 writable: true,
19 });
20 }
21 else {
22 plainObject[key] = objValue;
23 }
24 }
25 return plainObject;
26}
27
28exports.toPlainObject = toPlainObject;
Note: See TracBrowser for help on using the repository browser.