MCPcopy Create free account
hub / github.com/buke/quickjs-go / ToPropertyKey

Method ToPropertyKey

value.go:305–316  ·  view source on GitHub ↗

ToPropertyKey returns the value converted to a JavaScript property key.

()

Source from the content-addressed store, hash-verified

303
304// ToPropertyKey returns the value converted to a JavaScript property key.
305func (v *Value) ToPropertyKey() (*Value, error) {
306 if !v.hasValidContext() {
307 return nil, errors.New("value context is not available")
308 }
309
310 converted := &Value{ctx: v.ctx, ref: C.JS_ToPropertyKey(v.ctx.ref, v.ref)}
311 if converted.IsException() {
312 return nil, v.ctx.Exception()
313 }
314
315 return converted, nil
316}
317
318// ToStringUTF16 returns the UTF-16 code units of the string representation of the value.
319func (v *Value) ToStringUTF16() ([]uint16, error) {

Callers 1

Calls 4

hasValidContextMethod · 0.95
IsExceptionMethod · 0.95
NewMethod · 0.80
ExceptionMethod · 0.80

Tested by 1