ToPropertyKey returns the value converted to a JavaScript property key.
()
| 303 | |
| 304 | // ToPropertyKey returns the value converted to a JavaScript property key. |
| 305 | func (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. |
| 319 | func (v *Value) ToStringUTF16() ([]uint16, error) { |