1 | "use strict";
|
2 |
|
3 | require("core-js/modules/es.array.concat.js");
|
4 |
|
5 | require("core-js/modules/es.array.join.js");
|
6 |
|
7 | require("core-js/modules/es.array.slice.js");
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", {
|
10 | value: true
|
11 | });
|
12 | var _exportNames = {
|
13 | extractSource: true
|
14 | };
|
15 | exports.extractSource = extractSource;
|
16 |
|
17 | var _types = require("./types");
|
18 |
|
19 | Object.keys(_types).forEach(function (key) {
|
20 | if (key === "default" || key === "__esModule") return;
|
21 | if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
22 | if (key in exports && exports[key] === _types[key]) return;
|
23 | Object.defineProperty(exports, key, {
|
24 | enumerable: true,
|
25 | get: function get() {
|
26 | return _types[key];
|
27 | }
|
28 | });
|
29 | });
|
30 |
|
31 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
32 |
|
33 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
34 |
|
35 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
36 |
|
37 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
38 |
|
39 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
40 |
|
41 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | function extractSource(location, lines) {
|
47 | var start = location.startBody,
|
48 | end = location.endBody;
|
49 |
|
50 | if (start.line === end.line && lines[start.line - 1] !== undefined) {
|
51 | return lines[start.line - 1].substring(start.col, end.col);
|
52 | }
|
53 |
|
54 |
|
55 | var startLine = lines[start.line - 1];
|
56 | var endLine = lines[end.line - 1];
|
57 |
|
58 | if (startLine === undefined || endLine === undefined) {
|
59 | return null;
|
60 | }
|
61 |
|
62 | return [startLine.substring(start.col)].concat(_toConsumableArray(lines.slice(start.line, end.line - 1)), [endLine.substring(0, end.col)]).join('\n');
|
63 | } |
\ | No newline at end of file |