blob: 04d28495f99f51c30d7b83d5aebd0d43d84798df [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2
3var GetIntrinsic = require('get-intrinsic');
4
5var $TypeError = GetIntrinsic('%TypeError%');
6
7var has = require('has');
8
9var IsPropertyKey = require('./IsPropertyKey');
10var Type = require('./Type');
11
12// https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty
13
14module.exports = function HasOwnProperty(O, P) {
15 if (Type(O) !== 'Object') {
16 throw new $TypeError('Assertion failed: `O` must be an Object');
17 }
18 if (!IsPropertyKey(P)) {
19 throw new $TypeError('Assertion failed: `P` must be a Property Key');
20 }
21 return has(O, P);
22};