fromPropertyDescriptor.js 580 B

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. module.exports = function fromPropertyDescriptor(Desc) {
  3. if (typeof Desc === 'undefined') {
  4. return Desc;
  5. }
  6. var obj = {};
  7. if ('[[Value]]' in Desc) {
  8. obj.value = Desc['[[Value]]'];
  9. }
  10. if ('[[Writable]]' in Desc) {
  11. obj.writable = !!Desc['[[Writable]]'];
  12. }
  13. if ('[[Get]]' in Desc) {
  14. obj.get = Desc['[[Get]]'];
  15. }
  16. if ('[[Set]]' in Desc) {
  17. obj.set = Desc['[[Set]]'];
  18. }
  19. if ('[[Enumerable]]' in Desc) {
  20. obj.enumerable = !!Desc['[[Enumerable]]'];
  21. }
  22. if ('[[Configurable]]' in Desc) {
  23. obj.configurable = !!Desc['[[Configurable]]'];
  24. }
  25. return obj;
  26. };