Files
NapCatQQ/.pnpm-store/v3/files/11/1a9663c683c2c43b522807afa48afc46841ebda05745db9965173cbee4a17802fd76dbdd3bda14b6697462d09e77dbae4fa71f1fed615ca580420c3ea9f957
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

41 lines
1.1 KiB
Plaintext

'use strict';
var GetIntrinsic = require('get-intrinsic');
var IsCallable = require('es-abstract/2024/IsCallable');
var isObject = require('es-abstract/helpers/isObject');
var whichBuiltinType = require('which-builtin-type');
var $TypeError = require('es-errors/type');
var gPO = require('get-proto');
var $Object = require('es-object-atoms');
module.exports = function getPrototypeOf(O) {
if (!isObject(O)) {
throw new $TypeError('Reflect.getPrototypeOf called on non-object');
}
if (gPO) {
return gPO(O);
}
var type = whichBuiltinType(O);
if (type) {
var intrinsic = GetIntrinsic('%' + type + '.prototype%', true);
if (intrinsic) {
return intrinsic;
}
}
if (IsCallable(O.constructor)) {
return O.constructor.prototype;
}
if (O instanceof Object) {
return $Object.prototype;
}
/*
* Correctly return null for Objects created with `Object.create(null)` (shammed or native) or `{ __proto__: null}`. Also returns null for
* cross-realm objects on browsers that lack `__proto__` support (like IE <11), but that's the best we can do.
*/
return null;
};