Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/es-abstract/2015/FromPropertyDescriptor.js')
-rw-r--r--node_modules/es-abstract/2015/FromPropertyDescriptor.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/node_modules/es-abstract/2015/FromPropertyDescriptor.js b/node_modules/es-abstract/2015/FromPropertyDescriptor.js
new file mode 100644
index 000000000..5ec200edb
--- /dev/null
+++ b/node_modules/es-abstract/2015/FromPropertyDescriptor.js
@@ -0,0 +1,36 @@
+'use strict';
+
+var assertRecord = require('../helpers/assertRecord');
+
+var Type = require('./Type');
+
+// https://www.ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
+
+module.exports = function FromPropertyDescriptor(Desc) {
+ if (typeof Desc === 'undefined') {
+ return Desc;
+ }
+
+ assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
+
+ var obj = {};
+ if ('[[Value]]' in Desc) {
+ obj.value = Desc['[[Value]]'];
+ }
+ if ('[[Writable]]' in Desc) {
+ obj.writable = Desc['[[Writable]]'];
+ }
+ if ('[[Get]]' in Desc) {
+ obj.get = Desc['[[Get]]'];
+ }
+ if ('[[Set]]' in Desc) {
+ obj.set = Desc['[[Set]]'];
+ }
+ if ('[[Enumerable]]' in Desc) {
+ obj.enumerable = Desc['[[Enumerable]]'];
+ }
+ if ('[[Configurable]]' in Desc) {
+ obj.configurable = Desc['[[Configurable]]'];
+ }
+ return obj;
+};