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

Function ExampleRuntime_ExportTo_mapToSlice

builtin_map_test.go:173–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

171}
172
173func ExampleRuntime_ExportTo_mapToSlice() {
174 vm := New()
175 m, err := vm.RunString(`
176 new Map([[1, true], [2, false]]);
177 `)
178 if err != nil {
179 panic(err)
180 }
181 exp := make([][]interface{}, 0)
182 err = vm.ExportTo(m, &exp)
183 if err != nil {
184 panic(err)
185 }
186 fmt.Println(exp)
187 // Output: [[1 true] [2 false]]
188}
189
190func ExampleRuntime_ExportTo_mapToTypedSlice() {
191 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…