Skip to content

Commit

Permalink
- use native js function for string splitting (remove strings depende…
Browse files Browse the repository at this point in the history
…ncy)
  • Loading branch information
rocketlaunchr-cto committed Aug 7, 2019
1 parent 9eb7eeb commit 5b9a634
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
package react

import (
"strings"

"github.com/gopherjs/gopherjs/js"
)

Expand Down Expand Up @@ -58,9 +56,10 @@ func JSFn(funcName string, args ...interface{}) (_ *js.Object, rErr error) {

out := js.Global

splits := strings.Split(funcName, ".")
for idx, split := range splits {
if idx == len(splits)-1 {
splits := js.Global.Get("String").Invoke(funcName).Call("split", ".")
for idx := 0; idx < splits.Length(); idx++ {
split := splits.Index(idx).String()
if idx == splits.Length()-1 {
out = out.Call(split, args...)
} else {
out = out.Get(split)
Expand Down

0 comments on commit 5b9a634

Please sign in to comment.