MCPcopy Create free account
hub / github.com/dop251/goja / ExampleRuntime_ExportTo_setToMap

Function ExampleRuntime_ExportTo_setToMap

builtin_set_test.go:29–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func ExampleRuntime_ExportTo_setToMap() {
30 vm := New()
31 s, err := vm.RunString(`
32 new Set([1, 2, 3])
33 `)
34 if err != nil {
35 panic(err)
36 }
37 m := make(map[int]struct{})
38 err = vm.ExportTo(s, &m)
39 if err != nil {
40 panic(err)
41 }
42 fmt.Println(m)
43 // Output: map[1:{} 2:{} 3:{}]
44}
45
46func ExampleRuntime_ExportTo_setToSlice() {
47 vm := New()

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
RunStringMethod · 0.80
ExportToMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…