main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
573 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = propName;
|
---|
7 | /**
|
---|
8 | * Returns the name of the prop given the JSXAttribute object.
|
---|
9 | */
|
---|
10 | function propName() {
|
---|
11 | var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
---|
12 |
|
---|
13 | if (!prop.type || prop.type !== 'JSXAttribute') {
|
---|
14 | throw new Error('The prop must be a JSXAttribute collected by the AST parser.');
|
---|
15 | }
|
---|
16 |
|
---|
17 | if (prop.name.type === 'JSXNamespacedName') {
|
---|
18 | return prop.name.namespace.name + ':' + prop.name.name.name;
|
---|
19 | }
|
---|
20 |
|
---|
21 | return prop.name.name;
|
---|
22 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.