aboutsummaryrefslogtreecommitdiff
path: root/node_modules/yaml/dist/compose/resolve-end.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-06-04 08:51:01 +0200
committerMinteck <contact@minteck.org>2022-06-04 08:51:01 +0200
commit383285ecd5292bf9a825e05904955b937de84cc9 (patch)
tree0a53b6f02c1604b078044567c03dc1b6c944c8c2 /node_modules/yaml/dist/compose/resolve-end.js
downloadequestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.gz
equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.bz2
equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.zip
Initial commit
Diffstat (limited to 'node_modules/yaml/dist/compose/resolve-end.js')
-rw-r--r--node_modules/yaml/dist/compose/resolve-end.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/node_modules/yaml/dist/compose/resolve-end.js b/node_modules/yaml/dist/compose/resolve-end.js
new file mode 100644
index 0000000..3a58347
--- /dev/null
+++ b/node_modules/yaml/dist/compose/resolve-end.js
@@ -0,0 +1,39 @@
+'use strict';
+
+function resolveEnd(end, offset, reqSpace, onError) {
+ let comment = '';
+ if (end) {
+ let hasSpace = false;
+ let sep = '';
+ for (const token of end) {
+ const { source, type } = token;
+ switch (type) {
+ case 'space':
+ hasSpace = true;
+ break;
+ case 'comment': {
+ if (reqSpace && !hasSpace)
+ onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');
+ const cb = source.substring(1) || ' ';
+ if (!comment)
+ comment = cb;
+ else
+ comment += sep + cb;
+ sep = '';
+ break;
+ }
+ case 'newline':
+ if (comment)
+ sep += source;
+ hasSpace = true;
+ break;
+ default:
+ onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${type} at node end`);
+ }
+ offset += source.length;
+ }
+ }
+ return { comment, offset };
+}
+
+exports.resolveEnd = resolveEnd;