summaryrefslogtreecommitdiff
path: root/src/mongo/shell/types.js
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/shell/types.js
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/shell/types.js')
-rw-r--r--src/mongo/shell/types.js30
1 files changed, 0 insertions, 30 deletions
diff --git a/src/mongo/shell/types.js b/src/mongo/shell/types.js
index ce8fd02b172..c06601f9161 100644
--- a/src/mongo/shell/types.js
+++ b/src/mongo/shell/types.js
@@ -292,36 +292,6 @@ Object.merge = function(dst, src, deep) {
return Object.extend(clone, src, deep);
};
-// If there is a conflict in values of a key for two objects being merged, the second value will
-// override the first one in the merged object
-Object.deepMerge = function(...objects) {
- const isObject = obj => obj && typeof obj === 'object';
-
- // Create new object prev to hold combination of all object fields.
- return objects.reduce((prev, obj) => {
- if (obj === undefined) {
- obj = {};
- }
- Object.keys(obj).forEach(key => {
- const pVal = prev[key]; // Get the values for key from the two objects being merged.
- const oVal = obj[key];
-
- if (Array.isArray(pVal) &&
- Array.isArray(oVal)) { // If both are arrays then concatenate them into a new
- // array and add it to prev.
- prev[key] = pVal.concat(...oVal);
- } else if (isObject(pVal) &&
- isObject(oVal)) { // If both are objects then recursively merge again.
- prev[key] = Object.deepMerge(pVal, oVal);
- } else { // In all other cases set prev[key] to obj[key].
- prev[key] = oVal;
- }
- });
-
- return prev;
- }, {});
-};
-
Object.keySet = function(o) {
var ret = new Array();
for (var i in o) {