stampit-org / stamp-specification

The Stamp Specification: Composables
434 stars 16 forks source link

Find a less bulky alternative to mergeWith #94

Closed danielkcz closed 8 years ago

danielkcz commented 8 years ago

Coming from investigation in https://github.com/stampit-org/stampit/issues/212

Do we need to write something own or is there some implementation that doesn't take 24K of minified code? It's almost bigger than React!

First candicate that looks promising is https://github.com/KyleAMathews/deepmerge. It already has array merging included. However it's not maintained for 2 years and it has 8 open issues. Apparently there was attempt to change maintainer, but they lost interest. Could we take it under the wings?

It's quite puzzling how in general these deep merging libraries are about 1-2K in source code while lodash needs 24K minified :confounded:

koresar commented 8 years ago

Lodash is doing lot's of safety logic underneath. And also it works under all the possible environments (excluding IE8, but including IE9 IIRC). It supports circular references, Maps, Sets, WeakMaps, Iterables, Buffers, etc. etc. etc. But we don't need all that. All we need is POJO, the rest should be carefully considered by the specification "committee". :)

It is a reasonable approach to ask to take over the deepmerge. For now I forked it: https://github.com/stampit-org/deepmerge I would need to investigate if the module is spec complaint (but looks like it is), and then we would decide.

koresar commented 8 years ago

One more alternative: https://github.com/sindresorhus/deep-assign (Although, it doesn't concat arrays)

danielkcz commented 8 years ago

I suppose we can close this as well since it's not needed anymore to minimize bundle size.