-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
If I have a module mymodule which exports a function with properties, as follows:
module.exports = function mymodule() { /* ... */ }
module.exports.foo = 1
How am I supposed to "statify" it, without choosing whether to restrict my client code to use either the function or the properties?
// Case 1: statify the function
staticModule({
mymodule: function () { return '"something"' }
}) // Bad! cannot access require('mymodule').foo
// Case 2: statify the props
staticModule({
mymodule: {
foo: function() { return '1' }
}
}) // Bad! cannot call require('mymodule')()
My use case is my project over at fabiosantoscode/require-emscripten, which is a node module exporting a function which also has properties.
cancerberoSgx