mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
- Add exact 64-bit and pointer ABIs, static node:ffi bindings, and Darwin framework linking. - Support native memory views and reusable callback pools with checked conversions and lifetime handling. - Preserve the JavaScript values, accessors, and module bindings used during renderer initialization.
11 lines
506 B
JavaScript
11 lines
506 B
JavaScript
console.log(early());
|
|
var getLength = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength")?.get;
|
|
function early() { return getLength === undefined; }
|
|
function isBuffer(value) {
|
|
if (value === null || typeof value !== "object" || getLength == null) return false;
|
|
try { getLength.call(value); return true; } catch { return false; }
|
|
}
|
|
console.log(early(), isBuffer(new ArrayBuffer(4)), isBuffer(JSON.parse('{}')));
|
|
getLength = undefined;
|
|
console.log(early(), isBuffer(new ArrayBuffer(4)));
|