How to use the merge function from lodash
Find comprehensive JavaScript lodash.merge code examples handpicked from public code repositorys.
GitHub: gardener/dashboard
85 86 87 88 89 90 91 92 93 94
}, loadConfig (filename, { env } = process) { const config = this.getDefaults({ env }) if (filename) { try { _.merge(config, this.readConfig(filename)) } catch (err) { /* ignore */ } } this.assignEnvironmentVariables(config, env) const requiredConfigurationProperties = [
88
199
22
+ 2 other calls in file
19 20 21 22 23 24 25 26 27 28 29 30
); const handledOutcomes = new Set(['success', 'error:handled']); module.exports = async (basename, coreConfig, options) => { const baseLambdaConfiguration = _.merge( { Role: coreConfig.roleArn, MemorySize: 1024, Layers: [coreConfig.layerInternalArn],
7
19
12
+ 5 other calls in file
GitHub: TI4-Online/TI4-TTPG
252 253 254 255 256 257 258 259 260 261 262 263
assert(upgradeAttrs._attrs.upgradeLevel); assert( (this._attrs.upgradeLevel || 0) <= upgradeAttrs._attrs.upgradeLevel ); _.merge(this._attrs, upgradeAttrs._attrs); } } // Export for unittest
14
17
6
+ 12 other calls in file
GitHub: ortexx/spreadable
1939 1940 1941 1942 1943 1944 1945 1946 1947 1948
if(typeof this.options.server.https == 'object' && this.options.server.https.ca) { options.agent.options.ca = this.options.server.https.ca; } return _.merge(defaults, options); } /** * Create the request network options
4
14
4
+ 188 other calls in file
18 19 20 21 22 23 24 25 26
} if (!addresses[realm]) addresses[realm] = {} if (!addresses[realm][chain]) addresses[realm][chain] = {} const artifactNames = merge( settings.artifacts.default, settings.artifacts[realm] )
22
6
4
42 43 44 45 46 47 48 49 50 51 52
return a._id === b._id; }; Observer.prototype.loadInitial = function (cb) { var self = this; var newQuery = _.merge(this._query, self._queryOptions); this._collection._getDocuments(newQuery, function (err, result) { if (self._options.init) { self._options.init(result); } else {
1
0
14
75 76 77 78 79 80 81 82 83
self.project.resourceZone = options.resourceZone; self.project.serviceAccountPath = path.resolve(self.cwd, options.serviceAccountPath) self.project.backendManagerConfigPath = path.resolve(self.cwd, options.backendManagerConfigPath) self.package = resolveProjectPackage(); self.config = merge( requireJSON5(self.project.backendManagerConfigPath), self.libraries.functions.config() );
0
2
2
+ 15 other calls in file
GitHub: eldoy/mongowave
76 77 78 79 80 81 82 83 84 85 86
} return [query, options, callback] } module.exports = async function (config = {}) { config = _.merge({}, DEFAULT_CONFIG, config) if (config.timestamps === true) { config.timestamps = DEFAULT_TIMESTAMPS } const client = new MongoClient(config.url, config.connection)
0
2
1
321 322 323 324 325 326 327 328 329 330 331 332 333
config.path.base = `${config.path.prefix}/${config.path.app}`; if (['development', 'production', 'test'].includes(config.env)) { if (fs.existsSync(path.join(__dirname, `${config.env}.js`))) { // eslint-disable-line security/detect-non-literal-fs-filename _.merge(config, require(`./${config.env}`)); // eslint-disable-line security/detect-non-literal-require } } module.exports = config;
17
1
8
GitHub: OpenAgenda/oa-public
203 204 205 206 207 208 209 210 211 212 213 214
} /** ******* */ function init(c) { config = _.merge( { namespace: '', debug: { prefix: ''
2
4
4
+ 14 other calls in file
GitHub: autonordev/tools
125 126 127 128 129 130 131 132 133 134
) ) } // 3. Merge the trees and transform them const tree = merge({}, ...trees) // 4. Include tree into rojo configuration const rojoProject = importJson(path.resolve(project.path, 'rojo.json')) || {}
0
1
1
+ 2 other calls in file
GitHub: apostrophecms/apostrophe
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037
let fieldType = type; if (type.extend) { // Allow a field type to extend another field type and merge // in some differences. fieldType = _.cloneDeep(self.fieldTypes[type.extend]); _.merge(fieldType, type); } // For bc. csv was a bad name for the string converter, but // we need to accept it, and even keep the property around // for bc with those extending in sneaky ways
540
0
125
348 349 350 351 352 353 354 355 356 357
return { [parsedTagKey]: parsedTagValue } } return { [tagName]: tagValue } }) const parsedTags = _.merge( ...(serviceDescription?.tags || []).map((tag) => { const [tagKey, tagValue] = tag.toLocaleLowerCase().split(/\s*?:\s*?/) return { [tagKey]: tagValue } }),
0
1
1
+ 3 other calls in file
GitHub: davidmerfield/Blot
120 121 122 123 124 125 126 127 128 129
locals: templatePackage.locals, }; // Set the default font for each template if (template.locals.body_font !== undefined) { template.locals.body_font = _.merge( _.cloneDeep(DEFAULT_FONT), template.locals.body_font ); }
69
0
23
+ 5 other calls in file
GitHub: flow-build/engine
8 9 10 11 12 13 14 15 16 17 18
const emitter = require("../../utils/emitter"); const { Timer } = require("../timer"); class HttpSystemTaskNode extends SystemTaskNode { static get schema() { return _.merge(super.schema, { type: "object", properties: { next: { type: "string" }, parameters: {
6
6
3
+ 2 other calls in file
605 606 607 608 609 610 611 612 613 614
} if (typeof modelfield !== 'undefined') { rslt.splice(rslt.indexOf(modelfield), 1); if (!('__REMOVE__' in modelfield)) { //oldfield = field, newfield = modelfield var newfield = _.merge({}, field, modelfield); if(eachItem) eachItem(modelfield, field, newfield); rslt.push(newfield); } }
5
5
2
+ 2 other calls in file
213 214 215 216 217 218 219 220 221
var keyname = keyfield.name; var dbtype = _this.getDBType(keyfield); sql_ptypes.push(dbtype); sql_params[keyname] = this.DeformatParam(keyfield, keyid, verrors); verrors = _.merge(verrors, model.xvalidate.Validate('K', sql_params)); if (!_.isEmpty(verrors)) { Helper.GenError(req, res, -2, verrors[''].join('\n')); return; } var sql = db.sql.Download(_this.jsh, model, fields, keys, datalockqueries);
5
5
2
GitHub: shakyShane/opt-merger
77 78 79 80 81 82 83 84 85 86 87 88 89
} else { return opts.simple ? simpleMerged : _.merge(simpleMerged, commandLineArgs); } }
5
2
1
+ 2 other calls in file
273 274 275 276 277 278 279 280 281 282
}) ], asyncMiddleware(async function (req, res) { var surveyRequest = new SurveyRequest() _.merge(surveyRequest, req.body) // DO NOT update the record state here. Record state changes should only // happen in the record state handlers delete surveyRequest.recordState
2
2
8
+ 3 other calls in file
328 329 330 331 332 333 334 335 336 337
}) ], asyncMiddleware(async function (req, res) { var pas = new PriorityAreaSubmission(); _.merge(pas, req.body); const isNew = _.isNil(pas.id); if (!isNew) { // then check if record is deleted
2
2
8
+ 3 other calls in file
lodash.get is the most popular function in lodash (7670 examples)