summaryrefslogtreecommitdiff
path: root/alarm/node_modules/graphql/language/blockString.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
committerMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
commit99c1d9af689e5325f3cf535c4007b3aeb8325229 (patch)
treee663b3c2ebdbd67c818ac0c5147f0ce1d2463cda /alarm/node_modules/graphql/language/blockString.js
parent9871b03912fc28ad38b4037ebf26a78aa937baba (diff)
downloadpluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.gz
pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.bz2
pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.zip
Update - This is an automated commit
Diffstat (limited to 'alarm/node_modules/graphql/language/blockString.js')
-rw-r--r--alarm/node_modules/graphql/language/blockString.js134
1 files changed, 0 insertions, 134 deletions
diff --git a/alarm/node_modules/graphql/language/blockString.js b/alarm/node_modules/graphql/language/blockString.js
deleted file mode 100644
index a195041..0000000
--- a/alarm/node_modules/graphql/language/blockString.js
+++ /dev/null
@@ -1,134 +0,0 @@
-"use strict";
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.dedentBlockStringValue = dedentBlockStringValue;
-exports.getBlockStringIndentation = getBlockStringIndentation;
-exports.printBlockString = printBlockString;
-
-/**
- * Produces the value of a block string from its parsed raw value, similar to
- * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.
- *
- * This implements the GraphQL spec's BlockStringValue() static algorithm.
- *
- * @internal
- */
-function dedentBlockStringValue(rawString) {
- // Expand a block string's raw value into independent lines.
- var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first.
-
- var commonIndent = getBlockStringIndentation(rawString);
-
- if (commonIndent !== 0) {
- for (var i = 1; i < lines.length; i++) {
- lines[i] = lines[i].slice(commonIndent);
- }
- } // Remove leading and trailing blank lines.
-
-
- var startLine = 0;
-
- while (startLine < lines.length && isBlank(lines[startLine])) {
- ++startLine;
- }
-
- var endLine = lines.length;
-
- while (endLine > startLine && isBlank(lines[endLine - 1])) {
- --endLine;
- } // Return a string of the lines joined with U+000A.
-
-
- return lines.slice(startLine, endLine).join('\n');
-}
-
-function isBlank(str) {
- for (var i = 0; i < str.length; ++i) {
- if (str[i] !== ' ' && str[i] !== '\t') {
- return false;
- }
- }
-
- return true;
-}
-/**
- * @internal
- */
-
-
-function getBlockStringIndentation(value) {
- var _commonIndent;
-
- var isFirstLine = true;
- var isEmptyLine = true;
- var indent = 0;
- var commonIndent = null;
-
- for (var i = 0; i < value.length; ++i) {
- switch (value.charCodeAt(i)) {
- case 13:
- // \r
- if (value.charCodeAt(i + 1) === 10) {
- ++i; // skip \r\n as one symbol
- }
-
- // falls through
-
- case 10:
- // \n
- isFirstLine = false;
- isEmptyLine = true;
- indent = 0;
- break;
-
- case 9: // \t
-
- case 32:
- // <space>
- ++indent;
- break;
-
- default:
- if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) {
- commonIndent = indent;
- }
-
- isEmptyLine = false;
- }
- }
-
- return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0;
-}
-/**
- * Print a block string in the indented block form by adding a leading and
- * trailing blank line. However, if a block string starts with whitespace and is
- * a single-line, adding a leading blank line would strip that whitespace.
- *
- * @internal
- */
-
-
-function printBlockString(value) {
- var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
- var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- var isSingleLine = value.indexOf('\n') === -1;
- var hasLeadingSpace = value[0] === ' ' || value[0] === '\t';
- var hasTrailingQuote = value[value.length - 1] === '"';
- var hasTrailingSlash = value[value.length - 1] === '\\';
- var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines;
- var result = ''; // Format a multi-line block quote to account for leading space.
-
- if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) {
- result += '\n' + indentation;
- }
-
- result += indentation ? value.replace(/\n/g, '\n' + indentation) : value;
-
- if (printAsMultipleLines) {
- result += '\n';
- }
-
- return '"""' + result.replace(/"""/g, '\\"""') + '"""';
-}