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:
771 bytes
|
Rev | Line | |
---|
[d565449] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
---|
| 4 | value: true
|
---|
| 5 | });
|
---|
| 6 | exports.default = extractValueFromIdentifier;
|
---|
| 7 | var JS_RESERVED = {
|
---|
| 8 | Array: Array,
|
---|
| 9 | Date: Date,
|
---|
| 10 | Infinity: Infinity,
|
---|
| 11 | Math: Math,
|
---|
| 12 | Number: Number,
|
---|
| 13 | Object: Object,
|
---|
| 14 | String: String,
|
---|
| 15 | undefined: undefined
|
---|
| 16 | };
|
---|
| 17 |
|
---|
| 18 | /**
|
---|
| 19 | * Extractor function for a Identifier type value node.
|
---|
| 20 | * An Identifier is usually a reference to a variable.
|
---|
| 21 | * Just return variable name to determine its existence.
|
---|
| 22 | *
|
---|
| 23 | * @param - value - AST Value object with type `Identifier`
|
---|
| 24 | * @returns - The extracted value converted to correct type.
|
---|
| 25 | */
|
---|
| 26 | function extractValueFromIdentifier(value) {
|
---|
| 27 | var name = value.name;
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | if (Object.hasOwnProperty.call(JS_RESERVED, name)) {
|
---|
| 31 | return JS_RESERVED[name];
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | return name;
|
---|
| 35 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.