source: imaps-frontend/node_modules/jsx-ast-utils/lib/values/JSXElement.js

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
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = extractValueFromJSXElement;
7/**
8 * Extractor function for a JSXElement type value node.
9 *
10 * Returns self-closing element with correct name.
11 */
12function 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.