| Leo Repp | 58b9f11 | 2021-11-22 11:57:47 +0100 | [diff] [blame^] | 1 | 'use strict'; |
| 2 | |
| 3 | var GetIntrinsic = require('get-intrinsic'); |
| 4 | |
| 5 | var $TypeError = GetIntrinsic('%TypeError%'); |
| 6 | |
| 7 | var has = require('has'); |
| 8 | |
| 9 | var IsPropertyKey = require('./IsPropertyKey'); |
| 10 | var Type = require('./Type'); |
| 11 | |
| 12 | // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty |
| 13 | |
| 14 | module.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 | }; |