mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Simplify .protect & unprotect (#16441)
This commit is contained in:
@@ -4322,12 +4322,12 @@ pub const JSValue = enum(i64) {
|
||||
}
|
||||
|
||||
pub fn protect(this: JSValue) void {
|
||||
if (this.isEmptyOrUndefinedOrNull() or this.isNumber()) return;
|
||||
if (!this.isCell()) return;
|
||||
JSC.C.JSValueProtect(JSC.VirtualMachine.get().global, this.asObjectRef());
|
||||
}
|
||||
|
||||
pub fn unprotect(this: JSValue) void {
|
||||
if (this.isEmptyOrUndefinedOrNull() or this.isNumber()) return;
|
||||
if (!this.isCell()) return;
|
||||
JSC.C.JSValueUnprotect(JSC.VirtualMachine.get().global, this.asObjectRef());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user