source: imaps-frontend/node_modules/reflect.getprototypeof/implementation.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 6 months ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.1 KB
Line 
1'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4var IsCallable = require('es-abstract/2024/IsCallable');
5var isObject = require('es-abstract/helpers/isObject');
6var whichBuiltinType = require('which-builtin-type');
7var $TypeError = require('es-errors/type');
8
9var gPO = require('get-proto');
10var $Object = require('es-object-atoms');
11
12module.exports = function getPrototypeOf(O) {
13 if (!isObject(O)) {
14 throw new $TypeError('Reflect.getPrototypeOf called on non-object');
15 }
16
17 if (gPO) {
18 return gPO(O);
19 }
20
21 var type = whichBuiltinType(O);
22 if (type) {
23 var intrinsic = GetIntrinsic('%' + type + '.prototype%', true);
24 if (intrinsic) {
25 return intrinsic;
26 }
27 }
28 if (IsCallable(O.constructor)) {
29 return O.constructor.prototype;
30 }
31 if (O instanceof Object) {
32 return $Object.prototype;
33 }
34
35 /*
36 * Correctly return null for Objects created with `Object.create(null)` (shammed or native) or `{ __proto__: null}`. Also returns null for
37 * cross-realm objects on browsers that lack `__proto__` support (like IE <11), but that's the best we can do.
38 */
39 return null;
40};
Note: See TracBrowser for help on using the repository browser.