source: trip-planner-front/node_modules/@babel/plugin-proposal-json-strings/lib/index.js@ b738035

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

initial commit

  • Property mode set to 100644
File size: 956 bytes
RevLine 
[6a3a178]1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var _helperPluginUtils = require("@babel/helper-plugin-utils");
9
10var _pluginSyntaxJsonStrings = require("@babel/plugin-syntax-json-strings");
11
12var _default = (0, _helperPluginUtils.declare)(api => {
13 api.assertVersion(7);
14 const regex = /(\\*)([\u2028\u2029])/g;
15
16 function replace(match, escapes, separator) {
17 const isEscaped = escapes.length % 2 === 1;
18 if (isEscaped) return match;
19 return `${escapes}\\u${separator.charCodeAt(0).toString(16)}`;
20 }
21
22 return {
23 name: "proposal-json-strings",
24 inherits: _pluginSyntaxJsonStrings.default,
25 visitor: {
26 "DirectiveLiteral|StringLiteral"({
27 node
28 }) {
29 const {
30 extra
31 } = node;
32 if (!(extra != null && extra.raw)) return;
33 extra.raw = extra.raw.replace(regex, replace);
34 }
35
36 }
37 };
38});
39
40exports.default = _default;
Note: See TracBrowser for help on using the repository browser.