aboutsummaryrefslogtreecommitdiff
path: root/node_modules/yaml/dist/parse/cst-stringify.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-06-04 08:51:19 +0200
committerMinteck <contact@minteck.org>2022-06-04 08:51:19 +0200
commitb22f6770c8bd084d66950655203c61dd701b3d90 (patch)
tree873d7fb19584ec2709b95cc1ca05a1fc7cfd0fc4 /node_modules/yaml/dist/parse/cst-stringify.js
parent383285ecd5292bf9a825e05904955b937de84cc9 (diff)
downloadequestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.gz
equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.bz2
equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.zip
Remove node_modules
Diffstat (limited to 'node_modules/yaml/dist/parse/cst-stringify.js')
-rw-r--r--node_modules/yaml/dist/parse/cst-stringify.js63
1 files changed, 0 insertions, 63 deletions
diff --git a/node_modules/yaml/dist/parse/cst-stringify.js b/node_modules/yaml/dist/parse/cst-stringify.js
deleted file mode 100644
index 78e8c37..0000000
--- a/node_modules/yaml/dist/parse/cst-stringify.js
+++ /dev/null
@@ -1,63 +0,0 @@
-'use strict';
-
-/**
- * Stringify a CST document, token, or collection item
- *
- * Fair warning: This applies no validation whatsoever, and
- * simply concatenates the sources in their logical order.
- */
-const stringify = (cst) => 'type' in cst ? stringifyToken(cst) : stringifyItem(cst);
-function stringifyToken(token) {
- switch (token.type) {
- case 'block-scalar': {
- let res = '';
- for (const tok of token.props)
- res += stringifyToken(tok);
- return res + token.source;
- }
- case 'block-map':
- case 'block-seq': {
- let res = '';
- for (const item of token.items)
- res += stringifyItem(item);
- return res;
- }
- case 'flow-collection': {
- let res = token.start.source;
- for (const item of token.items)
- res += stringifyItem(item);
- for (const st of token.end)
- res += st.source;
- return res;
- }
- case 'document': {
- let res = stringifyItem(token);
- if (token.end)
- for (const st of token.end)
- res += st.source;
- return res;
- }
- default: {
- let res = token.source;
- if ('end' in token && token.end)
- for (const st of token.end)
- res += st.source;
- return res;
- }
- }
-}
-function stringifyItem({ start, key, sep, value }) {
- let res = '';
- for (const st of start)
- res += st.source;
- if (key)
- res += stringifyToken(key);
- if (sep)
- for (const st of sep)
- res += st.source;
- if (value)
- res += stringifyToken(value);
- return res;
-}
-
-exports.stringify = stringify;