|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
404 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Returns the name of the prop given the JSXAttribute object.
|
|---|
| 3 | */
|
|---|
| 4 | export default function propName(prop = {}) {
|
|---|
| 5 | if (!prop.type || prop.type !== 'JSXAttribute') {
|
|---|
| 6 | throw new Error('The prop must be a JSXAttribute collected by the AST parser.');
|
|---|
| 7 | }
|
|---|
| 8 |
|
|---|
| 9 | if (prop.name.type === 'JSXNamespacedName') {
|
|---|
| 10 | return `${prop.name.namespace.name}:${prop.name.name.name}`;
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | return prop.name.name;
|
|---|
| 14 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.