@@ -59557,7 +59557,7 @@ function composeCollection(CN, ctx, token, props, onError) {
5955759557 let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
5955859558 if (!tag) {
5955959559 const kt = ctx.schema.knownTags[tagName];
59560- if (kt && kt .collection === expType) {
59560+ if (kt? .collection === expType) {
5956159561 ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
5956259562 tag = kt;
5956359563 }
@@ -60443,7 +60443,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
6044360443 });
6044460444 if (!props.found) {
6044560445 if (props.anchor || props.tag || value) {
60446- if (value && value .type === 'block-seq')
60446+ if (value? .type === 'block-seq')
6044760447 onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
6044860448 else
6044960449 onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
@@ -60660,7 +60660,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
6066060660 }
6066160661 }
6066260662 else if (value) {
60663- if ('source' in value && value.source && value.source [0] === ':')
60663+ if ('source' in value && value.source?. [0] === ':')
6066460664 onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);
6066560665 else
6066660666 onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);
@@ -60704,7 +60704,7 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
6070460704 const expectedEnd = isMap ? '}' : ']';
6070560705 const [ce, ...ee] = fc.end;
6070660706 let cePos = offset;
60707- if (ce && ce .source === expectedEnd)
60707+ if (ce? .source === expectedEnd)
6070860708 cePos = ce.offset + ce.source.length;
6070960709 else {
6071060710 const name = fcName[0].toUpperCase() + fcName.substring(1);
@@ -62085,7 +62085,7 @@ const prettifyError = (src, lc) => (error) => {
6208562085 if (/[^ ]/.test(lineStr)) {
6208662086 let count = 1;
6208762087 const end = error.linePos[1];
62088- if (end && end .line === line && end.col > col) {
62088+ if (end? .line === line && end.col > col) {
6208962089 count = Math.max(1, Math.min(end.col - col, 80 - ci));
6209062090 }
6209162091 const pointer = ' '.repeat(ci) + '^'.repeat(count);
@@ -62253,7 +62253,7 @@ class Alias extends Node.NodeBase {
6225362253 data = anchors.get(source);
6225462254 }
6225562255 /* istanbul ignore if */
62256- if (! data || data .res === undefined) {
62256+ if (data? .res === undefined) {
6225762257 const msg = 'This should not happen: Alias anchor was not resolved?';
6225862258 throw new ReferenceError(msg);
6225962259 }
@@ -64595,7 +64595,7 @@ class Parser {
6459564595 }
6459664596 *step() {
6459764597 const top = this.peek(1);
64598- if (this.type === 'doc-end' && (! top || top .type !== 'doc-end') ) {
64598+ if (this.type === 'doc-end' && top? .type !== 'doc-end') {
6459964599 while (this.stack.length > 0)
6460064600 yield* this.pop();
6460164601 this.stack.push({
@@ -65127,7 +65127,7 @@ class Parser {
6512765127 do {
6512865128 yield* this.pop();
6512965129 top = this.peek(1);
65130- } while (top && top .type === 'flow-collection');
65130+ } while (top? .type === 'flow-collection');
6513165131 }
6513265132 else if (fc.end.length === 0) {
6513365133 switch (this.type) {
@@ -67313,7 +67313,7 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
6731367313 const num = typeof value === 'number' ? value : Number(value);
6731467314 if (!isFinite(num))
6731567315 return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';
67316- let n = JSON.stringify(value);
67316+ let n = Object.is(value, -0) ? '-0' : JSON.stringify(value);
6731767317 if (!format &&
6731867318 minFractionDigits &&
6731967319 (!tag || tag === 'tag:yaml.org,2002:float') &&
@@ -67444,7 +67444,7 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
6744467444 ws += `\n${stringifyComment.indentComment(cs, ctx.indent)}`;
6744567445 }
6744667446 if (valueStr === '' && !ctx.inFlow) {
67447- if (ws === '\n')
67447+ if (ws === '\n' && valueComment )
6744867448 ws = '\n\n';
6744967449 }
6745067450 else {
0 commit comments