ToIndex returns the value converted to a JavaScript array index.
()
| 247 | |
| 248 | // ToIndex returns the value converted to a JavaScript array index. |
| 249 | func (v *Value) ToIndex() (uint64, error) { |
| 250 | if !v.hasValidContext() { |
| 251 | return 0, errors.New("value context is not available") |
| 252 | } |
| 253 | |
| 254 | val := C.uint64_t(0) |
| 255 | if C.JS_ToIndex(v.ctx.ref, &val, v.ref) != 0 { |
| 256 | return 0, v.ctx.Exception() |
| 257 | } |
| 258 | |
| 259 | return uint64(val), nil |
| 260 | } |
| 261 | |
| 262 | // ToBigInt64 returns the value converted to int64 using BigInt semantics. |
| 263 | func (v *Value) ToBigInt64() (int64, error) { |