Skip to content

Commit 6820605

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

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/document.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3690,8 +3690,8 @@ 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 };
3694+
defaultOptions = { ...defaultOptions, ...schemaOptions[path] };
36953695

36963696
// If options do not exist or is not an object, set it to empty object
36973697
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)