mangalam-research / wed

Wed is a web-based editor that assists users in editing XML documents according to a schema.
http://mangalam-research.github.io/wed/
Mozilla Public License 2.0
24 stars 10 forks source link

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

Closed lddubeau closed 6 years ago

lddubeau commented 6 years ago

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.

lddubeau commented 6 years ago

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.

lddubeau commented 6 years ago

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