Skip to content

Commit 7679c3f

Browse files
committed
[new] - Implement ObjectExpression expression handler.
1 parent fb40b4b commit 7679c3f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)