diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/bindings/bindings.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index ab8286b06..3fada34c4 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -3135,6 +3135,14 @@ pub const JSValue = enum(JSValueReprInt) { } pub fn toInt64(this: JSValue) i64 { + if (this.isInt32()) { + return this.asInt32(); + } + + if (this.isNumber()) { + return @floatToInt(i64, this.asDouble()); + } + return cppFn("toInt64", .{this}); } |