Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yaml

Package Overview
Dependencies
Maintainers
3
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaml - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

15

browser/dist/Document.js

@@ -36,6 +36,8 @@ "use strict";

var _toJSON2 = _interopRequireDefault(require("./toJSON"));
var _Node2 = _interopRequireDefault(require("./schema/Node"));
var _Scalar = _interopRequireDefault(require("./schema/Scalar"));
var _toJSON2 = _interopRequireDefault(require("./toJSON"));
var isCollectionItem = function isCollectionItem(node) {

@@ -668,7 +670,10 @@ return node && [_Node.Type.MAP_KEY, _Node.Type.MAP_VALUE, _Node.Type.SEQ_ITEM].includes(node.type);

if (this.contents) {
if (this.contents.spaceBefore && hasDirectives) lines.push('');
if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
if (this.contents instanceof _Node2.default) {
if (this.contents.spaceBefore && hasDirectives) lines.push('');
if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
ctx.forceBlockIndent = !!this.comment;
contentComment = this.contents.comment;
ctx.forceBlockIndent = !!this.comment;
contentComment = this.contents.comment;
}
var onChompKeep = contentComment ? null : function () {

@@ -675,0 +680,0 @@ return chompKeep = true;

@@ -99,4 +99,5 @@ "use strict";

var vcb = '';
var valueComment = null;
if (value) {
if (value instanceof _Node2.default) {
if (value.spaceBefore) vcb = '\n';

@@ -108,6 +109,9 @@

}
valueComment = value.comment;
} else if (value && (0, _typeof2.default)(value) === 'object') {
value = doc.schema.createNode(value, true);
}
ctx.implicitKey = false;
var valueComment = value instanceof _Node2.default && value.comment;
chompKeep = false;

@@ -119,3 +123,11 @@ var valueStr = doc.schema.stringify(value, ctx, function () {

});
var ws = vcb || this.comment || !explicitKey && value instanceof _Collection.default ? "".concat(vcb, "\n").concat(ctx.indent) : ' ';
var ws = ' ';
if (vcb || this.comment) {
ws = "".concat(vcb, "\n").concat(ctx.indent);
} else if (!explicitKey && value instanceof _Collection.default) {
var flow = valueStr[0] === '[' || valueStr[0] === '{';
if (!flow || valueStr.includes('\n')) ws = "\n".concat(ctx.indent);
}
if (chompKeep && !valueComment && onChompKeep) onChompKeep();

@@ -122,0 +134,0 @@ return (0, _addComment.default)(str + ws + valueStr, ctx.indent, valueComment);

@@ -24,6 +24,8 @@ "use strict";

var _toJSON = _interopRequireDefault(require("./toJSON"));
var _Node2 = _interopRequireDefault(require("./schema/Node"));
var _Scalar = _interopRequireDefault(require("./schema/Scalar"));
var _toJSON = _interopRequireDefault(require("./toJSON"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

@@ -589,7 +591,10 @@

if (this.contents) {
if (this.contents.spaceBefore && hasDirectives) lines.push('');
if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
if (this.contents instanceof _Node2.default) {
if (this.contents.spaceBefore && hasDirectives) lines.push('');
if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
ctx.forceBlockIndent = !!this.comment;
contentComment = this.contents.comment;
ctx.forceBlockIndent = !!this.comment;
contentComment = this.contents.comment;
}
const onChompKeep = contentComment ? null : () => chompKeep = true;

@@ -596,0 +601,0 @@ const body = this.schema.stringify(this.contents, ctx, () => contentComment = null, onChompKeep);

@@ -58,3 +58,3 @@ "use strict";

if (!ctx || !ctx.doc) return JSON.stringify(this);
const {
let {
key,

@@ -95,4 +95,5 @@ value

let vcb = '';
let valueComment = null;
if (value) {
if (value instanceof _Node.default) {
if (value.spaceBefore) vcb = '\n';

@@ -104,9 +105,20 @@

}
valueComment = value.comment;
} else if (value && typeof value === 'object') {
value = doc.schema.createNode(value, true);
}
ctx.implicitKey = false;
let valueComment = value instanceof _Node.default && value.comment;
chompKeep = false;
const valueStr = doc.schema.stringify(value, ctx, () => valueComment = null, () => chompKeep = true);
const ws = vcb || this.comment || !explicitKey && value instanceof _Collection.default ? `${vcb}\n${ctx.indent}` : ' ';
let ws = ' ';
if (vcb || this.comment) {
ws = `${vcb}\n${ctx.indent}`;
} else if (!explicitKey && value instanceof _Collection.default) {
const flow = valueStr[0] === '[' || valueStr[0] === '{';
if (!flow || valueStr.includes('\n')) ws = `\n${ctx.indent}`;
}
if (chompKeep && !valueComment && onChompKeep) onChompKeep();

@@ -113,0 +125,0 @@ return (0, _addComment.default)(str + ws + valueStr, ctx.indent, valueComment);

{
"name": "yaml",
"version": "1.3.1",
"version": "1.3.2",
"license": "ISC",

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

@@ -29,19 +29,19 @@ # YAML <a href="https://www.npmjs.com/package/yaml"><img align="right" src="https://badge.fury.io/js/yaml.svg" title="npm package" /></a><a href="https://travis-ci.org/eemeli/yaml"><img align="right" src="https://travis-ci.org/eemeli/yaml.svg?branch=master" title="Build status" /></a>

### Pure JavaScript
### Parse & Stringify
* [`YAML.parse(str, options): value`](https://eemeli.org/yaml/#yaml-parse)
* [`YAML.stringify(value, options): string`](https://eemeli.org/yaml/#yaml-stringify)
- [`YAML.parse(str, options): value`](https://eemeli.org/yaml/#yaml-parse)
- [`YAML.stringify(value, options): string`](https://eemeli.org/yaml/#yaml-stringify)
### YAML Documents
* [`YAML.createNode(value, wrapScalars, tag): Node`](https://eemeli.org/yaml/#creating-nodes)
* [`YAML.defaultOptions`](https://eemeli.org/yaml/#options)
* [`YAML.Document`](https://eemeli.org/yaml/#yaml-documents)
* [`constructor(options)`](https://eemeli.org/yaml/#creating-documents)
* [`defaults`](https://eemeli.org/yaml/#options)
* [`#anchors`](https://eemeli.org/yaml/#working-with-anchors)
* [`#contents`](https://eemeli.org/yaml/#content-nodes)
* [`#errors`](https://eemeli.org/yaml/#errors)
* [`YAML.parseAllDocuments(str, options): YAML.Document[]`](https://eemeli.org/yaml/#parsing-documents)
* [`YAML.parseDocument(str, options): YAML.Document`](https://eemeli.org/yaml/#parsing-documents)
- [`YAML.createNode(value, wrapScalars, tag): Node`](https://eemeli.org/yaml/#creating-nodes)
- [`YAML.defaultOptions`](https://eemeli.org/yaml/#options)
- [`YAML.Document`](https://eemeli.org/yaml/#yaml-documents)
- [`constructor(options)`](https://eemeli.org/yaml/#creating-documents)
- [`defaults`](https://eemeli.org/yaml/#options)
- [`#anchors`](https://eemeli.org/yaml/#working-with-anchors)
- [`#contents`](https://eemeli.org/yaml/#content-nodes)
- [`#errors`](https://eemeli.org/yaml/#errors)
- [`YAML.parseAllDocuments(str, options): YAML.Document[]`](https://eemeli.org/yaml/#parsing-documents)
- [`YAML.parseDocument(str, options): YAML.Document`](https://eemeli.org/yaml/#parsing-documents)

@@ -54,5 +54,5 @@ ```js

* [`new Map()`](https://eemeli.org/yaml/#creating-nodes)
* [`new Pair(key, value)`](https://eemeli.org/yaml/#creating-nodes)
* [`new Seq()`](https://eemeli.org/yaml/#creating-nodes)
- [`new Map()`](https://eemeli.org/yaml/#creating-nodes)
- [`new Pair(key, value)`](https://eemeli.org/yaml/#creating-nodes)
- [`new Seq()`](https://eemeli.org/yaml/#creating-nodes)

@@ -65,4 +65,4 @@ ### CST Parser

* [`parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/#parsecst)
* [`YAML.parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/#parsecst)
- [`parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/#parsecst)
- [`YAML.parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/#parsecst)

@@ -125,1 +125,9 @@ ## YAML.parse

```
---
Browser testing provided by:
<a href="https://www.browserstack.com/open-source">
<img width=200 src="https://eemeli.org/yaml/images/browserstack.svg" />
</a>
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc