[question] why using named export for this package?
Opened this issue ยท 2 comments
as in the title ๐
That's, indeed, a very good question.
I believe you are right, a named export is unecessary here (given the module only exports a single function).
As removing the named export would be a breaking change, I am wondering if having both a named and a default export a good idea ... Any opinion on this?
I believe this would work
It would certainly work - would only add few bytes to CJS file and none for ESM consumers (thanks to tree-shaking in bundlers, ofc ESM will come to node some time in the future, but those extra few bytes shouldnt be much of a concern there).
For CJS consumers it would mean that both of those would be allowed:
var def = require('callbag-debounce').default
var named = require('callbag-debounce').debounce
def === named // true
To support this:
var debounce = require('callbag-debounce')
we'd have to do some hoops like:
module.exports = debounce
module.exports.default = debounce
module.exports.debounce = debounce
Personally I don't think this is particularly good thing.
If you want I can prepare a PR later providing a default export.