1 |
3a515b92
|
cagy
|
'use strict';
|
2 |
|
|
|
3 |
|
|
var GetIntrinsic = require('../GetIntrinsic');
|
4 |
|
|
|
5 |
|
|
var $TypeError = GetIntrinsic('%TypeError%');
|
6 |
|
|
|
7 |
|
|
var IsPropertyKey = require('./IsPropertyKey');
|
8 |
|
|
var Type = require('./Type');
|
9 |
|
|
|
10 |
|
|
// https://www.ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty
|
11 |
|
|
|
12 |
|
|
module.exports = function OrdinaryHasProperty(O, P) {
|
13 |
|
|
if (Type(O) !== 'Object') {
|
14 |
|
|
throw new $TypeError('Assertion failed: Type(O) is not Object');
|
15 |
|
|
}
|
16 |
|
|
if (!IsPropertyKey(P)) {
|
17 |
|
|
throw new $TypeError('Assertion failed: P must be a Property Key');
|
18 |
|
|
}
|
19 |
|
|
return P in O;
|
20 |
|
|
};
|