threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

objects.ts 766B

123456789101112131415161718192021222324
  1. /*
  2. * Author: Axel Antoine
  3. * mail: ax.antoine@gmail.com
  4. * website: http://axantoine.com
  5. * Created on Wed Dec 14 2022
  6. *
  7. * Loki, Inria project-team with Université de Lille
  8. * within the Joint Research Unit UMR 9189
  9. * CNRS - Centrale Lille - Université de Lille, CRIStAL
  10. * https://loki.lille.inria.fr
  11. *
  12. * Licence: Licence.md
  13. */
  14. export function mergeOptions (target: any, source: any) {
  15. // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties
  16. for (const key of Object.keys(source)) {
  17. if (source[key] instanceof Object) Object.assign(source[key], mergeOptions(target[key], source[key]))
  18. }
  19. // Join `target` and modified `source`
  20. Object.assign(target || {}, source)
  21. return target
  22. }