Closed homer0 closed 5 years ago
This package is a port of jquery's extend method. Does that support symbols?
@ljharb we both know that it doesn't.
I never imagined this project was limited to what jQuery does or doesn't support. More so seeing that #35 was considered at one point.
Can you add something on the README
or a CONTRIBUTING
file?
Sorry for waisting your time!
The readme already says it’s a port of jquery’s extend.
@ljharb yes, but that doesn't mean that you won't make improvements or accept suggestions; those are two different things.
That’s true, but if you want to include symbols, you can use object spread or Object.assign already?
@ljharb yep, but not for deep merge :P. No worries, I'll code something, is not that complicated :D.
When you merge objects that use symbols as keys, they get removed.
I did some research and testing and I believe the issue is here:
https://github.com/justmoon/node-extend/blob/ef6192a02057fce77ec8d75e37aa3760fd509e87/index.js#L88
The
for ... in
ignores the symbols, so I tried changing it a little bit:And now it works.
The spread can be replaced with concat, but
getOwnPropertySymbols
pretty much leaves IE out and I don't know which are the browser/engines the library should support, that's why I didn't send a PR.Let me know what you think. Thanks.