mangalam-research/wed

replace merge-options with something that supports ES5 and does not require building

lddubeau opened this issue · 2 comments

merge-options is now pinned at 0.0.64. Newer versions ship as ES6 code, which fails on some platforms we still support. To use the newer versions we'd have to introduce a transpilation step to convert merge-options to ES5 code. We don't want that right now.

Evaluate, in order of decreasing likelihood:

  1. Switching to a different package.

  2. Rolling our own

  3. Whether there would be a benefit to introducing ES6-to-ES5 transpilation in general.

merge-options has some properties that we'd like to keep. For instance:

  1. mergeOptions({ a: { b: 1 } }, { a: {} }); produces a result deep-equal to the first argument.

  2. mergeOptions({ a: { b: 1 } }, { a: { b: undefined } }); produces a result deep-equal to the 2nd argument. A latter argument can undefine values in an earlier argument.

Unfortunately, lodash.merge does not respect the 2nd characteristic. If we use it with the arguments in the 2nd example, it returns the first argument.

We've actually moved to compiling to es6. So it is not necessary to find a replacement.