Socket
Socket
Sign inDemoInstall

yaml

Package Overview
Dependencies
0
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.0 to 2.4.1

5

browser/dist/parse/parser.js

@@ -516,3 +516,6 @@ import { tokenType } from './cst.js';

if (this.indent >= map.indent) {
const atNextItem = !this.onKeyLine && this.indent === map.indent && it.sep;
const atNextItem = !this.onKeyLine &&
this.indent === map.indent &&
it.sep &&
this.type !== 'seq-item-ind';
// For empty nodes, assign newline-separated not indented empty tokens to following node

@@ -519,0 +522,0 @@ let start = [];

29

browser/dist/stringify/foldFlowLines.js

@@ -31,3 +31,3 @@ const FOLD_FLOW = 'flow';

if (mode === FOLD_BLOCK) {
i = consumeMoreIndentedLines(text, i);
i = consumeMoreIndentedLines(text, i, indent.length);
if (i !== -1)

@@ -56,4 +56,4 @@ end = i + endStep;

if (mode === FOLD_BLOCK)
i = consumeMoreIndentedLines(text, i);
end = i + endStep;
i = consumeMoreIndentedLines(text, i, indent.length);
end = i + indent.length + endStep;
split = undefined;

@@ -126,13 +126,22 @@ }

*/
function consumeMoreIndentedLines(text, i) {
let ch = text[i + 1];
function consumeMoreIndentedLines(text, i, indent) {
let end = i;
let start = i + 1;
let ch = text[start];
while (ch === ' ' || ch === '\t') {
do {
ch = text[(i += 1)];
} while (ch && ch !== '\n');
ch = text[i + 1];
if (i < start + indent) {
ch = text[++i];
}
else {
do {
ch = text[++i];
} while (ch && ch !== '\n');
end = i;
start = i + 1;
ch = text[start];
}
}
return i;
return end;
}
export { FOLD_BLOCK, FOLD_FLOW, FOLD_QUOTED, foldFlowLines };

@@ -61,3 +61,3 @@ import { isNode, isPair } from '../nodes/identity.js';

}
function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;

@@ -115,6 +115,5 @@ itemIndent += indentStep;

}
let str;
const { start, end } = flowChars;
if (lines.length === 0) {
str = start + end;
return start + end;
}

@@ -127,17 +126,11 @@ else {

if (reqNewline) {
str = start;
let str = start;
for (const line of lines)
str += line ? `\n${indentStep}${indent}${line}` : '\n';
str += `\n${indent}${end}`;
return `${str}\n${indent}${end}`;
}
else {
str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
}
}
if (comment) {
str += lineComment(str, indent, commentString(comment));
if (onComment)
onComment();
}
return str;
}

@@ -144,0 +137,0 @@ function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {

@@ -520,3 +520,6 @@ 'use strict';

if (this.indent >= map.indent) {
const atNextItem = !this.onKeyLine && this.indent === map.indent && it.sep;
const atNextItem = !this.onKeyLine &&
this.indent === map.indent &&
it.sep &&
this.type !== 'seq-item-ind';
// For empty nodes, assign newline-separated not indented empty tokens to following node

@@ -523,0 +526,0 @@ let start = [];

@@ -33,3 +33,3 @@ 'use strict';

if (mode === FOLD_BLOCK) {
i = consumeMoreIndentedLines(text, i);
i = consumeMoreIndentedLines(text, i, indent.length);
if (i !== -1)

@@ -58,4 +58,4 @@ end = i + endStep;

if (mode === FOLD_BLOCK)
i = consumeMoreIndentedLines(text, i);
end = i + endStep;
i = consumeMoreIndentedLines(text, i, indent.length);
end = i + indent.length + endStep;
split = undefined;

@@ -128,11 +128,20 @@ }

*/
function consumeMoreIndentedLines(text, i) {
let ch = text[i + 1];
function consumeMoreIndentedLines(text, i, indent) {
let end = i;
let start = i + 1;
let ch = text[start];
while (ch === ' ' || ch === '\t') {
do {
ch = text[(i += 1)];
} while (ch && ch !== '\n');
ch = text[i + 1];
if (i < start + indent) {
ch = text[++i];
}
else {
do {
ch = text[++i];
} while (ch && ch !== '\n');
end = i;
start = i + 1;
ch = text[start];
}
}
return i;
return end;
}

@@ -139,0 +148,0 @@

@@ -63,3 +63,3 @@ 'use strict';

}
function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;

@@ -117,6 +117,5 @@ itemIndent += indentStep;

}
let str;
const { start, end } = flowChars;
if (lines.length === 0) {
str = start + end;
return start + end;
}

@@ -129,17 +128,11 @@ else {

if (reqNewline) {
str = start;
let str = start;
for (const line of lines)
str += line ? `\n${indentStep}${indent}${line}` : '\n';
str += `\n${indent}${end}`;
return `${str}\n${indent}${end}`;
}
else {
str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
}
}
if (comment) {
str += stringifyComment.lineComment(str, indent, commentString(comment));
if (onComment)
onComment();
}
return str;
}

@@ -146,0 +139,0 @@ function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {

{
"name": "yaml",
"version": "2.4.0",
"version": "2.4.1",
"license": "ISC",

@@ -5,0 +5,0 @@ "author": "Eemeli Aro <eemeli@gmail.com>",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc