Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

yaml

Package Overview
Dependencies
0
Maintainers
3
Versions
88
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-rc.5 to 1.0.0-rc.6

dist/schema/yaml-1.1.js

14

dist/cst/Alias.js

@@ -18,6 +18,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -31,7 +27,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Alias =
/*#__PURE__*/
function (_Node) {
_inherits(Alias, _Node);
function Alias() {

@@ -66,4 +68,2 @@ _classCallCheck(this, Alias);

_inherits(Alias, _Node);
return Alias;

@@ -70,0 +70,0 @@ }(_Node2.default);

@@ -20,6 +20,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -33,4 +29,8 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Chomp = {

@@ -46,2 +46,4 @@ CLIP: 'CLIP',

function (_Node) {
_inherits(BlockValue, _Node);
function BlockValue(type, props) {

@@ -215,2 +217,3 @@ var _this;

var folded = this.type === _Node2.Type.BLOCK_FOLDED;
var atStart = true;
var str = '';

@@ -237,3 +240,3 @@ var sep = '';

if (folded && (_ch === ' ' || _ch === '\t') && i < keepStart) {
if (sep === ' ') sep = '\n';else if (!prevMoreIndented && sep === '\n') sep = '\n\n';
if (sep === ' ') sep = '\n';else if (!prevMoreIndented && !atStart && sep === '\n') sep = '\n\n';
str += sep + line; //+ ((lineEnd < end && src[lineEnd]) || '')

@@ -248,2 +251,4 @@

}
if (atStart && line !== '') atStart = false;
}

@@ -256,4 +261,2 @@ }

_inherits(BlockValue, _Node);
return BlockValue;

@@ -260,0 +263,0 @@ }(_Node2.default);

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

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -37,7 +33,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Collection =
/*#__PURE__*/
function (_Node) {
_inherits(Collection, _Node);
function Collection(firstItem) {

@@ -204,4 +206,2 @@ var _this;

_inherits(Collection, _Node);
return Collection;

@@ -208,0 +208,0 @@ }(_Node2.default);

@@ -22,6 +22,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -35,7 +31,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var CollectionItem =
/*#__PURE__*/
function (_Node) {
_inherits(CollectionItem, _Node);
function CollectionItem(type, props) {

@@ -65,3 +67,3 @@ var _this;

lineStart = context.lineStart;
if (!atLineStart && this.type === _Node2.Type.SEQ_ITEM) this.error = new _errors.YAMLSemanticError(this, 'Sequence items are not allowed on the same line with map keys');
if (!atLineStart && this.type === _Node2.Type.SEQ_ITEM) this.error = new _errors.YAMLSemanticError(this, 'Sequence items must not have preceding content on the same line');
var indent = atLineStart ? start - lineStart : context.indent;

@@ -120,4 +122,2 @@

_inherits(CollectionItem, _Node);
return CollectionItem;

@@ -124,0 +124,0 @@ }(_Node2.default);

@@ -20,6 +20,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -33,7 +29,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Comment =
/*#__PURE__*/
function (_Node) {
_inherits(Comment, _Node);
function Comment() {

@@ -64,4 +66,2 @@ _classCallCheck(this, Comment);

_inherits(Comment, _Node);
return Comment;

@@ -68,0 +68,0 @@ }(_Node2.default);

@@ -20,6 +20,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

@@ -29,3 +25,3 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -36,5 +32,11 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Directive =
/*#__PURE__*/
function (_Node) {
_inherits(Directive, _Node);
_createClass(Directive, null, [{

@@ -118,4 +120,2 @@ key: "endOfDirective",

_inherits(Directive, _Node);
return Directive;

@@ -122,0 +122,0 @@ }(_Node2.default);

@@ -26,6 +26,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

@@ -35,3 +31,3 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -42,5 +38,11 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Document =
/*#__PURE__*/
function (_Node) {
_inherits(Document, _Node);
_createClass(Document, null, [{

@@ -257,4 +259,2 @@ key: "startCommentOrEndBlankLine",

_inherits(Document, _Node);
return Document;

@@ -261,0 +261,0 @@ }(_Node2.default);

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

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -37,7 +33,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var FlowCollection =
/*#__PURE__*/
function (_Node) {
_inherits(FlowCollection, _Node);
function FlowCollection(type, props) {

@@ -182,4 +184,2 @@ var _this;

_inherits(FlowCollection, _Node);
return FlowCollection;

@@ -186,0 +186,0 @@ }(_Node2.default);

@@ -173,2 +173,6 @@ "use strict";

if (context.nodeStartsCollection(node)) {
if (!node.error && !context.atLineStart && context.parent.type === _Node.Type.DOCUMENT) {
node.error = new _errors.YAMLSyntaxError(node, 'Block collection must not have preceding content here (e.g. directives-end indicator)');
}
var collection = new _Collection.default(node);

@@ -241,2 +245,10 @@ offset = collection.parse(new ParseContext(context), offset);

if (ch === _Node.Char.TAG && src[_end] === ',' && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(src.slice(offset + 1, _end + 13))) {
// Let's presume we're dealing with a YAML 1.0 domain tag here, rather
// than an empty but 'foo.bar' private-tagged node in a flow collection
// followed without whitespace by a plain string starting with a year
// or date divided by something.
_end = _Node.default.endOfIdentifier(src, _end + 5);
}
props.push(new _Range.default(offset, _end));

@@ -243,0 +255,0 @@ lineHasProps = true;

@@ -18,6 +18,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -31,7 +27,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var PlainValue =
/*#__PURE__*/
function (_Node) {
_inherits(PlainValue, _Node);
function PlainValue() {

@@ -183,4 +185,2 @@ _classCallCheck(this, PlainValue);

_inherits(PlainValue, _Node);
return PlainValue;

@@ -187,0 +187,0 @@ }(_Node2.default);

@@ -20,6 +20,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -33,7 +29,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var QuoteDouble =
/*#__PURE__*/
function (_Node) {
_inherits(QuoteDouble, _Node);
function QuoteDouble() {

@@ -264,4 +266,2 @@ _classCallCheck(this, QuoteDouble);

_inherits(QuoteDouble, _Node);
return QuoteDouble;

@@ -268,0 +268,0 @@ }(_Node2.default);

@@ -20,6 +20,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -33,7 +29,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var QuoteSingle =
/*#__PURE__*/
function (_Node) {
_inherits(QuoteSingle, _Node);
function QuoteSingle() {

@@ -139,4 +141,2 @@ _classCallCheck(this, QuoteSingle);

_inherits(QuoteSingle, _Node);
return QuoteSingle;

@@ -143,0 +143,0 @@ }(_Node2.default);

@@ -32,2 +32,7 @@ "use strict";

_createClass(Range, [{
key: "apply",
value: function apply(src) {
return this.isEmpty ? '' : src.slice(this.start, this.end);
}
}, {
key: "isEmpty",

@@ -34,0 +39,0 @@ get: function get() {

@@ -26,2 +26,4 @@ "use strict";

var _Scalar = _interopRequireDefault(require("./schema/Scalar"));
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; } }

@@ -45,2 +47,4 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var isCollectionItem = function isCollectionItem(node) {

@@ -53,3 +57,3 @@ return node && [_Node.Type.MAP_KEY, _Node.Type.MAP_VALUE, _Node.Type.SEQ_ITEM].includes(node.type);

function () {
function Document(schema) {
function Document(options) {
_classCallCheck(this, Document);

@@ -62,4 +66,5 @@

this.errors = [];
this.options = options;
this.schema = null;
this.tagPrefixes = [];
this.schema = schema instanceof _schema.default ? schema : new _schema.default(schema);
this.version = null;

@@ -70,2 +75,12 @@ this.warnings = [];

_createClass(Document, [{
key: "getDefaults",
value: function getDefaults() {
return Document.defaults[this.version] || Document.defaults[this.options.version] || {};
}
}, {
key: "setSchema",
value: function setSchema() {
if (!this.schema) this.schema = new _schema.default(Object.assign({}, this.getDefaults(), this.options));
}
}, {
key: "parse",

@@ -98,2 +113,3 @@ value: function parse(_ref) {

case 'YAML':
case 'YAML:1.0':
_this.resolveYamlDirective(directive);

@@ -109,2 +125,3 @@

});
this.setSchema();
this.anchors._cstAliases = [];

@@ -195,5 +212,23 @@ this.commentBefore = directiveComments.join('\n') || null;

if (this.version) this.errors.push(new _errors.YAMLSemanticError(directive, 'The %YAML directive must only be given at most once per document.'));
if (!version) this.errors.push(new _errors.YAMLSemanticError(directive, 'Insufficient parameters given for %YAML directive'));else if (version !== '1.2') this.warnings.push(new _errors.YAMLWarning(directive, "Document will be parsed as YAML 1.2 rather than YAML ".concat(version)));
this.version = version;
if (directive.name === 'YAML:1.0') version = '1.0';
if (this.version) {
var msg = 'The %YAML directive must only be given at most once per document.';
this.errors.push(new _errors.YAMLSemanticError(directive, msg));
}
if (!version) {
var _msg = 'Insufficient parameters given for %YAML directive';
this.errors.push(new _errors.YAMLSemanticError(directive, _msg));
} else {
if (!Document.defaults[version]) {
var v0 = this.version || this.options.version;
var _msg2 = "Document will be parsed as YAML ".concat(v0, " rather than YAML ").concat(version);
this.warnings.push(new _errors.YAMLWarning(directive, _msg2));
}
this.version = version;
}
}

@@ -220,8 +255,26 @@ }, {

return p.handle === handle;
}) || _schema.DefaultTagPrefixes.find(function (p) {
return p.handle === handle;
});
if (!prefix) {
var dtp = this.getDefaults().tagPrefixes;
if (dtp) prefix = dtp.find(function (p) {
return p.handle === handle;
});
}
if (prefix) {
if (suffix) return prefix.prefix + suffix;
if (suffix) {
if (handle === '!' && (this.version || this.options.version) === '1.0') {
if (suffix[0] === '^') return suffix;
if (/[:/]/.test(suffix)) {
// word/foo -> tag:word.yaml.org,2002:foo
var vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i);
return vocab ? "tag:".concat(vocab[1], ".yaml.org,2002:").concat(vocab[2]) : "tag:".concat(suffix);
}
}
return prefix.prefix + suffix;
}
this.errors.push(new _errors.YAMLSemanticError(node, "The ".concat(handle, " tag has no suffix.")));

@@ -356,2 +409,3 @@ } else {

res.range = [node.range.start, node.range.end];
if (this.options.keepNodeTypes) res.type = node.type;
var cb = comments.before.join('\n');

@@ -372,9 +426,4 @@

value: function listNonDefaultTags() {
var _DefaultTagPrefixes$f = _schema.DefaultTagPrefixes.find(function (p) {
return p.handle === '!!';
}),
prefix = _DefaultTagPrefixes$f.prefix;
return (0, _listTagNames.default)(this.contents).filter(function (t) {
return t.indexOf(prefix) !== 0;
return t.indexOf(_schema.defaultPrefix) !== 0;
});

@@ -402,4 +451,28 @@ }

}, {
key: "stringifyTag",
value: function stringifyTag(tag) {
if ((this.version || this.options.version) === '1.0') {
var priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
if (priv) return '!' + priv[1];
var vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
return vocab ? "!".concat(vocab[1], "/").concat(vocab[2]) : "!".concat(tag.replace(/^tag:/, ''));
} else {
var p = this.tagPrefixes.find(function (p) {
return tag.indexOf(p.prefix) === 0;
});
if (!p) {
var dtp = this.getDefaults().tagPrefixes;
p = dtp && dtp.find(function (p) {
return tag.indexOf(p.prefix) === 0;
});
}
if (p) return p.handle + tag.substr(p.prefix.length);
return tag[0] === '!' ? tag : "!<".concat(tag, ">");
}
}
}, {
key: "toJSON",
value: function toJSON() {
value: function toJSON(arg) {
var cr = this.warnings.find(function (w) {

@@ -409,3 +482,4 @@ return /circular reference/.test(w.message);

if (cr) throw new _errors.YAMLSemanticError(cr.source, cr.message);
return (0, _toJSON2.default)(this.contents);
var keep = this.options.keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof _Scalar.default));
return (0, _toJSON2.default)(this.contents, arg, keep);
}

@@ -416,2 +490,3 @@ }, {

if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
this.setSchema();
var lines = [];

@@ -422,3 +497,9 @@ if (this.commentBefore) lines.push(this.commentBefore.replace(/^/gm, '#'));

if (this.version) {
lines.push('%YAML 1.2');
var vd = '%YAML 1.2';
if (this.schema.name === 'yaml-1.1') {
if (this.version === '1.0') vd = '%YAML:1.0';else if (this.version === '1.1') vd = '%YAML 1.1';
}
lines.push(vd);
hasDirectives = true;

@@ -467,2 +548,38 @@ }

exports.default = Document;
exports.default = Document;
_defineProperty(Document, "defaults", {
'1.0': {
schema: 'yaml-1.1',
merge: true,
tagPrefixes: [{
handle: '!',
prefix: _schema.defaultPrefix
}, {
handle: '!!',
prefix: 'tag:private.yaml.org,2002:'
}]
},
'1.1': {
schema: 'yaml-1.1',
merge: true,
tagPrefixes: [{
handle: '!',
prefix: '!'
}, {
handle: '!!',
prefix: _schema.defaultPrefix
}]
},
'1.2': {
schema: 'core',
merge: false,
tagPrefixes: [{
handle: '!',
prefix: '!'
}, {
handle: '!!',
prefix: _schema.defaultPrefix
}]
}
});

@@ -16,4 +16,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

@@ -23,9 +21,13 @@

function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() {} Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, _setPrototypeOf(function Super() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); }, Class)); }; return _wrapNativeSuper(Class); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _construct(Parent, args, Class) { if (typeof Reflect !== "undefined" && Reflect.construct) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Parent.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null) return null; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -35,2 +37,4 @@ var YAMLReferenceError =

function (_ReferenceError) {
_inherits(YAMLReferenceError, _ReferenceError);
function YAMLReferenceError(source, message) {

@@ -52,4 +56,2 @@ var _this;

_inherits(YAMLReferenceError, _ReferenceError);
return YAMLReferenceError;

@@ -63,2 +65,4 @@ }(_wrapNativeSuper(ReferenceError));

function (_SyntaxError) {
_inherits(YAMLSemanticError, _SyntaxError);
function YAMLSemanticError(source, message) {

@@ -80,4 +84,2 @@ var _this2;

_inherits(YAMLSemanticError, _SyntaxError);
return YAMLSemanticError;

@@ -91,2 +93,4 @@ }(_wrapNativeSuper(SyntaxError));

function (_SyntaxError2) {
_inherits(YAMLSyntaxError, _SyntaxError2);
function YAMLSyntaxError(source, message) {

@@ -108,4 +112,2 @@ var _this3;

_inherits(YAMLSyntaxError, _SyntaxError2);
return YAMLSyntaxError;

@@ -119,2 +121,4 @@ }(_wrapNativeSuper(SyntaxError));

function (_Error) {
_inherits(YAMLWarning, _Error);
function YAMLWarning(source, message) {

@@ -136,4 +140,2 @@ var _this4;

_inherits(YAMLWarning, _Error);
return YAMLWarning;

@@ -140,0 +142,0 @@ }(_wrapNativeSuper(Error));

@@ -12,5 +12,5 @@ "use strict";

var _Document3 = _interopRequireDefault(require("./Document"));
var _Document = _interopRequireDefault(require("./Document"));
var _schema = _interopRequireDefault(require("./schema"));
var _errors = require("./errors");

@@ -23,6 +23,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

@@ -32,39 +28,58 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var defaultOptions = {
merge: false,
schema: 'core',
tags: null
keepNodeTypes: true,
keepBlobsInJSON: true,
tags: null,
version: '1.2'
};
function parseDocuments(src, options) {
var resolvedOptions = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
var schema = new _schema.default(resolvedOptions);
return (0, _parse.default)(src).map(function (astDoc) {
return new _Document3.default(schema).parse(astDoc);
var Document =
/*#__PURE__*/
function (_YAMLDocument) {
_inherits(Document, _YAMLDocument);
function Document(options) {
_classCallCheck(this, Document);
return _possibleConstructorReturn(this, _getPrototypeOf(Document).call(this, Object.assign({}, defaultOptions, options)));
}
return Document;
}(_Document.default);
function parseAllDocuments(src, options) {
return (0, _parse.default)(src).map(function (cstDoc) {
return new Document(options).parse(cstDoc);
});
}
function parse(src, options) {
var docs = parseDocuments(src, options);
docs.forEach(function (doc) {
doc.warnings.forEach(function (warning) {
return console.warn(warning);
});
doc.errors.forEach(function (error) {
throw error;
});
});
function parseDocument(src, options) {
var cst = (0, _parse.default)(src);
var doc = new Document(options).parse(cst[0]);
if (docs.length > 1) {
throw new Error('Source contains multiple documents; please use YAML.parseDocuments()');
if (cst.length > 1) {
var errMsg = 'Source contains multiple documents; please use YAML.parseAllDocuments()';
doc.errors.unshift(new _errors.YAMLSemanticError(cst[1], errMsg));
}
return docs[0] && docs[0].toJSON();
return doc;
}
function parse(src, options) {
var doc = parseDocument(src, options);
doc.warnings.forEach(function (warning) {
return console.warn(warning);
});
if (doc.errors.length > 0) throw doc.errors[0];
return doc.toJSON();
}
function stringify(value, options) {
var resolvedOptions = options ? Object.assign({}, defaultOptions, options) : defaultOptions;
var doc = new _Document3.default(resolvedOptions);
var doc = new Document(options);
doc.contents = value;

@@ -77,27 +92,8 @@ return String(doc);

defaultOptions: defaultOptions,
Document:
/*#__PURE__*/
function (_Document2) {
function Document(schema) {
var _this;
_classCallCheck(this, Document);
if (schema instanceof _schema.default) {
_this = _possibleConstructorReturn(this, _getPrototypeOf(Document).call(this, schema));
} else {
_this = _possibleConstructorReturn(this, _getPrototypeOf(Document).call(this, Object.assign({}, defaultOptions, schema)));
}
return _possibleConstructorReturn(_this);
}
_inherits(Document, _Document2);
return Document;
}(_Document3.default),
Document: Document,
parse: parse,
parseDocuments: parseDocuments,
parseAllDocuments: parseAllDocuments,
parseDocument: parseDocument,
stringify: stringify
};
exports.default = _default;

@@ -10,2 +10,4 @@ "use strict";

var _Node = require("../cst/Node");
var _string = require("./_string");

@@ -17,2 +19,3 @@

// Buffer inherits from Uint8Array
default: false,
tag: 'tag:yaml.org,2002:binary',

@@ -30,11 +33,11 @@

if (typeof Buffer === 'function') {
var str = (0, _string.resolve)(doc, node);
return Buffer.from(str, 'base64');
var src = (0, _string.resolve)(doc, node);
return Buffer.from(src, 'base64');
} else if (typeof atob === 'function') {
var _str = atob((0, _string.resolve)(doc, node));
var _src = atob((0, _string.resolve)(doc, node));
var buffer = new Uint8Array(_str.length);
var buffer = new Uint8Array(_src.length);
for (var i = 0; i < _str.length; ++i) {
buffer[i] = _str.charCodeAt(i);
for (var i = 0; i < _src.length; ++i) {
buffer[i] = _src.charCodeAt(i);
}

@@ -49,10 +52,13 @@

options: {
defaultType: _Node.Type.BLOCK_LITERAL,
lineWidth: 76
},
stringify: function stringify(_ref) {
var value = _ref.value;
var str;
stringify: function stringify(_ref, ctx, onComment) {
var comment = _ref.comment,
type = _ref.type,
value = _ref.value;
var src;
if (typeof Buffer === 'function') {
str = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
} else if (typeof btoa === 'function') {

@@ -65,3 +71,3 @@ var s = '';

str = btoa(s);
src = btoa(s);
} else {

@@ -71,11 +77,23 @@ throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');

var lineWidth = binary.options.lineWidth;
var n = Math.ceil(str.length / lineWidth);
var lines = new Array(n);
if (!type) type = binary.options.defaultType;
for (var _i = 0, o = 0; _i < n; ++_i, o += lineWidth) {
lines[_i] = str.substr(o, lineWidth);
if (type === _Node.Type.QUOTE_DOUBLE) {
value = src;
} else {
var lineWidth = binary.options.lineWidth;
var n = Math.ceil(src.length / lineWidth);
var lines = new Array(n);
for (var _i = 0, o = 0; _i < n; ++_i, o += lineWidth) {
lines[_i] = src.substr(o, lineWidth);
}
value = lines.join(type === _Node.Type.BLOCK_LITERAL ? '\n' : ' ');
}
return lines.join('\n');
return (0, _string.stringify)({
comment: comment,
type: type,
value: value
}, ctx, onComment);
}

@@ -82,0 +100,0 @@ };

@@ -6,3 +6,4 @@ "use strict";

});
exports.default = exports.str = exports.resolve = exports.strOptions = void 0;
exports.stringify = stringify;
exports.str = exports.resolve = exports.strOptions = void 0;

@@ -152,4 +153,8 @@ var _addComment = require("../addComment");

function blockString(value, indent, literal, forceBlockIndent, comment, onComment) {
// block can't end in whitespace unless the last line is non-empty
if (/\n[\t ]+$/.test(value)) return doubleQuotedString(value, indent, false);
// Block can't end in whitespace unless the last line is non-empty
// Strings consisting of only whitespace are best rendered explicitly
if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
return doubleQuotedString(value, indent, false);
}
if (forceBlockIndent && !indent) indent = ' ';

@@ -239,67 +244,68 @@ var indentSize = indent ? '2' : '1'; // root is at -1

var str = {
class: String,
tag: 'tag:yaml.org,2002:str',
resolve: resolve,
options: strOptions,
stringify: function stringify(_ref) {
var comment = _ref.comment,
value = _ref.value;
function stringify(_ref) {
var comment = _ref.comment,
type = _ref.type,
value = _ref.value;
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
forceBlockIndent = _ref2.forceBlockIndent,
implicitKey = _ref2.implicitKey,
indent = _ref2.indent,
inFlow = _ref2.inFlow,
tags = _ref2.tags,
type = _ref2.type;
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
forceBlockIndent = _ref2.forceBlockIndent,
implicitKey = _ref2.implicitKey,
indent = _ref2.indent,
inFlow = _ref2.inFlow,
tags = _ref2.tags;
var onComment = arguments.length > 2 ? arguments[2] : undefined;
var dropCR = strOptions.dropCR,
defaultType = strOptions.defaultType;
if (typeof value !== 'string') value = String(value);
if (dropCR && /\r/.test(value)) value = value.replace(/\r\n?/g, '\n');
var onComment = arguments.length > 2 ? arguments[2] : undefined;
var dropCR = strOptions.dropCR,
defaultType = strOptions.defaultType;
if (typeof value !== 'string') value = String(value);
if (dropCR && /\r/.test(value)) value = value.replace(/\r\n?/g, '\n');
var _stringify = function _stringify(_type) {
switch (_type) {
case _Node.Type.BLOCK_FOLDED:
return blockString(value, indent, false, forceBlockIndent, comment, onComment);
var _stringify = function _stringify(_type) {
switch (_type) {
case _Node.Type.BLOCK_FOLDED:
return blockString(value, indent, false, forceBlockIndent, comment, onComment);
case _Node.Type.BLOCK_LITERAL:
return blockString(value, indent, true, forceBlockIndent, comment, onComment);
case _Node.Type.BLOCK_LITERAL:
return blockString(value, indent, true, forceBlockIndent, comment, onComment);
case _Node.Type.QUOTE_DOUBLE:
return doubleQuotedString(value, indent, implicitKey, comment);
case _Node.Type.QUOTE_DOUBLE:
return doubleQuotedString(value, indent, implicitKey, comment);
case _Node.Type.QUOTE_SINGLE:
return singleQuotedString(value, indent, implicitKey, comment);
case _Node.Type.QUOTE_SINGLE:
return singleQuotedString(value, indent, implicitKey, comment);
case _Node.Type.PLAIN:
return plainString(value, indent, implicitKey, inFlow, forceBlockIndent, tags, comment, onComment);
case _Node.Type.PLAIN:
return plainString(value, indent, implicitKey, inFlow, forceBlockIndent, tags, comment, onComment);
default:
return null;
}
};
if (type !== _Node.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) {
// force double quotes on control characters
type = _Node.Type.QUOTE_DOUBLE;
} else if (inFlow && (type === _Node.Type.BLOCK_FOLDED || type === _Node.Type.BLOCK_LITERAL)) {
// should not happen; blocks are not valid inside flow containers
type = _Node.Type.QUOTE_DOUBLE;
default:
return null;
}
};
var res = _stringify(type);
if (type !== _Node.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) {
// force double quotes on control characters
type = _Node.Type.QUOTE_DOUBLE;
} else if ((implicitKey || inFlow) && (type === _Node.Type.BLOCK_FOLDED || type === _Node.Type.BLOCK_LITERAL)) {
// should not happen; blocks are not valid inside flow containers
type = _Node.Type.QUOTE_DOUBLE;
}
if (res === null) {
res = _stringify(defaultType);
if (res === null) throw new Error("Unsupported default string type ".concat(defaultType));
}
var res = _stringify(type);
return res;
if (res === null) {
res = _stringify(defaultType);
if (res === null) throw new Error("Unsupported default string type ".concat(defaultType));
}
return res;
}
var str = {
class: String,
default: true,
tag: 'tag:yaml.org,2002:str',
resolve: resolve,
stringify: stringify,
options: strOptions
};
exports.str = str;
var _default = [str];
exports.default = _default;
exports.str = str;

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

var value = _ref.value;
if (!isNan(value) || !isFinite(value)) return (0, _core.stringifyNumber)(value);
if (isNaN(value) || !isFinite(value)) return (0, _core.stringifyNumber)(value);
var sign = '';

@@ -46,3 +46,4 @@

return n < 10 ? '0' + String(n) : String(n);
}).join(':');
}).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
;
};

@@ -52,4 +53,5 @@

class: Number,
default: true,
tag: 'tag:yaml.org,2002:int',
format: 'time',
format: 'TIME',
test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,

@@ -64,4 +66,5 @@ resolve: function resolve(str, sign, parts) {

class: Number,
default: true,
tag: 'tag:yaml.org,2002:float',
format: 'time',
format: 'TIME',
test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,

@@ -76,2 +79,3 @@ resolve: function resolve(str, sign, parts) {

class: Date,
default: true,
tag: 'tag:yaml.org,2002:timestamp',

@@ -100,3 +104,3 @@ // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part

var value = _ref2.value;
return value.toISOString();
return value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '');
}

@@ -103,0 +107,0 @@ };

@@ -8,5 +8,7 @@ "use strict";

var _Node2 = require("../cst/Node");
var _toJSON2 = _interopRequireDefault(require("../toJSON"));
var _Node2 = _interopRequireDefault(require("./Node"));
var _Node3 = _interopRequireDefault(require("./Node"));

@@ -19,6 +21,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

@@ -28,3 +26,3 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -35,5 +33,13 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Alias =
/*#__PURE__*/
function (_Node) {
_inherits(Alias, _Node);
_createClass(Alias, null, [{

@@ -63,2 +69,3 @@ key: "stringify",

_this.source = source;
_this.type = _Node2.Type.ALIAS;
return _this;

@@ -69,4 +76,4 @@ }

key: "toJSON",
value: function toJSON() {
return (0, _toJSON2.default)(this.source);
value: function toJSON(arg, keep) {
return (0, _toJSON2.default)(this.source, arg, keep);
}

@@ -80,7 +87,7 @@ }, {

_inherits(Alias, _Node);
return Alias;
}(_Node2.default);
}(_Node3.default);
exports.default = Alias;
exports.default = Alias;
_defineProperty(Alias, "default", true);

@@ -18,6 +18,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -29,4 +25,8 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

@@ -39,6 +39,8 @@

function (_Node) {
_inherits(Collection, _Node);
function Collection() {
var _getPrototypeOf2;
var _temp, _this;
var _this;

@@ -51,3 +53,7 @@ _classCallCheck(this, Collection);

return _possibleConstructorReturn(_this, (_temp = _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Collection)).call.apply(_getPrototypeOf2, [this].concat(args))), _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "items", []), _temp));
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Collection)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "items", []);
return _this;
}

@@ -71,6 +77,8 @@

doc = _ctx.doc,
indent = _ctx.indent,
inFlow = _ctx.inFlow;
indent = _ctx.indent;
var inFlow = this.type && this.type.substr(0, 4) === 'FLOW' || ctx.inFlow;
if (inFlow) itemIndent += ' ';
ctx = Object.assign({}, ctx, {
indent: itemIndent,
inFlow: inFlow,
type: null

@@ -139,4 +147,2 @@ });

_inherits(Collection, _Node);
return Collection;

@@ -143,0 +149,0 @@ }(_Node2.default);

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

class: null,
default: true,
tag: 'tag:yaml.org,2002:null',
test: /^(?:~|null)?$/i,
test: /^(?:~|[Nn]ull|NULL)?$/,
resolve: function resolve() {

@@ -37,4 +38,5 @@ return null;

class: Boolean,
default: true,
tag: 'tag:yaml.org,2002:bool',
test: /^(?:true|false)$/i,
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
resolve: function resolve(str) {

@@ -45,4 +47,5 @@ return str[0] === 't' || str[0] === 'T';

class: Number,
default: true,
tag: 'tag:yaml.org,2002:int',
format: 'oct',
format: 'OCT',
test: /^0o([0-7]+)$/,

@@ -58,2 +61,3 @@ resolve: function resolve(str, oct) {

class: Number,
default: true,
tag: 'tag:yaml.org,2002:int',

@@ -67,4 +71,5 @@ test: /^[-+]?[0-9]+$/,

class: Number,
default: true,
tag: 'tag:yaml.org,2002:int',
format: 'hex',
format: 'HEX',
test: /^0x([0-9a-fA-F]+)$/,

@@ -80,2 +85,3 @@ resolve: function resolve(str, hex) {

class: Number,
default: true,
tag: 'tag:yaml.org,2002:float',

@@ -89,2 +95,3 @@ test: /^(?:[-+]?\.inf|(\.nan))$/i,

class: Number,
default: true,
tag: 'tag:yaml.org,2002:float',

@@ -91,0 +98,0 @@ test: /^[-+]?(0|[1-9][0-9]*)(\.[0-9]*)?([eE][-+]?[0-9]+)?$/,

@@ -22,2 +22,3 @@ "use strict";

class: _Map.default,
default: true,
tag: 'tag:yaml.org,2002:map',

@@ -32,2 +33,3 @@ resolve: _parseMap.default,

class: _Seq.default,
default: true,
tag: 'tag:yaml.org,2002:seq',

@@ -34,0 +36,0 @@ resolve: _parseSeq.default,

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

});
exports.default = exports.DefaultTags = exports.DefaultTagPrefixes = exports.availableSchema = void 0;
exports.default = exports.DefaultTags = exports.defaultPrefix = exports.availableSchema = void 0;

@@ -21,4 +21,2 @@ var _Node = require("../cst/Node");

var _extended = _interopRequireDefault(require("./extended"));
var _failsafe = _interopRequireDefault(require("./failsafe"));

@@ -36,2 +34,4 @@

var _yaml = _interopRequireDefault(require("./yaml-1.1"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -49,16 +49,9 @@

core: _core.default,
extended: _extended.default,
failsafe: _failsafe.default,
json: _json.default
json: _json.default,
'yaml-1.1': _yaml.default
};
exports.availableSchema = availableSchema;
var defaultPrefix = 'tag:yaml.org,2002:';
var DefaultTagPrefixes = [{
handle: '!',
prefix: '!'
}, {
handle: '!!',
prefix: defaultPrefix
}];
exports.DefaultTagPrefixes = DefaultTagPrefixes;
exports.defaultPrefix = defaultPrefix;
var DefaultTags = {

@@ -99,3 +92,4 @@ MAP: 'tag:yaml.org,2002:map',

this.merge = !!merge;
this.schema = Array.isArray(schema) ? schema : availableSchema[schema];
this.name = schema;
this.schema = availableSchema[schema];

@@ -124,2 +118,3 @@ if (!this.schema) {

var _tags$i = tags[i],
format = _tags$i.format,
test = _tags$i.test,

@@ -130,3 +125,8 @@ resolve = _tags$i.resolve;

var match = str.match(test);
if (match) return new _Scalar.default(resolve.apply(null, match));
if (match) {
var res = new _Scalar.default(resolve.apply(null, match));
if (format) res.format = format;
return res;
}
}

@@ -195,21 +195,26 @@ }

}, {
key: "getStringifier",
value: function getStringifier(item) {
if (item instanceof _Alias.default) return _Alias.default.stringify;
var match;
key: "getTagObject",
value: function getTagObject(item) {
if (item instanceof _Alias.default) return _Alias.default;
if (item.tag) {
match = this.schema.find(function (_ref6) {
var match = this.schema.find(function (_ref6) {
var format = _ref6.format,
tag = _ref6.tag;
return tag === item.tag && (!item.format || format === item.format);
return tag === item.tag && format === item.format;
});
if (match) return match.stringify || Schema.defaultStringifier;
if (!match) match = this.schema.find(function (_ref7) {
var tag = _ref7.tag;
return tag === item.tag;
});
if (match) return match;
}
if (item.value === null) {
match = this.schema.find(function (t) {
var _match = this.schema.find(function (t) {
return t.class === null && !t.format;
});
if (!match) throw new Error('Schema is missing a null stringifier');
if (!_match) throw new Error('Tag not resolved for null value');
return _match;
} else {

@@ -237,13 +242,19 @@ var obj = item;

match = this.schema.find(function (t) {
return t.class && obj instanceof t.class && !t.format;
var _match2 = this.schema.find(function (t) {
return t.class && obj instanceof t.class && t.format === item.format;
});
if (!match) {
if (!_match2) {
_match2 = this.schema.find(function (t) {
return t.class && obj instanceof t.class && !t.format;
});
}
if (!_match2) {
var name = obj && obj.constructor ? obj.constructor.name : _typeof(obj);
throw new Error("Tag not resolved for ".concat(name));
throw new Error("Tag not resolved for ".concat(name, " value"));
}
return _match2;
}
return match.stringify || Schema.defaultStringifier;
} // needs to be called before stringifier to allow for circular anchor refs

@@ -253,5 +264,5 @@

key: "stringifyProps",
value: function stringifyProps(node, _ref7) {
var anchors = _ref7.anchors,
doc = _ref7.doc;
value: function stringifyProps(node, tagObj, _ref8) {
var anchors = _ref8.anchors,
doc = _ref8.doc;
var props = [];

@@ -265,9 +276,6 @@ var anchor = doc.anchors.getName(node);

var tag = node.tag; // FIXME: should read prefix-skip from schema
if (tag && tag.indexOf(defaultPrefix) !== 0) {
var p = doc.tagPrefixes.find(function (p) {
return tag.indexOf(p.prefix) === 0;
});
props.push(p ? p.handle + tag.substr(p.prefix.length) : tag[0] === '!' ? tag : "!<".concat(tag, ">"));
if (node.tag && node.tag !== tagObj.tag) {
props.push(doc.stringifyTag(node.tag));
} else if (!tagObj.default) {
props.push(doc.stringifyTag(tagObj.tag));
}

@@ -283,6 +291,7 @@

if (item instanceof _Pair.default) return item.toString(ctx, onComment);
var stringify = this.getStringifier(item);
var props = this.stringifyProps(item, ctx);
var tagObj = this.getTagObject(item);
var props = this.stringifyProps(item, tagObj, ctx);
var stringify = tagObj.stringify || Schema.defaultStringifier;
var str = stringify(item, ctx, onComment);
return props ? item instanceof _Collection.default && !ctx.inFlow && item.items.length > 0 ? "".concat(props, "\n").concat(ctx.indent).concat(str) : "".concat(props, " ").concat(str) : str;
return props ? item instanceof _Collection.default && str[0] !== '{' && str[0] !== '[' ? "".concat(props, "\n").concat(ctx.indent).concat(str) : "".concat(props, " ").concat(str) : str;
}

@@ -289,0 +298,0 @@ }]);

@@ -14,2 +14,3 @@ "use strict";

class: String,
default: true,
tag: 'tag:yaml.org,2002:str',

@@ -19,2 +20,3 @@ resolve: _string.resolve

class: null,
default: true,
tag: 'tag:yaml.org,2002:null',

@@ -27,2 +29,3 @@ test: /^null$/,

class: Boolean,
default: true,
tag: 'tag:yaml.org,2002:bool',

@@ -35,2 +38,3 @@ test: /^true$/,

class: Boolean,
default: true,
tag: 'tag:yaml.org,2002:bool',

@@ -43,2 +47,3 @@ test: /^false$/,

class: Number,
default: true,
tag: 'tag:yaml.org,2002:int',

@@ -51,2 +56,3 @@ test: /^-?(?:0|[1-9][0-9]*)$/,

class: Number,
default: true,
tag: 'tag:yaml.org,2002:float',

@@ -53,0 +59,0 @@ test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,

@@ -22,6 +22,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -39,7 +35,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var YAMLMap =
/*#__PURE__*/
function (_Collection) {
_inherits(YAMLMap, _Collection);
function YAMLMap() {

@@ -53,3 +55,3 @@ _classCallCheck(this, YAMLMap);

key: "toJSON",
value: function toJSON() {
value: function toJSON(_, keep) {
return this.items.reduce(function (map, item) {

@@ -74,3 +76,3 @@ if (item instanceof _Merge.default) {

(function () {
var obj = source.toJSON();
var obj = source.toJSON('', keep);
Object.keys(obj).forEach(function (key) {

@@ -88,3 +90,3 @@ if (!keys.includes(key)) map[key] = obj[key];

value = item.value;
map[stringKey] = (0, _toJSON2.default)(value);
map[stringKey] = (0, _toJSON2.default)(value, stringKey, keep);
}

@@ -102,4 +104,2 @@

});
var itemIndent = ctx.indent || '';
if (ctx.inFlow) itemIndent += ' ';
return _get(_getPrototypeOf(YAMLMap.prototype), "toString", this).call(this, ctx, {

@@ -114,3 +114,3 @@ blockItem: function blockItem(_ref) {

},
itemIndent: itemIndent
itemIndent: ctx.indent || ''
}, onComment);

@@ -120,4 +120,2 @@ }

_inherits(YAMLMap, _Collection);
return YAMLMap;

@@ -124,0 +122,0 @@ }(_Collection2.default);

@@ -20,6 +20,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -37,4 +33,8 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var MERGE_KEY = '<<';

@@ -46,2 +46,4 @@ exports.MERGE_KEY = MERGE_KEY;

function (_Pair) {
_inherits(Merge, _Pair);
function Merge(pair) {

@@ -67,2 +69,3 @@ var _this;

_this.type = 'MERGE_PAIR';
return _possibleConstructorReturn(_this);

@@ -85,4 +88,2 @@ }

_inherits(Merge, _Pair);
return Merge;

@@ -89,0 +90,0 @@ }(_Pair2.default);

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

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -37,7 +33,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Pair =
/*#__PURE__*/
function (_Node) {
_inherits(Pair, _Node);
function Pair(key) {

@@ -53,2 +55,3 @@ var _this;

_this.value = value;
_this.type = 'PAIR';
return _this;

@@ -59,5 +62,6 @@ }

key: "toJSON",
value: function toJSON() {
value: function toJSON(_, keep) {
var pair = {};
pair[this.stringKey] = (0, _toJSON2.default)(this.value);
var sk = this.stringKey;
pair[sk] = (0, _toJSON2.default)(this.value, sk, keep);
return pair;

@@ -128,4 +132,2 @@ }

_inherits(Pair, _Node);
return Pair;

@@ -132,0 +134,0 @@ }(_Node2.default);

@@ -112,2 +112,3 @@ "use strict";

keyStart = item.range.start;
if (item.error) doc.errors.push(item.error);
var nextItem = cst.items[i + 1];

@@ -114,0 +115,0 @@ if (!nextItem || nextItem.type !== _Node.Type.MAP_VALUE) doc.errors.push(new _errors.YAMLSemanticError(item, 'Implicit map keys need to be followed by map values'));

@@ -54,2 +54,3 @@ "use strict";

default:
if (item.error) doc.errors.push(item.error);
doc.errors.push(new _errors.YAMLSyntaxError(item, "Unexpected ".concat(item.type, " node in sequence")));

@@ -56,0 +57,0 @@ }

@@ -18,6 +18,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -31,7 +27,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var Scalar =
/*#__PURE__*/
function (_Node) {
_inherits(Scalar, _Node);
function Scalar(value) {

@@ -49,4 +51,4 @@ var _this;

key: "toJSON",
value: function toJSON() {
return (0, _toJSON2.default)(this.value);
value: function toJSON(arg, keep) {
return keep ? this.value : (0, _toJSON2.default)(this.value, arg, keep);
}

@@ -60,4 +62,2 @@ }, {

_inherits(Scalar, _Node);
return Scalar;

@@ -64,0 +64,0 @@ }(_Node2.default);

@@ -18,6 +18,2 @@ "use strict";

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -35,7 +31,13 @@

function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var YAMLSeq =
/*#__PURE__*/
function (_Collection) {
_inherits(YAMLSeq, _Collection);
function YAMLSeq() {

@@ -49,4 +51,6 @@ _classCallCheck(this, YAMLSeq);

key: "toJSON",
value: function toJSON() {
return this.items.map(_toJSON2.default);
value: function toJSON(_, keep) {
return this.items.map(function (v, i) {
return (0, _toJSON2.default)(v, String(i), keep);
});
}

@@ -57,3 +61,2 @@ }, {

if (!ctx) return JSON.stringify(this);
var itemIndent = (ctx.indent || '') + (ctx.inFlow ? ' ' : ' ');
return _get(_getPrototypeOf(YAMLSeq.prototype), "toString", this).call(this, ctx, {

@@ -69,3 +72,3 @@ blockItem: function blockItem(_ref) {

},
itemIndent: itemIndent
itemIndent: (ctx.indent || '') + ' '
}, onComment);

@@ -75,4 +78,2 @@ }

_inherits(YAMLSeq, _Collection);
return YAMLSeq;

@@ -79,0 +80,0 @@ }(_Collection2.default);

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

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function toJSON(value) {
return Array.isArray(value) ? value.map(toJSON) : value && _typeof(value) === 'object' && 'toJSON' in value ? value.toJSON() : value;
function toJSON(value, arg, keep) {
return Array.isArray(value) ? value.map(function (v, i) {
return toJSON(v, String(i), keep);
}) : value && typeof value.toJSON === 'function' ? value.toJSON(arg, keep) : value;
}
{
"name": "yaml",
"version": "1.0.0-rc.5",
"version": "1.0.0-rc.6",
"main": "dist/index.js",

@@ -58,11 +58,11 @@ "license": "ISC",

"devDependencies": {
"@babel/cli": "^7.0.0-beta.46",
"@babel/core": "^7.0.0-beta.46",
"@babel/preset-env": "^7.0.0-beta.46",
"@babel/preset-stage-3": "^7.0.0-beta.46",
"@babel/cli": "^7.0.0-beta.52",
"@babel/core": "^7.0.0-beta.52",
"@babel/preset-env": "^7.0.0-beta.52",
"@babel/preset-stage-3": "^7.0.0-beta.52",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^22.4.3",
"babel-jest": "^23.2.0",
"babel-plugin-trace": "^1.1.0",
"jest": "^22.4.3",
"prettier": "1.12.1"
"jest": "^23.3.0",
"prettier": "^1.13.7"
},

@@ -69,0 +69,0 @@ "dependencies": {},

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