Skip to content

Commit e910cb7

Browse files
committed
perf(document): avoid cloning options using spread operator for perf reasons
Re: #14394
1 parent 175da6b commit e910cb7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/document.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3855,7 +3855,11 @@ Document.prototype.$toObject = function(options, json) {
38553855
}
38563856

38573857
// merge default options with input options.
3858-
options = { ...defaultOptions, ...options };
3858+
for (const key of Object.keys(defaultOptions)) {
3859+
if (options[key] == null) {
3860+
options[key] = defaultOptions[key];
3861+
}
3862+
}
38593863
options._isNested = true;
38603864
options.json = json;
38613865
options.minimize = _minimize;

0 commit comments

Comments
 (0)