mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
## Summary This PR implements four V8 C++ API methods for type checking that are commonly used by native Node.js modules: - `v8::Value::IsMap()` - checks if value is a Map - `v8::Value::IsArray()` - checks if value is an Array - `v8::Value::IsInt32()` - checks if value is a 32-bit integer - `v8::Value::IsBigInt()` - checks if value is a BigInt ## Implementation Details The implementation maps V8's type checking APIs to JavaScriptCore's equivalent functionality: - `IsMap()` uses JSC's `inherits<JSC::JSMap>()` check - `IsArray()` uses JSC's `isArray()` function with the global object - `IsInt32()` uses JSC's `isInt32()` method - `IsBigInt()` uses JSC's `isBigInt()` method ## Changes - Added method declarations to `V8Value.h` - Implemented the methods in `V8Value.cpp` - Added symbol exports to `napi.zig` (both Unix and Windows mangled names) - Added symbols to `symbols.txt` and `symbols.dyn` - Added comprehensive tests in `v8-module/main.cpp` and `v8.test.ts` ## Testing The implementation has been verified to: - Compile successfully without errors - Export the correct symbols in the binary - Follow established patterns in the V8 compatibility layer Tests cover various value types including empty and populated Maps/Arrays, different numeric ranges, BigInts, and other JavaScript types. 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>