Cleanup
This commit is contained in:
8
node_modules/mongoose/lib/helpers/clone.js
generated
vendored
8
node_modules/mongoose/lib/helpers/clone.js
generated
vendored
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user