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

Method keyToString

object_gomap_reflect.go:268–294  ·  view source on GitHub ↗
(key reflect.Value)

Source from the content-addressed store, hash-verified

266}
267
268func (*objectGoMapReflect) keyToString(key reflect.Value) String {
269 kind := key.Kind()
270
271 if kind == reflect.String {
272 return newStringValue(key.String())
273 }
274
275 str := fmt.Sprintf("%v", key)
276
277 switch kind {
278 case reflect.Int,
279 reflect.Int8,
280 reflect.Int16,
281 reflect.Int32,
282 reflect.Int64,
283 reflect.Uint,
284 reflect.Uint8,
285 reflect.Uint16,
286 reflect.Uint32,
287 reflect.Uint64,
288 reflect.Float32,
289 reflect.Float64:
290 return asciiString(str)
291 default:
292 return newStringValue(str)
293 }
294}

Callers 2

stringKeysMethod · 0.95
nextMethod · 0.80

Calls 3

newStringValueFunction · 0.85
asciiStringTypeAlias · 0.85
StringMethod · 0.65

Tested by

no test coverage detected