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

Method ToBigInt64

value.go:263–274  ·  view source on GitHub ↗

ToBigInt64 returns the value converted to int64 using BigInt semantics.

()

Source from the content-addressed store, hash-verified

261
262// ToBigInt64 returns the value converted to int64 using BigInt semantics.
263func (v *Value) ToBigInt64() (int64, error) {
264 if !v.hasValidContext() {
265 return 0, errors.New("value context is not available")
266 }
267
268 val := C.int64_t(0)
269 if C.JS_ToBigInt64(v.ctx.ref, &val, v.ref) != 0 {
270 return 0, v.ctx.Exception()
271 }
272
273 return int64(val), nil
274}
275
276// ToBigUint64 returns the value converted to uint64 using BigInt semantics.
277func (v *Value) ToBigUint64() (uint64, error) {

Callers 1

Calls 3

hasValidContextMethod · 0.95
NewMethod · 0.80
ExceptionMethod · 0.80

Tested by 1