This commit is contained in:
Jonasz Bigda
2023-03-25 21:51:42 +01:00
parent 0db1d5117e
commit b332e9ceb0
1044 changed files with 37502 additions and 63938 deletions

View File

@@ -10,6 +10,7 @@ const getFunctionName = require('./getFunctionName');
const isBsonType = require('./isBsonType');
const isObject = require('./isObject');
const symbols = require('./symbols');
const utils = require('../utils');
/*!
@@ -41,6 +42,11 @@ function clone(obj, options, isArrayChild) {
if (options && options._skipSingleNestedGetters && obj.$isSingleNested) {
options = Object.assign({}, options, { getters: false });
}
if (utils.isPOJO(obj) && obj.$__ != null && obj._doc != null) {
return obj._doc;
}
if (options && options.json && typeof obj.toJSON === 'function') {
return obj.toJSON(options);
}
@@ -105,7 +111,7 @@ function cloneObject(obj, options, isArrayChild) {
const ret = {};
let hasKeys;
for (const k in obj) {
for (const k of Object.keys(obj)) {
if (specialProperties.has(k)) {
continue;
}