summaryrefslogtreecommitdiff
path: root/school/node_modules/graphql/language/printLocation.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
committerMinteck <contact@minteck.org>2023-02-23 19:34:56 +0100
commit3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 (patch)
tree75be5fba4368472fb11c8015aee026b2b9a71888 /school/node_modules/graphql/language/printLocation.js
parent8cc1f13c17fa2fb5a4410542d39e650e02945634 (diff)
downloadpluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.gz
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.bz2
pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.zip
Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated)
Diffstat (limited to 'school/node_modules/graphql/language/printLocation.js')
-rw-r--r--school/node_modules/graphql/language/printLocation.js75
1 files changed, 0 insertions, 75 deletions
diff --git a/school/node_modules/graphql/language/printLocation.js b/school/node_modules/graphql/language/printLocation.js
deleted file mode 100644
index 86987ba..0000000
--- a/school/node_modules/graphql/language/printLocation.js
+++ /dev/null
@@ -1,75 +0,0 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.printLocation = printLocation;
-exports.printSourceLocation = printSourceLocation;
-
-var _location = require("./location.js");
-
-/**
- * Render a helpful description of the location in the GraphQL Source document.
- */
-function printLocation(location) {
- return printSourceLocation(location.source, (0, _location.getLocation)(location.source, location.start));
-}
-/**
- * Render a helpful description of the location in the GraphQL Source document.
- */
-
-
-function printSourceLocation(source, sourceLocation) {
- var firstLineColumnOffset = source.locationOffset.column - 1;
- var body = whitespace(firstLineColumnOffset) + source.body;
- var lineIndex = sourceLocation.line - 1;
- var lineOffset = source.locationOffset.line - 1;
- var lineNum = sourceLocation.line + lineOffset;
- var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;
- var columnNum = sourceLocation.column + columnOffset;
- var locationStr = "".concat(source.name, ":").concat(lineNum, ":").concat(columnNum, "\n");
- var lines = body.split(/\r\n|[\n\r]/g);
- var locationLine = lines[lineIndex]; // Special case for minified documents
-
- if (locationLine.length > 120) {
- var subLineIndex = Math.floor(columnNum / 80);
- var subLineColumnNum = columnNum % 80;
- var subLines = [];
-
- for (var i = 0; i < locationLine.length; i += 80) {
- subLines.push(locationLine.slice(i, i + 80));
- }
-
- return locationStr + printPrefixedLines([["".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) {
- return ['', subLine];
- }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]]));
- }
-
- return locationStr + printPrefixedLines([// Lines specified like this: ["prefix", "string"],
- ["".concat(lineNum - 1), lines[lineIndex - 1]], ["".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1), lines[lineIndex + 1]]]);
-}
-
-function printPrefixedLines(lines) {
- var existingLines = lines.filter(function (_ref) {
- var _ = _ref[0],
- line = _ref[1];
- return line !== undefined;
- });
- var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) {
- var prefix = _ref2[0];
- return prefix.length;
- }));
- return existingLines.map(function (_ref3) {
- var prefix = _ref3[0],
- line = _ref3[1];
- return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |');
- }).join('\n');
-}
-
-function whitespace(len) {
- return Array(len + 1).join(' ');
-}
-
-function leftPad(len, str) {
- return whitespace(len - str.length) + str;
-}