diff options
author | Minteck <contact@minteck.org> | 2022-06-04 08:51:19 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-06-04 08:51:19 +0200 |
commit | b22f6770c8bd084d66950655203c61dd701b3d90 (patch) | |
tree | 873d7fb19584ec2709b95cc1ca05a1fc7cfd0fc4 /node_modules/yaml/dist/stringify/stringify.js | |
parent | 383285ecd5292bf9a825e05904955b937de84cc9 (diff) | |
download | equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.gz equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.bz2 equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.zip |
Remove node_modules
Diffstat (limited to 'node_modules/yaml/dist/stringify/stringify.js')
-rw-r--r-- | node_modules/yaml/dist/stringify/stringify.js | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/node_modules/yaml/dist/stringify/stringify.js b/node_modules/yaml/dist/stringify/stringify.js deleted file mode 100644 index b6fd122..0000000 --- a/node_modules/yaml/dist/stringify/stringify.js +++ /dev/null @@ -1,127 +0,0 @@ -'use strict'; - -var anchors = require('../doc/anchors.js'); -var Node = require('../nodes/Node.js'); -var stringifyComment = require('./stringifyComment.js'); -var stringifyString = require('./stringifyString.js'); - -function createStringifyContext(doc, options) { - const opt = Object.assign({ - blockQuote: true, - commentString: stringifyComment.stringifyComment, - defaultKeyType: null, - defaultStringType: 'PLAIN', - directives: null, - doubleQuotedAsJSON: false, - doubleQuotedMinMultiLineLength: 40, - falseStr: 'false', - indentSeq: true, - lineWidth: 80, - minContentWidth: 20, - nullStr: 'null', - simpleKeys: false, - singleQuote: null, - trueStr: 'true', - verifyAliasOrder: true - }, doc.schema.toStringOptions, options); - let inFlow; - switch (opt.collectionStyle) { - case 'block': - inFlow = false; - break; - case 'flow': - inFlow = true; - break; - default: - inFlow = null; - } - return { - anchors: new Set(), - doc, - indent: '', - indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ', - inFlow, - options: opt - }; -} -function getTagObject(tags, item) { - var _a, _b, _c, _d; - if (item.tag) { - const match = tags.filter(t => t.tag === item.tag); - if (match.length > 0) - return (_a = match.find(t => t.format === item.format)) !== null && _a !== void 0 ? _a : match[0]; - } - let tagObj = undefined; - let obj; - if (Node.isScalar(item)) { - obj = item.value; - const match = tags.filter(t => { var _a; return (_a = t.identify) === null || _a === void 0 ? void 0 : _a.call(t, obj); }); - tagObj = - (_b = match.find(t => t.format === item.format)) !== null && _b !== void 0 ? _b : match.find(t => !t.format); - } - else { - obj = item; - tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass); - } - if (!tagObj) { - const name = (_d = (_c = obj === null || obj === void 0 ? void 0 : obj.constructor) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : typeof obj; - throw new Error(`Tag not resolved for ${name} value`); - } - return tagObj; -} -// needs to be called before value stringifier to allow for circular anchor refs -function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) { - if (!doc.directives) - return ''; - const props = []; - const anchor = (Node.isScalar(node) || Node.isCollection(node)) && node.anchor; - if (anchor && anchors.anchorIsValid(anchor)) { - anchors$1.add(anchor); - props.push(`&${anchor}`); - } - const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag; - if (tag) - props.push(doc.directives.tagString(tag)); - return props.join(' '); -} -function stringify(item, ctx, onComment, onChompKeep) { - var _a, _b; - if (Node.isPair(item)) - return item.toString(ctx, onComment, onChompKeep); - if (Node.isAlias(item)) { - if (ctx.doc.directives) - return item.toString(ctx); - if ((_a = ctx.resolvedAliases) === null || _a === void 0 ? void 0 : _a.has(item)) { - throw new TypeError(`Cannot stringify circular structure without alias nodes`); - } - else { - if (ctx.resolvedAliases) - ctx.resolvedAliases.add(item); - else - ctx.resolvedAliases = new Set([item]); - item = item.resolve(ctx.doc); - } - } - let tagObj = undefined; - const node = Node.isNode(item) - ? item - : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) }); - if (!tagObj) - tagObj = getTagObject(ctx.doc.schema.tags, node); - const props = stringifyProps(node, tagObj, ctx); - if (props.length > 0) - ctx.indentAtStart = ((_b = ctx.indentAtStart) !== null && _b !== void 0 ? _b : 0) + props.length + 1; - const str = typeof tagObj.stringify === 'function' - ? tagObj.stringify(node, ctx, onComment, onChompKeep) - : Node.isScalar(node) - ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) - : node.toString(ctx, onComment, onChompKeep); - if (!props) - return str; - return Node.isScalar(node) || str[0] === '{' || str[0] === '[' - ? `${props} ${str}` - : `${props}\n${ctx.indent}${str}`; -} - -exports.createStringifyContext = createStringifyContext; -exports.stringify = stringify; |