main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
685 bytes
|
Rev | Line | |
---|
[d565449] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = extractValueFromMemberExpression;
|
---|
| 7 | /**
|
---|
| 8 | * Extractor function for a MemberExpression type value node.
|
---|
| 9 | * A member expression is accessing a property on an object `obj.property`.
|
---|
| 10 | *
|
---|
| 11 | * @param - value - AST Value object with type `MemberExpression`
|
---|
| 12 | * @returns - The extracted value converted to correct type
|
---|
| 13 | * and maintaing `obj.property` convention.
|
---|
| 14 | */
|
---|
| 15 | function extractValueFromMemberExpression(value) {
|
---|
| 16 | // eslint-disable-next-line global-require
|
---|
| 17 | var getValue = require('.').default;
|
---|
| 18 | return '' + getValue(value.object) + (value.optional ? '?.' : '.') + getValue(value.property);
|
---|
| 19 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.