source: imaps-frontend/node_modules/jsx-ast-utils/src/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: 475 bytes
Line 
1/**
2 * Extractor function for a JSXElement type value node.
3 *
4 * Returns self-closing element with correct name.
5 */
6export default function extractValueFromJSXElement(value) {
7 // eslint-disable-next-line global-require
8 const getValue = require('.').default;
9
10 const Tag = value.openingElement.name.name;
11 if (value.openingElement.selfClosing) {
12 return `<${Tag} />`;
13 }
14 return `<${Tag}>${[].concat(value.children).map((x) => getValue(x)).join('')}</${Tag}>`;
15}
Note: See TracBrowser for help on using the repository browser.