Skip to content

Commit

Permalink
Refactor to a switch
Browse files Browse the repository at this point in the history
This allows us to work with a more go way of working with conditional
branching.
  • Loading branch information
ankur22 committed Nov 15, 2024
1 parent efcd02b commit eb6b5d7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/modules/gomodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ func (gm *goModule) Instantiate(rt *sobek.Runtime) (sobek.CyclicModuleInstance,
if gm.exportedNames == nil {
named := mi.Exports().Named

gm.exportedNames = make([]string, len(named))
for name := range named {
gm.exportedNames = append(gm.exportedNames, name)
switch {
default:
gm.exportedNames = make([]string, len(named))
for name := range named {
gm.exportedNames = append(gm.exportedNames, name)
}
}

for _, callback := range gm.exportedNamesCallbacks {
callback(gm.exportedNames)
}
Expand Down

0 comments on commit eb6b5d7

Please sign in to comment.