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

Method ToInt64Ext

value.go:291–302  ·  view source on GitHub ↗

ToInt64Ext returns the value converted to int64, accepting BigInt inputs.

()

Source from the content-addressed store, hash-verified

289
290// ToInt64Ext returns the value converted to int64, accepting BigInt inputs.
291func (v *Value) ToInt64Ext() (int64, error) {
292 if !v.hasValidContext() {
293 return 0, errors.New("value context is not available")
294 }
295
296 val := C.int64_t(0)
297 if C.JS_ToInt64Ext(v.ctx.ref, &val, v.ref) != 0 {
298 return 0, v.ctx.Exception()
299 }
300
301 return int64(val), nil
302}
303
304// ToPropertyKey returns the value converted to a JavaScript property key.
305func (v *Value) ToPropertyKey() (*Value, error) {

Callers 1

Calls 3

hasValidContextMethod · 0.95
NewMethod · 0.80
ExceptionMethod · 0.80

Tested by 1