We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb40b4b commit 7679c3fCopy full SHA for 7679c3f
src/util/values/expressions/ObjectExpression.js
@@ -0,0 +1,18 @@
1
+'use strict';
2
+
3
+import getValue from './index';
4
5
6
7
+/**
8
+ * Extractor function for an ObjectExpression type value node.
9
+ * An object expression is using {}.
10
+ *
11
+ * @returns - a representation of the object
12
+ */
13
+export default function extractValueFromObjectExpression(value) {
14
+ return value.properties.reduce((obj, property) => {
15
+ obj[property.key] = getValue(property.value);
16
+ return obj;
17
+ }, {});
18
+}
0 commit comments