FromPropertyDescriptor.js 536 B

12345678910111213141516
  1. 'use strict';
  2. var $TypeError = require('es-errors/type');
  3. var isPropertyDescriptor = require('../helpers/records/property-descriptor');
  4. var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor');
  5. // https://262.ecma-international.org/6.0/#sec-frompropertydescriptor
  6. module.exports = function FromPropertyDescriptor(Desc) {
  7. if (typeof Desc !== 'undefined' && !isPropertyDescriptor(Desc)) {
  8. throw new $TypeError('Assertion failed: `Desc` must be a Property Descriptor');
  9. }
  10. return fromPropertyDescriptor(Desc);
  11. };