Skip to content

Commit 006740a

Browse files
committed
refactor(document): remove "clone" where previously necessary because of "utils.options"
1 parent 78d3438 commit 006740a

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/document.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3690,8 +3690,7 @@ Document.prototype.$toObject = function(options, json) {
36903690
const schemaOptions = this.$__schema && this.$__schema.options || {};
36913691
// merge base default options with Schema's set default options if available.
36923692
// `clone` is necessary here because `utils.options` directly modifies the second input.
3693-
defaultOptions = { ...defaultOptions, ...clone(baseOptions) };
3694-
defaultOptions = { ...defaultOptions, ...clone(schemaOptions[path] || {}) };
3693+
defaultOptions = { ...defaultOptions, ...baseOptions, ...schemaOptions[path] };
36953694

36963695
// If options do not exist or is not an object, set it to empty object
36973696
options = utils.isPOJO(options) ? { ...options } : {};

lib/schema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ Schema.prototype.defaultOptions = function(options) {
578578
_id: true,
579579
id: id,
580580
typeKey: 'type',
581-
...clone(options)
581+
...options
582582
};
583583

584584
if (options.versionKey && typeof options.versionKey !== 'string') {

0 commit comments

Comments
 (0)