source: trip-planner-front/node_modules/@babel/generator/lib/generators/template-literals.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 898 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.TaggedTemplateExpression = TaggedTemplateExpression;
7exports.TemplateElement = TemplateElement;
8exports.TemplateLiteral = TemplateLiteral;
9
10var t = require("@babel/types");
11
12function TaggedTemplateExpression(node) {
13 this.print(node.tag, node);
14 this.print(node.typeParameters, node);
15 this.print(node.quasi, node);
16}
17
18function TemplateElement(node, parent) {
19 const isFirst = parent.quasis[0] === node;
20 const isLast = parent.quasis[parent.quasis.length - 1] === node;
21 const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${");
22 this.token(value);
23}
24
25function TemplateLiteral(node) {
26 const quasis = node.quasis;
27
28 for (let i = 0; i < quasis.length; i++) {
29 this.print(quasis[i], node);
30
31 if (i + 1 < quasis.length) {
32 this.print(node.expressions[i], node);
33 }
34 }
35}
Note: See TracBrowser for help on using the repository browser.