@@ -62,3 +62,3 @@ import { isNode } from '../nodes/identity.js'; | ||
| const kt = ctx.schema.knownTags[tagName]; | ||
| if (kt && kt.collection === expType) { | ||
| if (kt?.collection === expType) { | ||
| ctx.schema.tags.push(Object.assign({}, kt, { default: false })); | ||
@@ -65,0 +65,0 @@ tag = kt; |
@@ -25,3 +25,3 @@ import { YAMLSeq } from '../nodes/YAMLSeq.js'; | ||
| if (props.anchor || props.tag || value) { | ||
| if (value && value.type === 'block-seq') | ||
| if (value?.type === 'block-seq') | ||
| onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column'); | ||
@@ -28,0 +28,0 @@ else |
@@ -136,3 +136,3 @@ import { isPair } from '../nodes/identity.js'; | ||
| else if (value) { | ||
| if ('source' in value && value.source && value.source[0] === ':') | ||
| if ('source' in value && value.source?.[0] === ':') | ||
| onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`); | ||
@@ -181,3 +181,3 @@ else | ||
| let cePos = offset; | ||
| if (ce && ce.source === expectedEnd) | ||
| if (ce?.source === expectedEnd) | ||
| cePos = ce.offset + ce.source.length; | ||
@@ -184,0 +184,0 @@ else { |
@@ -49,3 +49,3 @@ class YAMLError extends Error { | ||
| const end = error.linePos[1]; | ||
| if (end && end.line === line && end.col > col) { | ||
| if (end?.line === line && end.col > col) { | ||
| count = Math.max(1, Math.min(end.col - col, 80 - ci)); | ||
@@ -52,0 +52,0 @@ } |
@@ -62,3 +62,3 @@ import { anchorIsValid } from '../doc/anchors.js'; | ||
| /* istanbul ignore if */ | ||
| if (!data || data.res === undefined) { | ||
| if (data?.res === undefined) { | ||
| const msg = 'This should not happen: Alias anchor was not resolved?'; | ||
@@ -65,0 +65,0 @@ throw new ReferenceError(msg); |
@@ -229,3 +229,3 @@ import { tokenType } from './cst.js'; | ||
| const top = this.peek(1); | ||
| if (this.type === 'doc-end' && (!top || top.type !== 'doc-end')) { | ||
| if (this.type === 'doc-end' && top?.type !== 'doc-end') { | ||
| while (this.stack.length > 0) | ||
@@ -762,3 +762,3 @@ yield* this.pop(); | ||
| top = this.peek(1); | ||
| } while (top && top.type === 'flow-collection'); | ||
| } while (top?.type === 'flow-collection'); | ||
| } | ||
@@ -765,0 +765,0 @@ else if (fc.end.length === 0) { |
@@ -7,3 +7,3 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) { | ||
| return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf'; | ||
| let n = JSON.stringify(value); | ||
| let n = Object.is(value, -0) ? '-0' : JSON.stringify(value); | ||
| if (!format && | ||
@@ -10,0 +10,0 @@ minFractionDigits && |
@@ -104,3 +104,3 @@ import { isCollection, isNode, isScalar, isSeq } from '../nodes/identity.js'; | ||
| if (valueStr === '' && !ctx.inFlow) { | ||
| if (ws === '\n') | ||
| if (ws === '\n' && valueComment) | ||
| ws = '\n\n'; | ||
@@ -107,0 +107,0 @@ } |
@@ -64,3 +64,3 @@ 'use strict'; | ||
| const kt = ctx.schema.knownTags[tagName]; | ||
| if (kt && kt.collection === expType) { | ||
| if (kt?.collection === expType) { | ||
| ctx.schema.tags.push(Object.assign({}, kt, { default: false })); | ||
@@ -67,0 +67,0 @@ tag = kt; |
@@ -27,3 +27,3 @@ 'use strict'; | ||
| if (props.anchor || props.tag || value) { | ||
| if (value && value.type === 'block-seq') | ||
| if (value?.type === 'block-seq') | ||
| onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column'); | ||
@@ -30,0 +30,0 @@ else |
@@ -138,3 +138,3 @@ 'use strict'; | ||
| else if (value) { | ||
| if ('source' in value && value.source && value.source[0] === ':') | ||
| if ('source' in value && value.source?.[0] === ':') | ||
| onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`); | ||
@@ -183,3 +183,3 @@ else | ||
| let cePos = offset; | ||
| if (ce && ce.source === expectedEnd) | ||
| if (ce?.source === expectedEnd) | ||
| cePos = ce.offset + ce.source.length; | ||
@@ -186,0 +186,0 @@ else { |
+1
-1
@@ -51,3 +51,3 @@ 'use strict'; | ||
| const end = error.linePos[1]; | ||
| if (end && end.line === line && end.col > col) { | ||
| if (end?.line === line && end.col > col) { | ||
| count = Math.max(1, Math.min(end.col - col, 80 - ci)); | ||
@@ -54,0 +54,0 @@ } |
@@ -64,3 +64,3 @@ 'use strict'; | ||
| /* istanbul ignore if */ | ||
| if (!data || data.res === undefined) { | ||
| if (data?.res === undefined) { | ||
| const msg = 'This should not happen: Alias anchor was not resolved?'; | ||
@@ -67,0 +67,0 @@ throw new ReferenceError(msg); |
@@ -234,3 +234,3 @@ 'use strict'; | ||
| const top = this.peek(1); | ||
| if (this.type === 'doc-end' && (!top || top.type !== 'doc-end')) { | ||
| if (this.type === 'doc-end' && top?.type !== 'doc-end') { | ||
| while (this.stack.length > 0) | ||
@@ -767,3 +767,3 @@ yield* this.pop(); | ||
| top = this.peek(1); | ||
| } while (top && top.type === 'flow-collection'); | ||
| } while (top?.type === 'flow-collection'); | ||
| } | ||
@@ -770,0 +770,0 @@ else if (fc.end.length === 0) { |
@@ -9,3 +9,3 @@ 'use strict'; | ||
| return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf'; | ||
| let n = JSON.stringify(value); | ||
| let n = Object.is(value, -0) ? '-0' : JSON.stringify(value); | ||
| if (!format && | ||
@@ -12,0 +12,0 @@ minFractionDigits && |
@@ -106,3 +106,3 @@ 'use strict'; | ||
| if (valueStr === '' && !ctx.inFlow) { | ||
| if (ws === '\n') | ||
| if (ws === '\n' && valueComment) | ||
| ws = '\n\n'; | ||
@@ -109,0 +109,0 @@ } |
+4
-4
| { | ||
| "name": "yaml", | ||
| "version": "2.8.1", | ||
| "version": "2.8.2", | ||
| "license": "ISC", | ||
| "author": "Eemeli Aro <eemeli@gmail.com>", | ||
| "funding": "https://github.com/sponsors/eemeli", | ||
| "repository": "github:eemeli/yaml", | ||
@@ -76,3 +77,3 @@ "description": "JavaScript parser and stringifier for YAML", | ||
| "@rollup/plugin-babel": "^6.0.3", | ||
| "@rollup/plugin-replace": "^5.0.2", | ||
| "@rollup/plugin-replace": "^6.0.3", | ||
| "@rollup/plugin-typescript": "^12.1.1", | ||
@@ -82,5 +83,4 @@ "@types/jest": "^29.2.4", | ||
| "babel-jest": "^29.0.1", | ||
| "cross-env": "^7.0.3", | ||
| "eslint": "^9.9.1", | ||
| "eslint-config-prettier": "^9.0.0", | ||
| "eslint-config-prettier": "^10.1.8", | ||
| "fast-check": "^2.12.0", | ||
@@ -87,0 +87,0 @@ "jest": "^29.0.1", |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
21
-4.55%683007
0