UNPKG

@appsemble/node-utils

Version:

NodeJS utilities used by Appsemble internally.

17 lines 586 B
import { mergeWith } from 'lodash-es'; /** * Calls Lodash’s mergeWith function * but with a comparator function provided to merge any string leaves if they are truthy. * * @param object The base object to merge. * @param otherArgs A list of objects to merge. * @returns The resulting merged object. */ export function mergeMessages(object, ...otherArgs) { return mergeWith(object, ...otherArgs, (objectValue, newValue) => { if (typeof newValue === 'string') { return newValue || objectValue; } }); } //# sourceMappingURL=mergeMessages.js.map