aboutsummaryrefslogtreecommitdiff
path: root/node_modules/js-yaml/lib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/js-yaml/lib
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
node_modules
Diffstat (limited to 'node_modules/js-yaml/lib')
-rw-r--r--node_modules/js-yaml/lib/js-yaml/dumper.js5
-rw-r--r--node_modules/js-yaml/lib/js-yaml/exception.js10
-rw-r--r--node_modules/js-yaml/lib/js-yaml/loader.js25
3 files changed, 24 insertions, 16 deletions
diff --git a/node_modules/js-yaml/lib/js-yaml/dumper.js b/node_modules/js-yaml/lib/js-yaml/dumper.js
index c04230ada..6e60bbd01 100644
--- a/node_modules/js-yaml/lib/js-yaml/dumper.js
+++ b/node_modules/js-yaml/lib/js-yaml/dumper.js
@@ -114,6 +114,7 @@ function State(options) {
this.lineWidth = options['lineWidth'] || 80;
this.noRefs = options['noRefs'] || false;
this.noCompatMode = options['noCompatMode'] || false;
+ this.condenseFlow = options['condenseFlow'] || false;
this.implicitTypes = this.schema.compiledImplicit;
this.explicitTypes = this.schema.compiledExplicit;
@@ -483,7 +484,7 @@ function writeFlowSequence(state, level, object) {
for (index = 0, length = object.length; index < length; index += 1) {
// Write only valid elements.
if (writeNode(state, level, object[index], false, false)) {
- if (index !== 0) _result += ', ';
+ if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
_result += state.dump;
}
}
@@ -543,7 +544,7 @@ function writeFlowMapping(state, level, object) {
if (state.dump.length > 1024) pairBuffer += '? ';
- pairBuffer += state.dump + ': ';
+ pairBuffer += state.dump + ':' + (state.condenseFlow ? '' : ' ');
if (!writeNode(state, level, objectValue, false, false)) {
continue; // Skip this pair because of invalid value.
diff --git a/node_modules/js-yaml/lib/js-yaml/exception.js b/node_modules/js-yaml/lib/js-yaml/exception.js
index cf4e62520..b744a1ee4 100644
--- a/node_modules/js-yaml/lib/js-yaml/exception.js
+++ b/node_modules/js-yaml/lib/js-yaml/exception.js
@@ -6,6 +6,11 @@ function YAMLException(reason, mark) {
// Super constructor
Error.call(this);
+ this.name = 'YAMLException';
+ this.reason = reason;
+ this.mark = mark;
+ this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
+
// Include stack trace in error object
if (Error.captureStackTrace) {
// Chrome and NodeJS
@@ -14,11 +19,6 @@ function YAMLException(reason, mark) {
// FF, IE 10+ and Safari 6+. Fallback for others
this.stack = (new Error()).stack || '';
}
-
- this.name = 'YAMLException';
- this.reason = reason;
- this.mark = mark;
- this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
}
diff --git a/node_modules/js-yaml/lib/js-yaml/loader.js b/node_modules/js-yaml/lib/js-yaml/loader.js
index def3e71b9..9188da1f5 100644
--- a/node_modules/js-yaml/lib/js-yaml/loader.js
+++ b/node_modules/js-yaml/lib/js-yaml/loader.js
@@ -86,6 +86,7 @@ function fromDecimalCode(c) {
}
function simpleEscapeSequence(c) {
+ /* eslint-disable indent */
return (c === 0x30/* 0 */) ? '\x00' :
(c === 0x61/* a */) ? '\x07' :
(c === 0x62/* b */) ? '\x08' :
@@ -112,8 +113,10 @@ function charFromCodepoint(c) {
}
// Encode UTF-16 surrogate pair
// https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
- return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
- ((c - 0x010000) & 0x03FF) + 0xDC00);
+ return String.fromCharCode(
+ ((c - 0x010000) >> 10) + 0xD800,
+ ((c - 0x010000) & 0x03FF) + 0xDC00
+ );
}
var simpleEscapeCheck = new Array(256); // integer, for fast access
@@ -245,9 +248,7 @@ function captureSegment(state, start, end, checkJson) {
_result = state.input.slice(start, end);
if (checkJson) {
- for (_position = 0, _length = _result.length;
- _position < _length;
- _position += 1) {
+ for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
_character = _result.charCodeAt(_position);
if (!(_character === 0x09 ||
(0x20 <= _character && _character <= 0x10FFFF))) {
@@ -1365,9 +1366,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
if (state.tag !== null && state.tag !== '!') {
if (state.tag === '?') {
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
- typeIndex < typeQuantity;
- typeIndex += 1) {
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
type = state.implicitTypes[typeIndex];
// Implicit resolving is not allowed for non-scalar types, and '?'
@@ -1556,6 +1555,10 @@ function loadDocuments(input, options) {
function loadAll(input, iterator, options) {
var documents = loadDocuments(input, options), index, length;
+ if (typeof iterator !== 'function') {
+ return documents;
+ }
+
for (index = 0, length = documents.length; index < length; index += 1) {
iterator(documents[index]);
}
@@ -1576,7 +1579,11 @@ function load(input, options) {
function safeLoadAll(input, output, options) {
- loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+ if (typeof output === 'function') {
+ loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+ } else {
+ return loadAll(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+ }
}