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

Function ExampleRuntime_ExportTo_mapToMap

builtin_map_test.go:156–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154}
155
156func ExampleRuntime_ExportTo_mapToMap() {
157 vm := New()
158 m, err := vm.RunString(`
159 new Map([[1, true], [2, false]]);
160 `)
161 if err != nil {
162 panic(err)
163 }
164 exp := make(map[int]bool)
165 err = vm.ExportTo(m, &exp)
166 if err != nil {
167 panic(err)
168 }
169 fmt.Println(exp)
170 // Output: map[1:true 2:false]
171}
172
173func ExampleRuntime_ExportTo_mapToSlice() {
174 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…