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:
625 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = extractValueFromJSXElement;
|
---|
7 | /**
|
---|
8 | * Extractor function for a JSXElement type value node.
|
---|
9 | *
|
---|
10 | * Returns self-closing element with correct name.
|
---|
11 | */
|
---|
12 | function extractValueFromJSXElement(value) {
|
---|
13 | // eslint-disable-next-line global-require
|
---|
14 | var getValue = require('.').default;
|
---|
15 |
|
---|
16 | var Tag = value.openingElement.name.name;
|
---|
17 | if (value.openingElement.selfClosing) {
|
---|
18 | return '<' + Tag + ' />';
|
---|
19 | }
|
---|
20 | return '<' + Tag + '>' + [].concat(value.children).map(function (x) {
|
---|
21 | return getValue(x);
|
---|
22 | }).join('') + '</' + Tag + '>';
|
---|
23 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.