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.

OrdinaryHasProperty.js 537B

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