Open tunnckoCore opened 7 years ago
It would be just
import isObject from 'is-extendable';
export default function extend(o/*, objects*/) {
if (!isObject(o)) { o = {}; }
// ... code
};
also converting is-extendable
to es2015 would be good too.
edit: haha, i jumped to that train a bit and it's very inspiring and funny :laughing: :rocket:
Why? There is no advantage in doing this. It would only make it less compatible and slower.
Less compatible with what? Slower? Why?
The current code won't be even touched. We just need one more file with just ES2015 modules definitions and one more field in package.json which will help ES2015 aware bundlers to do their job better.
The advantage is lower duplication of code (in the bundle) and smaller install times for the user. And all that without any costs (except that npm package will have one more file in it).
The current code won't be even touched. We just need one more file with just ES2015 modules definitions and one more field in package.json which will help ES2015 aware bundlers to do their job better.
this is what you should start the issue with next time lol. sure, that's fine with me
haha
I thought that will be enough:
So I can PR to create it both CJS and ES2015 compatible.
But yea.. I'm bot. :dagger:
Okey, i'll send a pr this night
sorry, lol. Sometimes I have to skim issues and I missed the important part of your comments.
It is very much used everywhere and by me too. So I can PR to create it both CJS and ES2015 compatible. So later when some modern bundlers like Webpack and Rollup can resolve es2015 module.
The simplest thing is just pass
jsnext:main: path/to/file.with.es2015.exports.js
and the currentmain
will remain the same.Rollup and Webpack2 understands
jsnext:main
andmodule
fields, so when they do bundling they will resolve that files, not the CJSmain
.Specifically, Rollup has plugin to convert CJS to ES2015 modules, but it won't do the tree-shaking magic, so it will be possible to duplicate exact that
extend-shallow
code multiple times if found multiple times.