|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
600 bytes
|
| Line | |
|---|
| 1 | const JS_RESERVED = {
|
|---|
| 2 | Array,
|
|---|
| 3 | Date,
|
|---|
| 4 | Infinity,
|
|---|
| 5 | Math,
|
|---|
| 6 | Number,
|
|---|
| 7 | Object,
|
|---|
| 8 | String,
|
|---|
| 9 | undefined,
|
|---|
| 10 | };
|
|---|
| 11 |
|
|---|
| 12 | /**
|
|---|
| 13 | * Extractor function for a Identifier type value node.
|
|---|
| 14 | * An Identifier is usually a reference to a variable.
|
|---|
| 15 | * Just return variable name to determine its existence.
|
|---|
| 16 | *
|
|---|
| 17 | * @param - value - AST Value object with type `Identifier`
|
|---|
| 18 | * @returns - The extracted value converted to correct type.
|
|---|
| 19 | */
|
|---|
| 20 | export default function extractValueFromIdentifier(value) {
|
|---|
| 21 | const { name } = value;
|
|---|
| 22 |
|
|---|
| 23 | if (Object.hasOwnProperty.call(JS_RESERVED, name)) {
|
|---|
| 24 | return JS_RESERVED[name];
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | return name;
|
|---|
| 28 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.