Skip to content

Commit

Permalink
Update to work with nil check over len
Browse files Browse the repository at this point in the history
This is to stay consistent with other areas of the codebase
(e.g. toESModuleExports). There could be a valid case where we want
named to be an empty slice and default be non-nil, and not use this
feature to convert from default to namespace exports.
  • Loading branch information
ankur22 committed Nov 14, 2024
1 parent ac530c6 commit 241af93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/modules/gomodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (gm *goModule) Instantiate(rt *sobek.Runtime) (sobek.CyclicModuleInstance,
named := mi.Exports().Named

switch {
case len(named) == 0 && mi.Exports().Default != nil:
case named == nil && mi.Exports().Default != nil:
// If named length is 0 but default is defined, then try to work with
// default and extract the names of the object's properties. This
// behavior isn't ESM compatible, but we do want to allow defaults to
Expand Down

0 comments on commit 241af93

Please sign in to comment.