main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
672 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var Type = require('es-abstract/2024/Type');
|
---|
4 |
|
---|
5 | var $TypeError = require('es-errors/type');
|
---|
6 |
|
---|
7 | var implementation = require('./implementation');
|
---|
8 |
|
---|
9 | var hasProto = [].__proto__ === Array.prototype; // eslint-disable-line no-proto
|
---|
10 |
|
---|
11 | var getProto = function getPrototypeOf(value) {
|
---|
12 | if (Type(value) !== 'Object') {
|
---|
13 | throw new $TypeError('Reflect.getPrototypeOf called on non-object');
|
---|
14 | }
|
---|
15 | return value.__proto__; // eslint-disable-line no-proto
|
---|
16 | };
|
---|
17 |
|
---|
18 | module.exports = function getPolyfill() {
|
---|
19 | if (typeof Reflect === 'object' && Reflect && Reflect.getPrototypeOf) {
|
---|
20 | return Reflect.getPrototypeOf;
|
---|
21 | }
|
---|
22 | if (hasProto) {
|
---|
23 | return getProto;
|
---|
24 | }
|
---|
25 | return implementation;
|
---|
26 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.