You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

OrdinaryGetPrototypeOf.js 546B

123456789101112131415161718192021
  1. 'use strict';
  2. var GetIntrinsic = require('../GetIntrinsic');
  3. var $TypeError = GetIntrinsic('%TypeError%');
  4. var $getProto = require('../helpers/getProto');
  5. var Type = require('./Type');
  6. // https://ecma-international.org/ecma-262/7.0/#sec-ordinarygetprototypeof
  7. module.exports = function OrdinaryGetPrototypeOf(O) {
  8. if (Type(O) !== 'Object') {
  9. throw new $TypeError('Assertion failed: O must be an Object');
  10. }
  11. if (!$getProto) {
  12. throw new $TypeError('This environment does not support fetching prototypes.');
  13. }
  14. return $getProto(O);
  15. };