1 /* js-yaml 3.13.1 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
5 var loader = require('./js-yaml/loader');
6 var dumper = require('./js-yaml/dumper');
9 function deprecated(name) {
11 throw new Error('Function ' + name + ' is deprecated and cannot be used.');
16 module.exports.Type = require('./js-yaml/type');
17 module.exports.Schema = require('./js-yaml/schema');
18 module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
19 module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
20 module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
21 module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
22 module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
23 module.exports.load = loader.load;
24 module.exports.loadAll = loader.loadAll;
25 module.exports.safeLoad = loader.safeLoad;
26 module.exports.safeLoadAll = loader.safeLoadAll;
27 module.exports.dump = dumper.dump;
28 module.exports.safeDump = dumper.safeDump;
29 module.exports.YAMLException = require('./js-yaml/exception');
31 // Deprecated schema names from JS-YAML 2.0.x
32 module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
33 module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
34 module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
36 // Deprecated functions from JS-YAML 1.x.x
37 module.exports.scan = deprecated('scan');
38 module.exports.parse = deprecated('parse');
39 module.exports.compose = deprecated('compose');
40 module.exports.addConstructor = deprecated('addConstructor');
42 },{"./js-yaml/dumper":3,"./js-yaml/exception":4,"./js-yaml/loader":5,"./js-yaml/schema":7,"./js-yaml/schema/core":8,"./js-yaml/schema/default_full":9,"./js-yaml/schema/default_safe":10,"./js-yaml/schema/failsafe":11,"./js-yaml/schema/json":12,"./js-yaml/type":13}],2:[function(require,module,exports){
46 function isNothing(subject) {
47 return (typeof subject === 'undefined') || (subject === null);
51 function isObject(subject) {
52 return (typeof subject === 'object') && (subject !== null);
56 function toArray(sequence) {
57 if (Array.isArray(sequence)) return sequence;
58 else if (isNothing(sequence)) return [];
64 function extend(target, source) {
65 var index, length, key, sourceKeys;
68 sourceKeys = Object.keys(source);
70 for (index = 0, length = sourceKeys.length; index < length; index += 1) {
71 key = sourceKeys[index];
72 target[key] = source[key];
80 function repeat(string, count) {
81 var result = '', cycle;
83 for (cycle = 0; cycle < count; cycle += 1) {
91 function isNegativeZero(number) {
92 return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
96 module.exports.isNothing = isNothing;
97 module.exports.isObject = isObject;
98 module.exports.toArray = toArray;
99 module.exports.repeat = repeat;
100 module.exports.isNegativeZero = isNegativeZero;
101 module.exports.extend = extend;
103 },{}],3:[function(require,module,exports){
106 /*eslint-disable no-use-before-define*/
108 var common = require('./common');
109 var YAMLException = require('./exception');
110 var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
111 var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
113 var _toString = Object.prototype.toString;
114 var _hasOwnProperty = Object.prototype.hasOwnProperty;
116 var CHAR_TAB = 0x09; /* Tab */
117 var CHAR_LINE_FEED = 0x0A; /* LF */
118 var CHAR_SPACE = 0x20; /* Space */
119 var CHAR_EXCLAMATION = 0x21; /* ! */
120 var CHAR_DOUBLE_QUOTE = 0x22; /* " */
121 var CHAR_SHARP = 0x23; /* # */
122 var CHAR_PERCENT = 0x25; /* % */
123 var CHAR_AMPERSAND = 0x26; /* & */
124 var CHAR_SINGLE_QUOTE = 0x27; /* ' */
125 var CHAR_ASTERISK = 0x2A; /* * */
126 var CHAR_COMMA = 0x2C; /* , */
127 var CHAR_MINUS = 0x2D; /* - */
128 var CHAR_COLON = 0x3A; /* : */
129 var CHAR_GREATER_THAN = 0x3E; /* > */
130 var CHAR_QUESTION = 0x3F; /* ? */
131 var CHAR_COMMERCIAL_AT = 0x40; /* @ */
132 var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
133 var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
134 var CHAR_GRAVE_ACCENT = 0x60; /* ` */
135 var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
136 var CHAR_VERTICAL_LINE = 0x7C; /* | */
137 var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
139 var ESCAPE_SEQUENCES = {};
141 ESCAPE_SEQUENCES[0x00] = '\\0';
142 ESCAPE_SEQUENCES[0x07] = '\\a';
143 ESCAPE_SEQUENCES[0x08] = '\\b';
144 ESCAPE_SEQUENCES[0x09] = '\\t';
145 ESCAPE_SEQUENCES[0x0A] = '\\n';
146 ESCAPE_SEQUENCES[0x0B] = '\\v';
147 ESCAPE_SEQUENCES[0x0C] = '\\f';
148 ESCAPE_SEQUENCES[0x0D] = '\\r';
149 ESCAPE_SEQUENCES[0x1B] = '\\e';
150 ESCAPE_SEQUENCES[0x22] = '\\"';
151 ESCAPE_SEQUENCES[0x5C] = '\\\\';
152 ESCAPE_SEQUENCES[0x85] = '\\N';
153 ESCAPE_SEQUENCES[0xA0] = '\\_';
154 ESCAPE_SEQUENCES[0x2028] = '\\L';
155 ESCAPE_SEQUENCES[0x2029] = '\\P';
157 var DEPRECATED_BOOLEANS_SYNTAX = [
158 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
159 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
162 function compileStyleMap(schema, map) {
163 var result, keys, index, length, tag, style, type;
165 if (map === null) return {};
168 keys = Object.keys(map);
170 for (index = 0, length = keys.length; index < length; index += 1) {
172 style = String(map[tag]);
174 if (tag.slice(0, 2) === '!!') {
175 tag = 'tag:yaml.org,2002:' + tag.slice(2);
177 type = schema.compiledTypeMap['fallback'][tag];
179 if (type && _hasOwnProperty.call(type.styleAliases, style)) {
180 style = type.styleAliases[style];
189 function encodeHex(character) {
190 var string, handle, length;
192 string = character.toString(16).toUpperCase();
194 if (character <= 0xFF) {
197 } else if (character <= 0xFFFF) {
200 } else if (character <= 0xFFFFFFFF) {
204 throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
207 return '\\' + handle + common.repeat('0', length - string.length) + string;
210 function State(options) {
211 this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
212 this.indent = Math.max(1, (options['indent'] || 2));
213 this.noArrayIndent = options['noArrayIndent'] || false;
214 this.skipInvalid = options['skipInvalid'] || false;
215 this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
216 this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
217 this.sortKeys = options['sortKeys'] || false;
218 this.lineWidth = options['lineWidth'] || 80;
219 this.noRefs = options['noRefs'] || false;
220 this.noCompatMode = options['noCompatMode'] || false;
221 this.condenseFlow = options['condenseFlow'] || false;
223 this.implicitTypes = this.schema.compiledImplicit;
224 this.explicitTypes = this.schema.compiledExplicit;
229 this.duplicates = [];
230 this.usedDuplicates = null;
233 // Indents every line in a string. Empty lines (\n only) are not indented.
234 function indentString(string, spaces) {
235 var ind = common.repeat(' ', spaces),
240 length = string.length;
242 while (position < length) {
243 next = string.indexOf('\n', position);
245 line = string.slice(position);
248 line = string.slice(position, next + 1);
252 if (line.length && line !== '\n') result += ind;
260 function generateNextLine(state, level) {
261 return '\n' + common.repeat(' ', state.indent * level);
264 function testImplicitResolving(state, str) {
265 var index, length, type;
267 for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
268 type = state.implicitTypes[index];
270 if (type.resolve(str)) {
278 // [33] s-white ::= s-space | s-tab
279 function isWhitespace(c) {
280 return c === CHAR_SPACE || c === CHAR_TAB;
283 // Returns true if the character can be printed without escaping.
284 // From YAML 1.2: "any allowed characters known to be non-printable
285 // should also be escaped. [However,] This isn’t mandatory"
286 // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
287 function isPrintable(c) {
288 return (0x00020 <= c && c <= 0x00007E)
289 || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
290 || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
291 || (0x10000 <= c && c <= 0x10FFFF);
294 // Simplified test for values allowed after the first character in plain style.
295 function isPlainSafe(c) {
296 // Uses a subset of nb-char - c-flow-indicator - ":" - "#"
297 // where nb-char ::= c-printable - b-char - c-byte-order-mark.
298 return isPrintable(c) && c !== 0xFEFF
299 // - c-flow-indicator
301 && c !== CHAR_LEFT_SQUARE_BRACKET
302 && c !== CHAR_RIGHT_SQUARE_BRACKET
303 && c !== CHAR_LEFT_CURLY_BRACKET
304 && c !== CHAR_RIGHT_CURLY_BRACKET
310 // Simplified test for values allowed as the first character in plain style.
311 function isPlainSafeFirst(c) {
312 // Uses a subset of ns-char - c-indicator
313 // where ns-char = nb-char - s-white.
314 return isPrintable(c) && c !== 0xFEFF
315 && !isWhitespace(c) // - s-white
316 // - (c-indicator ::=
317 // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
319 && c !== CHAR_QUESTION
322 && c !== CHAR_LEFT_SQUARE_BRACKET
323 && c !== CHAR_RIGHT_SQUARE_BRACKET
324 && c !== CHAR_LEFT_CURLY_BRACKET
325 && c !== CHAR_RIGHT_CURLY_BRACKET
326 // | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"”
328 && c !== CHAR_AMPERSAND
329 && c !== CHAR_ASTERISK
330 && c !== CHAR_EXCLAMATION
331 && c !== CHAR_VERTICAL_LINE
332 && c !== CHAR_GREATER_THAN
333 && c !== CHAR_SINGLE_QUOTE
334 && c !== CHAR_DOUBLE_QUOTE
335 // | “%” | “@” | “`”)
336 && c !== CHAR_PERCENT
337 && c !== CHAR_COMMERCIAL_AT
338 && c !== CHAR_GRAVE_ACCENT;
341 // Determines whether block indentation indicator is required.
342 function needIndentIndicator(string) {
343 var leadingSpaceRe = /^\n* /;
344 return leadingSpaceRe.test(string);
353 // Determines which scalar styles are possible and returns the preferred style.
354 // lineWidth = -1 => no limit.
355 // Pre-conditions: str.length > 0.
357 // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
358 // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
359 // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
360 function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
363 var hasLineBreak = false;
364 var hasFoldableLine = false; // only checked if shouldTrackWidth
365 var shouldTrackWidth = lineWidth !== -1;
366 var previousLineBreak = -1; // count the first line correctly
367 var plain = isPlainSafeFirst(string.charCodeAt(0))
368 && !isWhitespace(string.charCodeAt(string.length - 1));
370 if (singleLineOnly) {
371 // Case: no block styles.
372 // Check for disallowed characters to rule out plain and single.
373 for (i = 0; i < string.length; i++) {
374 char = string.charCodeAt(i);
375 if (!isPrintable(char)) {
378 plain = plain && isPlainSafe(char);
381 // Case: block styles permitted.
382 for (i = 0; i < string.length; i++) {
383 char = string.charCodeAt(i);
384 if (char === CHAR_LINE_FEED) {
386 // Check if any line can be folded.
387 if (shouldTrackWidth) {
388 hasFoldableLine = hasFoldableLine ||
389 // Foldable line = too long, and not more-indented.
390 (i - previousLineBreak - 1 > lineWidth &&
391 string[previousLineBreak + 1] !== ' ');
392 previousLineBreak = i;
394 } else if (!isPrintable(char)) {
397 plain = plain && isPlainSafe(char);
399 // in case the end is missing a \n
400 hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
401 (i - previousLineBreak - 1 > lineWidth &&
402 string[previousLineBreak + 1] !== ' '));
404 // Although every style can represent \n without escaping, prefer block styles
405 // for multiline, since they're more readable and they don't add empty lines.
406 // Also prefer folding a super-long line.
407 if (!hasLineBreak && !hasFoldableLine) {
408 // Strings interpretable as another type have to be quoted;
409 // e.g. the string 'true' vs. the boolean true.
410 return plain && !testAmbiguousType(string)
411 ? STYLE_PLAIN : STYLE_SINGLE;
413 // Edge case: block indentation indicator can only have one digit.
414 if (indentPerLevel > 9 && needIndentIndicator(string)) {
417 // At this point we know block styles are valid.
418 // Prefer literal style unless we want to fold.
419 return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
422 // Note: line breaking/folding is implemented for only the folded style.
423 // NB. We drop the last trailing newline (if any) of a returned block scalar
424 // since the dumper adds its own newline. This always works:
425 // • No ending newline => unaffected; already using strip "-" chomping.
426 // • Ending newline => removed then restored.
427 // Importantly, this keeps the "+" chomp indicator from gaining an extra line.
428 function writeScalar(state, string, level, iskey) {
429 state.dump = (function () {
430 if (string.length === 0) {
433 if (!state.noCompatMode &&
434 DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
435 return "'" + string + "'";
438 var indent = state.indent * Math.max(1, level); // no 0-indent scalars
439 // As indentation gets deeper, let the width decrease monotonically
440 // to the lower bound min(state.lineWidth, 40).
441 // Note that this implies
442 // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
443 // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
444 // This behaves better than a constant minimum width which disallows narrower options,
445 // or an indent threshold which causes the width to suddenly increase.
446 var lineWidth = state.lineWidth === -1
447 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
449 // Without knowing if keys are implicit/explicit, assume implicit for safety.
450 var singleLineOnly = iskey
451 // No block styles in flow mode.
452 || (state.flowLevel > -1 && level >= state.flowLevel);
453 function testAmbiguity(string) {
454 return testImplicitResolving(state, string);
457 switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
461 return "'" + string.replace(/'/g, "''") + "'";
463 return '|' + blockHeader(string, state.indent)
464 + dropEndingNewline(indentString(string, indent));
466 return '>' + blockHeader(string, state.indent)
467 + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
469 return '"' + escapeString(string, lineWidth) + '"';
471 throw new YAMLException('impossible error: invalid scalar style');
476 // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
477 function blockHeader(string, indentPerLevel) {
478 var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
480 // note the special case: the string '\n' counts as a "trailing" empty line.
481 var clip = string[string.length - 1] === '\n';
482 var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
483 var chomp = keep ? '+' : (clip ? '' : '-');
485 return indentIndicator + chomp + '\n';
488 // (See the note for writeScalar.)
489 function dropEndingNewline(string) {
490 return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
493 // Note: a long line without a suitable break point will exceed the width limit.
494 // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
495 function foldString(string, width) {
496 // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
497 // unless they're before or after a more-indented line, or at the very
498 // beginning or end, in which case $k$ maps to $k$.
499 // Therefore, parse each chunk as newline(s) followed by a content line.
500 var lineRe = /(\n+)([^\n]*)/g;
502 // first line (possibly an empty line)
503 var result = (function () {
504 var nextLF = string.indexOf('\n');
505 nextLF = nextLF !== -1 ? nextLF : string.length;
506 lineRe.lastIndex = nextLF;
507 return foldLine(string.slice(0, nextLF), width);
509 // If we haven't reached the first content line yet, don't add an extra \n.
510 var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
515 while ((match = lineRe.exec(string))) {
516 var prefix = match[1], line = match[2];
517 moreIndented = (line[0] === ' ');
519 + (!prevMoreIndented && !moreIndented && line !== ''
521 + foldLine(line, width);
522 prevMoreIndented = moreIndented;
528 // Greedy line breaking.
529 // Picks the longest line under the limit each time,
530 // otherwise settles for the shortest line over the limit.
531 // NB. More-indented lines *cannot* be folded, as that would add an extra \n.
532 function foldLine(line, width) {
533 if (line === '' || line[0] === ' ') return line;
535 // Since a more-indented line adds a \n, breaks can't be followed by a space.
536 var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
538 // start is an inclusive index. end, curr, and next are exclusive.
539 var start = 0, end, curr = 0, next = 0;
542 // Invariants: 0 <= start <= length-1.
543 // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
545 // A match implies length >= 2, so curr and next are <= length-2.
546 while ((match = breakRe.exec(line))) {
548 // maintain invariant: curr - start <= width
549 if (next - start > width) {
550 end = (curr > start) ? curr : next; // derive end <= length-2
551 result += '\n' + line.slice(start, end);
552 // skip the space that was output as \n
553 start = end + 1; // derive start <= length-1
558 // By the invariants, start <= length-1, so there is something left over.
559 // It is either the whole string or a part starting from non-whitespace.
561 // Insert a break if the remainder is too long and there is a break available.
562 if (line.length - start > width && curr > start) {
563 result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
565 result += line.slice(start);
568 return result.slice(1); // drop extra \n joiner
571 // Escapes a double-quoted string.
572 function escapeString(string) {
577 for (var i = 0; i < string.length; i++) {
578 char = string.charCodeAt(i);
579 // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates").
580 if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) {
581 nextChar = string.charCodeAt(i + 1);
582 if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) {
583 // Combine the surrogate pair and store it escaped.
584 result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
585 // Advance index one extra since we already used that char here.
589 escapeSeq = ESCAPE_SEQUENCES[char];
590 result += !escapeSeq && isPrintable(char)
592 : escapeSeq || encodeHex(char);
598 function writeFlowSequence(state, level, object) {
604 for (index = 0, length = object.length; index < length; index += 1) {
605 // Write only valid elements.
606 if (writeNode(state, level, object[index], false, false)) {
607 if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
608 _result += state.dump;
613 state.dump = '[' + _result + ']';
616 function writeBlockSequence(state, level, object, compact) {
622 for (index = 0, length = object.length; index < length; index += 1) {
623 // Write only valid elements.
624 if (writeNode(state, level + 1, object[index], true, true)) {
625 if (!compact || index !== 0) {
626 _result += generateNextLine(state, level);
629 if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
635 _result += state.dump;
640 state.dump = _result || '[]'; // Empty sequence if no valid values.
643 function writeFlowMapping(state, level, object) {
646 objectKeyList = Object.keys(object),
653 for (index = 0, length = objectKeyList.length; index < length; index += 1) {
654 pairBuffer = state.condenseFlow ? '"' : '';
656 if (index !== 0) pairBuffer += ', ';
658 objectKey = objectKeyList[index];
659 objectValue = object[objectKey];
661 if (!writeNode(state, level, objectKey, false, false)) {
662 continue; // Skip this pair because of invalid key;
665 if (state.dump.length > 1024) pairBuffer += '? ';
667 pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
669 if (!writeNode(state, level, objectValue, false, false)) {
670 continue; // Skip this pair because of invalid value.
673 pairBuffer += state.dump;
675 // Both key and value are valid.
676 _result += pairBuffer;
680 state.dump = '{' + _result + '}';
683 function writeBlockMapping(state, level, object, compact) {
686 objectKeyList = Object.keys(object),
694 // Allow sorting keys so that the output file is deterministic
695 if (state.sortKeys === true) {
697 objectKeyList.sort();
698 } else if (typeof state.sortKeys === 'function') {
699 // Custom sort function
700 objectKeyList.sort(state.sortKeys);
701 } else if (state.sortKeys) {
702 // Something is wrong
703 throw new YAMLException('sortKeys must be a boolean or a function');
706 for (index = 0, length = objectKeyList.length; index < length; index += 1) {
709 if (!compact || index !== 0) {
710 pairBuffer += generateNextLine(state, level);
713 objectKey = objectKeyList[index];
714 objectValue = object[objectKey];
716 if (!writeNode(state, level + 1, objectKey, true, true, true)) {
717 continue; // Skip this pair because of invalid key.
720 explicitPair = (state.tag !== null && state.tag !== '?') ||
721 (state.dump && state.dump.length > 1024);
724 if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
731 pairBuffer += state.dump;
734 pairBuffer += generateNextLine(state, level);
737 if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
738 continue; // Skip this pair because of invalid value.
741 if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
747 pairBuffer += state.dump;
749 // Both key and value are valid.
750 _result += pairBuffer;
754 state.dump = _result || '{}'; // Empty mapping if no valid pairs.
757 function detectType(state, object, explicit) {
758 var _result, typeList, index, length, type, style;
760 typeList = explicit ? state.explicitTypes : state.implicitTypes;
762 for (index = 0, length = typeList.length; index < length; index += 1) {
763 type = typeList[index];
765 if ((type.instanceOf || type.predicate) &&
766 (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
767 (!type.predicate || type.predicate(object))) {
769 state.tag = explicit ? type.tag : '?';
771 if (type.represent) {
772 style = state.styleMap[type.tag] || type.defaultStyle;
774 if (_toString.call(type.represent) === '[object Function]') {
775 _result = type.represent(object, style);
776 } else if (_hasOwnProperty.call(type.represent, style)) {
777 _result = type.represent[style](object, style);
779 throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
782 state.dump = _result;
792 // Serializes `object` and writes it to global `result`.
793 // Returns true on success, or false on invalid object.
795 function writeNode(state, level, object, block, compact, iskey) {
799 if (!detectType(state, object, false)) {
800 detectType(state, object, true);
803 var type = _toString.call(state.dump);
806 block = (state.flowLevel < 0 || state.flowLevel > level);
809 var objectOrArray = type === '[object Object]' || type === '[object Array]',
814 duplicateIndex = state.duplicates.indexOf(object);
815 duplicate = duplicateIndex !== -1;
818 if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
822 if (duplicate && state.usedDuplicates[duplicateIndex]) {
823 state.dump = '*ref_' + duplicateIndex;
825 if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
826 state.usedDuplicates[duplicateIndex] = true;
828 if (type === '[object Object]') {
829 if (block && (Object.keys(state.dump).length !== 0)) {
830 writeBlockMapping(state, level, state.dump, compact);
832 state.dump = '&ref_' + duplicateIndex + state.dump;
835 writeFlowMapping(state, level, state.dump);
837 state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
840 } else if (type === '[object Array]') {
841 var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level;
842 if (block && (state.dump.length !== 0)) {
843 writeBlockSequence(state, arrayLevel, state.dump, compact);
845 state.dump = '&ref_' + duplicateIndex + state.dump;
848 writeFlowSequence(state, arrayLevel, state.dump);
850 state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
853 } else if (type === '[object String]') {
854 if (state.tag !== '?') {
855 writeScalar(state, state.dump, level, iskey);
858 if (state.skipInvalid) return false;
859 throw new YAMLException('unacceptable kind of an object to dump ' + type);
862 if (state.tag !== null && state.tag !== '?') {
863 state.dump = '!<' + state.tag + '> ' + state.dump;
870 function getDuplicateReferences(object, state) {
872 duplicatesIndexes = [],
876 inspectNode(object, objects, duplicatesIndexes);
878 for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
879 state.duplicates.push(objects[duplicatesIndexes[index]]);
881 state.usedDuplicates = new Array(length);
884 function inspectNode(object, objects, duplicatesIndexes) {
889 if (object !== null && typeof object === 'object') {
890 index = objects.indexOf(object);
892 if (duplicatesIndexes.indexOf(index) === -1) {
893 duplicatesIndexes.push(index);
896 objects.push(object);
898 if (Array.isArray(object)) {
899 for (index = 0, length = object.length; index < length; index += 1) {
900 inspectNode(object[index], objects, duplicatesIndexes);
903 objectKeyList = Object.keys(object);
905 for (index = 0, length = objectKeyList.length; index < length; index += 1) {
906 inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
913 function dump(input, options) {
914 options = options || {};
916 var state = new State(options);
918 if (!state.noRefs) getDuplicateReferences(input, state);
920 if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
925 function safeDump(input, options) {
926 return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
929 module.exports.dump = dump;
930 module.exports.safeDump = safeDump;
932 },{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){
933 // YAML error class. http://stackoverflow.com/questions/8458984
937 function YAMLException(reason, mark) {
941 this.name = 'YAMLException';
942 this.reason = reason;
944 this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
946 // Include stack trace in error object
947 if (Error.captureStackTrace) {
949 Error.captureStackTrace(this, this.constructor);
951 // FF, IE 10+ and Safari 6+. Fallback for others
952 this.stack = (new Error()).stack || '';
957 // Inherit from Error
958 YAMLException.prototype = Object.create(Error.prototype);
959 YAMLException.prototype.constructor = YAMLException;
962 YAMLException.prototype.toString = function toString(compact) {
963 var result = this.name + ': ';
965 result += this.reason || '(unknown reason)';
967 if (!compact && this.mark) {
968 result += ' ' + this.mark.toString();
975 module.exports = YAMLException;
977 },{}],5:[function(require,module,exports){
980 /*eslint-disable max-len,no-use-before-define*/
982 var common = require('./common');
983 var YAMLException = require('./exception');
984 var Mark = require('./mark');
985 var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
986 var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
989 var _hasOwnProperty = Object.prototype.hasOwnProperty;
992 var CONTEXT_FLOW_IN = 1;
993 var CONTEXT_FLOW_OUT = 2;
994 var CONTEXT_BLOCK_IN = 3;
995 var CONTEXT_BLOCK_OUT = 4;
998 var CHOMPING_CLIP = 1;
999 var CHOMPING_STRIP = 2;
1000 var CHOMPING_KEEP = 3;
1003 var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1004 var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
1005 var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
1006 var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
1007 var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
1010 function _class(obj) { return Object.prototype.toString.call(obj); }
1012 function is_EOL(c) {
1013 return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
1016 function is_WHITE_SPACE(c) {
1017 return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
1020 function is_WS_OR_EOL(c) {
1021 return (c === 0x09/* Tab */) ||
1022 (c === 0x20/* Space */) ||
1023 (c === 0x0A/* LF */) ||
1024 (c === 0x0D/* CR */);
1027 function is_FLOW_INDICATOR(c) {
1028 return c === 0x2C/* , */ ||
1029 c === 0x5B/* [ */ ||
1030 c === 0x5D/* ] */ ||
1031 c === 0x7B/* { */ ||
1035 function fromHexCode(c) {
1038 if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
1042 /*eslint-disable no-bitwise*/
1045 if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
1046 return lc - 0x61 + 10;
1052 function escapedHexLen(c) {
1053 if (c === 0x78/* x */) { return 2; }
1054 if (c === 0x75/* u */) { return 4; }
1055 if (c === 0x55/* U */) { return 8; }
1059 function fromDecimalCode(c) {
1060 if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
1067 function simpleEscapeSequence(c) {
1068 /* eslint-disable indent */
1069 return (c === 0x30/* 0 */) ? '\x00' :
1070 (c === 0x61/* a */) ? '\x07' :
1071 (c === 0x62/* b */) ? '\x08' :
1072 (c === 0x74/* t */) ? '\x09' :
1073 (c === 0x09/* Tab */) ? '\x09' :
1074 (c === 0x6E/* n */) ? '\x0A' :
1075 (c === 0x76/* v */) ? '\x0B' :
1076 (c === 0x66/* f */) ? '\x0C' :
1077 (c === 0x72/* r */) ? '\x0D' :
1078 (c === 0x65/* e */) ? '\x1B' :
1079 (c === 0x20/* Space */) ? ' ' :
1080 (c === 0x22/* " */) ? '\x22' :
1081 (c === 0x2F/* / */) ? '/' :
1082 (c === 0x5C/* \ */) ? '\x5C' :
1083 (c === 0x4E/* N */) ? '\x85' :
1084 (c === 0x5F/* _ */) ? '\xA0' :
1085 (c === 0x4C/* L */) ? '\u2028' :
1086 (c === 0x50/* P */) ? '\u2029' : '';
1089 function charFromCodepoint(c) {
1091 return String.fromCharCode(c);
1093 // Encode UTF-16 surrogate pair
1094 // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
1095 return String.fromCharCode(
1096 ((c - 0x010000) >> 10) + 0xD800,
1097 ((c - 0x010000) & 0x03FF) + 0xDC00
1101 var simpleEscapeCheck = new Array(256); // integer, for fast access
1102 var simpleEscapeMap = new Array(256);
1103 for (var i = 0; i < 256; i++) {
1104 simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
1105 simpleEscapeMap[i] = simpleEscapeSequence(i);
1109 function State(input, options) {
1112 this.filename = options['filename'] || null;
1113 this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
1114 this.onWarning = options['onWarning'] || null;
1115 this.legacy = options['legacy'] || false;
1116 this.json = options['json'] || false;
1117 this.listener = options['listener'] || null;
1119 this.implicitTypes = this.schema.compiledImplicit;
1120 this.typeMap = this.schema.compiledTypeMap;
1122 this.length = input.length;
1126 this.lineIndent = 0;
1128 this.documents = [];
1132 this.checkLineBreaks;
1143 function generateError(state, message) {
1144 return new YAMLException(
1146 new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
1149 function throwError(state, message) {
1150 throw generateError(state, message);
1153 function throwWarning(state, message) {
1154 if (state.onWarning) {
1155 state.onWarning.call(null, generateError(state, message));
1160 var directiveHandlers = {
1162 YAML: function handleYamlDirective(state, name, args) {
1164 var match, major, minor;
1166 if (state.version !== null) {
1167 throwError(state, 'duplication of %YAML directive');
1170 if (args.length !== 1) {
1171 throwError(state, 'YAML directive accepts exactly one argument');
1174 match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
1176 if (match === null) {
1177 throwError(state, 'ill-formed argument of the YAML directive');
1180 major = parseInt(match[1], 10);
1181 minor = parseInt(match[2], 10);
1184 throwError(state, 'unacceptable YAML version of the document');
1187 state.version = args[0];
1188 state.checkLineBreaks = (minor < 2);
1190 if (minor !== 1 && minor !== 2) {
1191 throwWarning(state, 'unsupported YAML version of the document');
1195 TAG: function handleTagDirective(state, name, args) {
1199 if (args.length !== 2) {
1200 throwError(state, 'TAG directive accepts exactly two arguments');
1206 if (!PATTERN_TAG_HANDLE.test(handle)) {
1207 throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
1210 if (_hasOwnProperty.call(state.tagMap, handle)) {
1211 throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
1214 if (!PATTERN_TAG_URI.test(prefix)) {
1215 throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
1218 state.tagMap[handle] = prefix;
1223 function captureSegment(state, start, end, checkJson) {
1224 var _position, _length, _character, _result;
1227 _result = state.input.slice(start, end);
1230 for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
1231 _character = _result.charCodeAt(_position);
1232 if (!(_character === 0x09 ||
1233 (0x20 <= _character && _character <= 0x10FFFF))) {
1234 throwError(state, 'expected valid JSON character');
1237 } else if (PATTERN_NON_PRINTABLE.test(_result)) {
1238 throwError(state, 'the stream contains non-printable characters');
1241 state.result += _result;
1245 function mergeMappings(state, destination, source, overridableKeys) {
1246 var sourceKeys, key, index, quantity;
1248 if (!common.isObject(source)) {
1249 throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
1252 sourceKeys = Object.keys(source);
1254 for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1255 key = sourceKeys[index];
1257 if (!_hasOwnProperty.call(destination, key)) {
1258 destination[key] = source[key];
1259 overridableKeys[key] = true;
1264 function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
1265 var index, quantity;
1267 // The output is a plain object here, so keys can only be strings.
1268 // We need to convert keyNode to a string, but doing so can hang the process
1269 // (deeply nested arrays that explode exponentially using aliases).
1270 if (Array.isArray(keyNode)) {
1271 keyNode = Array.prototype.slice.call(keyNode);
1273 for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
1274 if (Array.isArray(keyNode[index])) {
1275 throwError(state, 'nested arrays are not supported inside keys');
1278 if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
1279 keyNode[index] = '[object Object]';
1284 // Avoid code execution in load() via toString property
1285 // (still use its own toString for arrays, timestamps,
1286 // and whatever user schema extensions happen to have @@toStringTag)
1287 if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
1288 keyNode = '[object Object]';
1292 keyNode = String(keyNode);
1294 if (_result === null) {
1298 if (keyTag === 'tag:yaml.org,2002:merge') {
1299 if (Array.isArray(valueNode)) {
1300 for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
1301 mergeMappings(state, _result, valueNode[index], overridableKeys);
1304 mergeMappings(state, _result, valueNode, overridableKeys);
1308 !_hasOwnProperty.call(overridableKeys, keyNode) &&
1309 _hasOwnProperty.call(_result, keyNode)) {
1310 state.line = startLine || state.line;
1311 state.position = startPos || state.position;
1312 throwError(state, 'duplicated mapping key');
1314 _result[keyNode] = valueNode;
1315 delete overridableKeys[keyNode];
1321 function readLineBreak(state) {
1324 ch = state.input.charCodeAt(state.position);
1326 if (ch === 0x0A/* LF */) {
1328 } else if (ch === 0x0D/* CR */) {
1330 if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
1334 throwError(state, 'a line break is expected');
1338 state.lineStart = state.position;
1341 function skipSeparationSpace(state, allowComments, checkIndent) {
1343 ch = state.input.charCodeAt(state.position);
1346 while (is_WHITE_SPACE(ch)) {
1347 ch = state.input.charCodeAt(++state.position);
1350 if (allowComments && ch === 0x23/* # */) {
1352 ch = state.input.charCodeAt(++state.position);
1353 } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
1357 readLineBreak(state);
1359 ch = state.input.charCodeAt(state.position);
1361 state.lineIndent = 0;
1363 while (ch === 0x20/* Space */) {
1365 ch = state.input.charCodeAt(++state.position);
1372 if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
1373 throwWarning(state, 'deficient indentation');
1379 function testDocumentSeparator(state) {
1380 var _position = state.position,
1383 ch = state.input.charCodeAt(_position);
1385 // Condition state.position === state.lineStart is tested
1386 // in parent on each call, for efficiency. No needs to test here again.
1387 if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
1388 ch === state.input.charCodeAt(_position + 1) &&
1389 ch === state.input.charCodeAt(_position + 2)) {
1393 ch = state.input.charCodeAt(_position);
1395 if (ch === 0 || is_WS_OR_EOL(ch)) {
1403 function writeFoldedLines(state, count) {
1405 state.result += ' ';
1406 } else if (count > 1) {
1407 state.result += common.repeat('\n', count - 1);
1412 function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1422 _result = state.result,
1425 ch = state.input.charCodeAt(state.position);
1427 if (is_WS_OR_EOL(ch) ||
1428 is_FLOW_INDICATOR(ch) ||
1429 ch === 0x23/* # */ ||
1430 ch === 0x26/* & */ ||
1431 ch === 0x2A/* * */ ||
1432 ch === 0x21/* ! */ ||
1433 ch === 0x7C/* | */ ||
1434 ch === 0x3E/* > */ ||
1435 ch === 0x27/* ' */ ||
1436 ch === 0x22/* " */ ||
1437 ch === 0x25/* % */ ||
1438 ch === 0x40/* @ */ ||
1439 ch === 0x60/* ` */) {
1443 if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
1444 following = state.input.charCodeAt(state.position + 1);
1446 if (is_WS_OR_EOL(following) ||
1447 withinFlowCollection && is_FLOW_INDICATOR(following)) {
1452 state.kind = 'scalar';
1454 captureStart = captureEnd = state.position;
1455 hasPendingContent = false;
1458 if (ch === 0x3A/* : */) {
1459 following = state.input.charCodeAt(state.position + 1);
1461 if (is_WS_OR_EOL(following) ||
1462 withinFlowCollection && is_FLOW_INDICATOR(following)) {
1466 } else if (ch === 0x23/* # */) {
1467 preceding = state.input.charCodeAt(state.position - 1);
1469 if (is_WS_OR_EOL(preceding)) {
1473 } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
1474 withinFlowCollection && is_FLOW_INDICATOR(ch)) {
1477 } else if (is_EOL(ch)) {
1479 _lineStart = state.lineStart;
1480 _lineIndent = state.lineIndent;
1481 skipSeparationSpace(state, false, -1);
1483 if (state.lineIndent >= nodeIndent) {
1484 hasPendingContent = true;
1485 ch = state.input.charCodeAt(state.position);
1488 state.position = captureEnd;
1490 state.lineStart = _lineStart;
1491 state.lineIndent = _lineIndent;
1496 if (hasPendingContent) {
1497 captureSegment(state, captureStart, captureEnd, false);
1498 writeFoldedLines(state, state.line - _line);
1499 captureStart = captureEnd = state.position;
1500 hasPendingContent = false;
1503 if (!is_WHITE_SPACE(ch)) {
1504 captureEnd = state.position + 1;
1507 ch = state.input.charCodeAt(++state.position);
1510 captureSegment(state, captureStart, captureEnd, false);
1517 state.result = _result;
1521 function readSingleQuotedScalar(state, nodeIndent) {
1523 captureStart, captureEnd;
1525 ch = state.input.charCodeAt(state.position);
1527 if (ch !== 0x27/* ' */) {
1531 state.kind = 'scalar';
1534 captureStart = captureEnd = state.position;
1536 while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1537 if (ch === 0x27/* ' */) {
1538 captureSegment(state, captureStart, state.position, true);
1539 ch = state.input.charCodeAt(++state.position);
1541 if (ch === 0x27/* ' */) {
1542 captureStart = state.position;
1544 captureEnd = state.position;
1549 } else if (is_EOL(ch)) {
1550 captureSegment(state, captureStart, captureEnd, true);
1551 writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1552 captureStart = captureEnd = state.position;
1554 } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1555 throwError(state, 'unexpected end of the document within a single quoted scalar');
1559 captureEnd = state.position;
1563 throwError(state, 'unexpected end of the stream within a single quoted scalar');
1566 function readDoubleQuotedScalar(state, nodeIndent) {
1574 ch = state.input.charCodeAt(state.position);
1576 if (ch !== 0x22/* " */) {
1580 state.kind = 'scalar';
1583 captureStart = captureEnd = state.position;
1585 while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1586 if (ch === 0x22/* " */) {
1587 captureSegment(state, captureStart, state.position, true);
1591 } else if (ch === 0x5C/* \ */) {
1592 captureSegment(state, captureStart, state.position, true);
1593 ch = state.input.charCodeAt(++state.position);
1596 skipSeparationSpace(state, false, nodeIndent);
1598 // TODO: rework to inline fn with no type cast?
1599 } else if (ch < 256 && simpleEscapeCheck[ch]) {
1600 state.result += simpleEscapeMap[ch];
1603 } else if ((tmp = escapedHexLen(ch)) > 0) {
1607 for (; hexLength > 0; hexLength--) {
1608 ch = state.input.charCodeAt(++state.position);
1610 if ((tmp = fromHexCode(ch)) >= 0) {
1611 hexResult = (hexResult << 4) + tmp;
1614 throwError(state, 'expected hexadecimal character');
1618 state.result += charFromCodepoint(hexResult);
1623 throwError(state, 'unknown escape sequence');
1626 captureStart = captureEnd = state.position;
1628 } else if (is_EOL(ch)) {
1629 captureSegment(state, captureStart, captureEnd, true);
1630 writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1631 captureStart = captureEnd = state.position;
1633 } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1634 throwError(state, 'unexpected end of the document within a double quoted scalar');
1638 captureEnd = state.position;
1642 throwError(state, 'unexpected end of the stream within a double quoted scalar');
1645 function readFlowCollection(state, nodeIndent) {
1646 var readNext = true,
1650 _anchor = state.anchor,
1656 overridableKeys = {},
1662 ch = state.input.charCodeAt(state.position);
1664 if (ch === 0x5B/* [ */) {
1665 terminator = 0x5D;/* ] */
1668 } else if (ch === 0x7B/* { */) {
1669 terminator = 0x7D;/* } */
1676 if (state.anchor !== null) {
1677 state.anchorMap[state.anchor] = _result;
1680 ch = state.input.charCodeAt(++state.position);
1683 skipSeparationSpace(state, true, nodeIndent);
1685 ch = state.input.charCodeAt(state.position);
1687 if (ch === terminator) {
1690 state.anchor = _anchor;
1691 state.kind = isMapping ? 'mapping' : 'sequence';
1692 state.result = _result;
1694 } else if (!readNext) {
1695 throwError(state, 'missed comma between flow collection entries');
1698 keyTag = keyNode = valueNode = null;
1699 isPair = isExplicitPair = false;
1701 if (ch === 0x3F/* ? */) {
1702 following = state.input.charCodeAt(state.position + 1);
1704 if (is_WS_OR_EOL(following)) {
1705 isPair = isExplicitPair = true;
1707 skipSeparationSpace(state, true, nodeIndent);
1712 composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1714 keyNode = state.result;
1715 skipSeparationSpace(state, true, nodeIndent);
1717 ch = state.input.charCodeAt(state.position);
1719 if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
1721 ch = state.input.charCodeAt(++state.position);
1722 skipSeparationSpace(state, true, nodeIndent);
1723 composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1724 valueNode = state.result;
1728 storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
1729 } else if (isPair) {
1730 _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
1732 _result.push(keyNode);
1735 skipSeparationSpace(state, true, nodeIndent);
1737 ch = state.input.charCodeAt(state.position);
1739 if (ch === 0x2C/* , */) {
1741 ch = state.input.charCodeAt(++state.position);
1747 throwError(state, 'unexpected end of the stream within a flow collection');
1750 function readBlockScalar(state, nodeIndent) {
1753 chomping = CHOMPING_CLIP,
1754 didReadContent = false,
1755 detectedIndent = false,
1756 textIndent = nodeIndent,
1758 atMoreIndented = false,
1762 ch = state.input.charCodeAt(state.position);
1764 if (ch === 0x7C/* | */) {
1766 } else if (ch === 0x3E/* > */) {
1772 state.kind = 'scalar';
1776 ch = state.input.charCodeAt(++state.position);
1778 if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
1779 if (CHOMPING_CLIP === chomping) {
1780 chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
1782 throwError(state, 'repeat of a chomping mode identifier');
1785 } else if ((tmp = fromDecimalCode(ch)) >= 0) {
1787 throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
1788 } else if (!detectedIndent) {
1789 textIndent = nodeIndent + tmp - 1;
1790 detectedIndent = true;
1792 throwError(state, 'repeat of an indentation width identifier');
1800 if (is_WHITE_SPACE(ch)) {
1801 do { ch = state.input.charCodeAt(++state.position); }
1802 while (is_WHITE_SPACE(ch));
1804 if (ch === 0x23/* # */) {
1805 do { ch = state.input.charCodeAt(++state.position); }
1806 while (!is_EOL(ch) && (ch !== 0));
1811 readLineBreak(state);
1812 state.lineIndent = 0;
1814 ch = state.input.charCodeAt(state.position);
1816 while ((!detectedIndent || state.lineIndent < textIndent) &&
1817 (ch === 0x20/* Space */)) {
1819 ch = state.input.charCodeAt(++state.position);
1822 if (!detectedIndent && state.lineIndent > textIndent) {
1823 textIndent = state.lineIndent;
1831 // End of the scalar.
1832 if (state.lineIndent < textIndent) {
1834 // Perform the chomping.
1835 if (chomping === CHOMPING_KEEP) {
1836 state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1837 } else if (chomping === CHOMPING_CLIP) {
1838 if (didReadContent) { // i.e. only if the scalar is not empty.
1839 state.result += '\n';
1843 // Break this `while` cycle and go to the funciton's epilogue.
1847 // Folded style: use fancy rules to handle line breaks.
1850 // Lines starting with white space characters (more-indented lines) are not folded.
1851 if (is_WHITE_SPACE(ch)) {
1852 atMoreIndented = true;
1853 // except for the first content line (cf. Example 8.1)
1854 state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1856 // End of more-indented block.
1857 } else if (atMoreIndented) {
1858 atMoreIndented = false;
1859 state.result += common.repeat('\n', emptyLines + 1);
1861 // Just one line break - perceive as the same line.
1862 } else if (emptyLines === 0) {
1863 if (didReadContent) { // i.e. only if we have already read some scalar content.
1864 state.result += ' ';
1867 // Several line breaks - perceive as different lines.
1869 state.result += common.repeat('\n', emptyLines);
1872 // Literal style: just add exact number of line breaks between content lines.
1874 // Keep all line breaks except the header line break.
1875 state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1878 didReadContent = true;
1879 detectedIndent = true;
1881 captureStart = state.position;
1883 while (!is_EOL(ch) && (ch !== 0)) {
1884 ch = state.input.charCodeAt(++state.position);
1887 captureSegment(state, captureStart, state.position, false);
1893 function readBlockSequence(state, nodeIndent) {
1896 _anchor = state.anchor,
1902 if (state.anchor !== null) {
1903 state.anchorMap[state.anchor] = _result;
1906 ch = state.input.charCodeAt(state.position);
1910 if (ch !== 0x2D/* - */) {
1914 following = state.input.charCodeAt(state.position + 1);
1916 if (!is_WS_OR_EOL(following)) {
1923 if (skipSeparationSpace(state, true, -1)) {
1924 if (state.lineIndent <= nodeIndent) {
1926 ch = state.input.charCodeAt(state.position);
1932 composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
1933 _result.push(state.result);
1934 skipSeparationSpace(state, true, -1);
1936 ch = state.input.charCodeAt(state.position);
1938 if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
1939 throwError(state, 'bad indentation of a sequence entry');
1940 } else if (state.lineIndent < nodeIndent) {
1947 state.anchor = _anchor;
1948 state.kind = 'sequence';
1949 state.result = _result;
1955 function readBlockMapping(state, nodeIndent, flowIndent) {
1961 _anchor = state.anchor,
1963 overridableKeys = {},
1967 atExplicitKey = false,
1971 if (state.anchor !== null) {
1972 state.anchorMap[state.anchor] = _result;
1975 ch = state.input.charCodeAt(state.position);
1978 following = state.input.charCodeAt(state.position + 1);
1979 _line = state.line; // Save the current line.
1980 _pos = state.position;
1983 // Explicit notation case. There are two separate blocks:
1984 // first for the key (denoted by "?") and second for the value (denoted by ":")
1986 if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
1988 if (ch === 0x3F/* ? */) {
1989 if (atExplicitKey) {
1990 storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
1991 keyTag = keyNode = valueNode = null;
1995 atExplicitKey = true;
1996 allowCompact = true;
1998 } else if (atExplicitKey) {
1999 // i.e. 0x3A/* : */ === character after the explicit key.
2000 atExplicitKey = false;
2001 allowCompact = true;
2004 throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
2007 state.position += 1;
2011 // Implicit notation case. Flow-style node as the key first, then ":", and the value.
2013 } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
2015 if (state.line === _line) {
2016 ch = state.input.charCodeAt(state.position);
2018 while (is_WHITE_SPACE(ch)) {
2019 ch = state.input.charCodeAt(++state.position);
2022 if (ch === 0x3A/* : */) {
2023 ch = state.input.charCodeAt(++state.position);
2025 if (!is_WS_OR_EOL(ch)) {
2026 throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
2029 if (atExplicitKey) {
2030 storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
2031 keyTag = keyNode = valueNode = null;
2035 atExplicitKey = false;
2036 allowCompact = false;
2038 keyNode = state.result;
2040 } else if (detected) {
2041 throwError(state, 'can not read an implicit mapping pair; a colon is missed');
2045 state.anchor = _anchor;
2046 return true; // Keep the result of `composeNode`.
2049 } else if (detected) {
2050 throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
2054 state.anchor = _anchor;
2055 return true; // Keep the result of `composeNode`.
2059 break; // Reading is done. Go to the epilogue.
2063 // Common reading code for both explicit and implicit notations.
2065 if (state.line === _line || state.lineIndent > nodeIndent) {
2066 if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
2067 if (atExplicitKey) {
2068 keyNode = state.result;
2070 valueNode = state.result;
2074 if (!atExplicitKey) {
2075 storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
2076 keyTag = keyNode = valueNode = null;
2079 skipSeparationSpace(state, true, -1);
2080 ch = state.input.charCodeAt(state.position);
2083 if (state.lineIndent > nodeIndent && (ch !== 0)) {
2084 throwError(state, 'bad indentation of a mapping entry');
2085 } else if (state.lineIndent < nodeIndent) {
2094 // Special case: last mapping's node contains only the key in explicit notation.
2095 if (atExplicitKey) {
2096 storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
2099 // Expose the resulting mapping.
2102 state.anchor = _anchor;
2103 state.kind = 'mapping';
2104 state.result = _result;
2110 function readTagProperty(state) {
2118 ch = state.input.charCodeAt(state.position);
2120 if (ch !== 0x21/* ! */) return false;
2122 if (state.tag !== null) {
2123 throwError(state, 'duplication of a tag property');
2126 ch = state.input.charCodeAt(++state.position);
2128 if (ch === 0x3C/* < */) {
2130 ch = state.input.charCodeAt(++state.position);
2132 } else if (ch === 0x21/* ! */) {
2135 ch = state.input.charCodeAt(++state.position);
2141 _position = state.position;
2144 do { ch = state.input.charCodeAt(++state.position); }
2145 while (ch !== 0 && ch !== 0x3E/* > */);
2147 if (state.position < state.length) {
2148 tagName = state.input.slice(_position, state.position);
2149 ch = state.input.charCodeAt(++state.position);
2151 throwError(state, 'unexpected end of the stream within a verbatim tag');
2154 while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2156 if (ch === 0x21/* ! */) {
2158 tagHandle = state.input.slice(_position - 1, state.position + 1);
2160 if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
2161 throwError(state, 'named tag handle cannot contain such characters');
2165 _position = state.position + 1;
2167 throwError(state, 'tag suffix cannot contain exclamation marks');
2171 ch = state.input.charCodeAt(++state.position);
2174 tagName = state.input.slice(_position, state.position);
2176 if (PATTERN_FLOW_INDICATORS.test(tagName)) {
2177 throwError(state, 'tag suffix cannot contain flow indicator characters');
2181 if (tagName && !PATTERN_TAG_URI.test(tagName)) {
2182 throwError(state, 'tag name cannot contain such characters: ' + tagName);
2186 state.tag = tagName;
2188 } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
2189 state.tag = state.tagMap[tagHandle] + tagName;
2191 } else if (tagHandle === '!') {
2192 state.tag = '!' + tagName;
2194 } else if (tagHandle === '!!') {
2195 state.tag = 'tag:yaml.org,2002:' + tagName;
2198 throwError(state, 'undeclared tag handle "' + tagHandle + '"');
2204 function readAnchorProperty(state) {
2208 ch = state.input.charCodeAt(state.position);
2210 if (ch !== 0x26/* & */) return false;
2212 if (state.anchor !== null) {
2213 throwError(state, 'duplication of an anchor property');
2216 ch = state.input.charCodeAt(++state.position);
2217 _position = state.position;
2219 while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
2220 ch = state.input.charCodeAt(++state.position);
2223 if (state.position === _position) {
2224 throwError(state, 'name of an anchor node must contain at least one character');
2227 state.anchor = state.input.slice(_position, state.position);
2231 function readAlias(state) {
2232 var _position, alias,
2235 ch = state.input.charCodeAt(state.position);
2237 if (ch !== 0x2A/* * */) return false;
2239 ch = state.input.charCodeAt(++state.position);
2240 _position = state.position;
2242 while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
2243 ch = state.input.charCodeAt(++state.position);
2246 if (state.position === _position) {
2247 throwError(state, 'name of an alias node must contain at least one character');
2250 alias = state.input.slice(_position, state.position);
2252 if (!state.anchorMap.hasOwnProperty(alias)) {
2253 throwError(state, 'unidentified alias "' + alias + '"');
2256 state.result = state.anchorMap[alias];
2257 skipSeparationSpace(state, true, -1);
2261 function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
2262 var allowBlockStyles,
2264 allowBlockCollections,
2265 indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
2274 if (state.listener !== null) {
2275 state.listener('open', state);
2279 state.anchor = null;
2281 state.result = null;
2283 allowBlockStyles = allowBlockScalars = allowBlockCollections =
2284 CONTEXT_BLOCK_OUT === nodeContext ||
2285 CONTEXT_BLOCK_IN === nodeContext;
2288 if (skipSeparationSpace(state, true, -1)) {
2291 if (state.lineIndent > parentIndent) {
2293 } else if (state.lineIndent === parentIndent) {
2295 } else if (state.lineIndent < parentIndent) {
2301 if (indentStatus === 1) {
2302 while (readTagProperty(state) || readAnchorProperty(state)) {
2303 if (skipSeparationSpace(state, true, -1)) {
2305 allowBlockCollections = allowBlockStyles;
2307 if (state.lineIndent > parentIndent) {
2309 } else if (state.lineIndent === parentIndent) {
2311 } else if (state.lineIndent < parentIndent) {
2315 allowBlockCollections = false;
2320 if (allowBlockCollections) {
2321 allowBlockCollections = atNewLine || allowCompact;
2324 if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
2325 if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
2326 flowIndent = parentIndent;
2328 flowIndent = parentIndent + 1;
2331 blockIndent = state.position - state.lineStart;
2333 if (indentStatus === 1) {
2334 if (allowBlockCollections &&
2335 (readBlockSequence(state, blockIndent) ||
2336 readBlockMapping(state, blockIndent, flowIndent)) ||
2337 readFlowCollection(state, flowIndent)) {
2340 if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
2341 readSingleQuotedScalar(state, flowIndent) ||
2342 readDoubleQuotedScalar(state, flowIndent)) {
2345 } else if (readAlias(state)) {
2348 if (state.tag !== null || state.anchor !== null) {
2349 throwError(state, 'alias node should not have any properties');
2352 } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
2355 if (state.tag === null) {
2360 if (state.anchor !== null) {
2361 state.anchorMap[state.anchor] = state.result;
2364 } else if (indentStatus === 0) {
2365 // Special case: block sequences are allowed to have same indentation level as the parent.
2366 // http://www.yaml.org/spec/1.2/spec.html#id2799784
2367 hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
2371 if (state.tag !== null && state.tag !== '!') {
2372 if (state.tag === '?') {
2373 for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
2374 type = state.implicitTypes[typeIndex];
2376 // Implicit resolving is not allowed for non-scalar types, and '?'
2377 // non-specific tag is only assigned to plain scalars. So, it isn't
2378 // needed to check for 'kind' conformity.
2380 if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
2381 state.result = type.construct(state.result);
2382 state.tag = type.tag;
2383 if (state.anchor !== null) {
2384 state.anchorMap[state.anchor] = state.result;
2389 } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
2390 type = state.typeMap[state.kind || 'fallback'][state.tag];
2392 if (state.result !== null && type.kind !== state.kind) {
2393 throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
2396 if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
2397 throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
2399 state.result = type.construct(state.result);
2400 if (state.anchor !== null) {
2401 state.anchorMap[state.anchor] = state.result;
2405 throwError(state, 'unknown tag !<' + state.tag + '>');
2409 if (state.listener !== null) {
2410 state.listener('close', state);
2412 return state.tag !== null || state.anchor !== null || hasContent;
2415 function readDocument(state) {
2416 var documentStart = state.position,
2420 hasDirectives = false,
2423 state.version = null;
2424 state.checkLineBreaks = state.legacy;
2426 state.anchorMap = {};
2428 while ((ch = state.input.charCodeAt(state.position)) !== 0) {
2429 skipSeparationSpace(state, true, -1);
2431 ch = state.input.charCodeAt(state.position);
2433 if (state.lineIndent > 0 || ch !== 0x25/* % */) {
2437 hasDirectives = true;
2438 ch = state.input.charCodeAt(++state.position);
2439 _position = state.position;
2441 while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2442 ch = state.input.charCodeAt(++state.position);
2445 directiveName = state.input.slice(_position, state.position);
2448 if (directiveName.length < 1) {
2449 throwError(state, 'directive name must not be less than one character in length');
2453 while (is_WHITE_SPACE(ch)) {
2454 ch = state.input.charCodeAt(++state.position);
2457 if (ch === 0x23/* # */) {
2458 do { ch = state.input.charCodeAt(++state.position); }
2459 while (ch !== 0 && !is_EOL(ch));
2463 if (is_EOL(ch)) break;
2465 _position = state.position;
2467 while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2468 ch = state.input.charCodeAt(++state.position);
2471 directiveArgs.push(state.input.slice(_position, state.position));
2474 if (ch !== 0) readLineBreak(state);
2476 if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
2477 directiveHandlers[directiveName](state, directiveName, directiveArgs);
2479 throwWarning(state, 'unknown document directive "' + directiveName + '"');
2483 skipSeparationSpace(state, true, -1);
2485 if (state.lineIndent === 0 &&
2486 state.input.charCodeAt(state.position) === 0x2D/* - */ &&
2487 state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
2488 state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
2489 state.position += 3;
2490 skipSeparationSpace(state, true, -1);
2492 } else if (hasDirectives) {
2493 throwError(state, 'directives end mark is expected');
2496 composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2497 skipSeparationSpace(state, true, -1);
2499 if (state.checkLineBreaks &&
2500 PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
2501 throwWarning(state, 'non-ASCII line breaks are interpreted as content');
2504 state.documents.push(state.result);
2506 if (state.position === state.lineStart && testDocumentSeparator(state)) {
2508 if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
2509 state.position += 3;
2510 skipSeparationSpace(state, true, -1);
2515 if (state.position < (state.length - 1)) {
2516 throwError(state, 'end of the stream or a document separator is expected');
2523 function loadDocuments(input, options) {
2524 input = String(input);
2525 options = options || {};
2527 if (input.length !== 0) {
2529 // Add tailing `\n` if not exists
2530 if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
2531 input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
2536 if (input.charCodeAt(0) === 0xFEFF) {
2537 input = input.slice(1);
2541 var state = new State(input, options);
2543 // Use 0 as string terminator. That significantly simplifies bounds check.
2544 state.input += '\0';
2546 while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
2547 state.lineIndent += 1;
2548 state.position += 1;
2551 while (state.position < (state.length - 1)) {
2552 readDocument(state);
2555 return state.documents;
2559 function loadAll(input, iterator, options) {
2560 var documents = loadDocuments(input, options), index, length;
2562 if (typeof iterator !== 'function') {
2566 for (index = 0, length = documents.length; index < length; index += 1) {
2567 iterator(documents[index]);
2572 function load(input, options) {
2573 var documents = loadDocuments(input, options);
2575 if (documents.length === 0) {
2576 /*eslint-disable no-undefined*/
2578 } else if (documents.length === 1) {
2579 return documents[0];
2581 throw new YAMLException('expected a single document in the stream, but found more');
2585 function safeLoadAll(input, output, options) {
2586 if (typeof output === 'function') {
2587 loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2589 return loadAll(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2594 function safeLoad(input, options) {
2595 return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2599 module.exports.loadAll = loadAll;
2600 module.exports.load = load;
2601 module.exports.safeLoadAll = safeLoadAll;
2602 module.exports.safeLoad = safeLoad;
2604 },{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(require,module,exports){
2608 var common = require('./common');
2611 function Mark(name, buffer, position, line, column) {
2613 this.buffer = buffer;
2614 this.position = position;
2616 this.column = column;
2620 Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
2621 var head, start, tail, end, snippet;
2623 if (!this.buffer) return null;
2625 indent = indent || 4;
2626 maxLength = maxLength || 75;
2629 start = this.position;
2631 while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
2633 if (this.position - start > (maxLength / 2 - 1)) {
2641 end = this.position;
2643 while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
2645 if (end - this.position > (maxLength / 2 - 1)) {
2652 snippet = this.buffer.slice(start, end);
2654 return common.repeat(' ', indent) + head + snippet + tail + '\n' +
2655 common.repeat(' ', indent + this.position - start + head.length) + '^';
2659 Mark.prototype.toString = function toString(compact) {
2660 var snippet, where = '';
2663 where += 'in "' + this.name + '" ';
2666 where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
2669 snippet = this.getSnippet();
2672 where += ':\n' + snippet;
2680 module.exports = Mark;
2682 },{"./common":2}],7:[function(require,module,exports){
2685 /*eslint-disable max-len*/
2687 var common = require('./common');
2688 var YAMLException = require('./exception');
2689 var Type = require('./type');
2692 function compileList(schema, name, result) {
2695 schema.include.forEach(function (includedSchema) {
2696 result = compileList(includedSchema, name, result);
2699 schema[name].forEach(function (currentType) {
2700 result.forEach(function (previousType, previousIndex) {
2701 if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
2702 exclude.push(previousIndex);
2706 result.push(currentType);
2709 return result.filter(function (type, index) {
2710 return exclude.indexOf(index) === -1;
2715 function compileMap(/* lists... */) {
2723 function collectType(type) {
2724 result[type.kind][type.tag] = result['fallback'][type.tag] = type;
2727 for (index = 0, length = arguments.length; index < length; index += 1) {
2728 arguments[index].forEach(collectType);
2734 function Schema(definition) {
2735 this.include = definition.include || [];
2736 this.implicit = definition.implicit || [];
2737 this.explicit = definition.explicit || [];
2739 this.implicit.forEach(function (type) {
2740 if (type.loadKind && type.loadKind !== 'scalar') {
2741 throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
2745 this.compiledImplicit = compileList(this, 'implicit', []);
2746 this.compiledExplicit = compileList(this, 'explicit', []);
2747 this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
2751 Schema.DEFAULT = null;
2754 Schema.create = function createSchema() {
2757 switch (arguments.length) {
2759 schemas = Schema.DEFAULT;
2760 types = arguments[0];
2764 schemas = arguments[0];
2765 types = arguments[1];
2769 throw new YAMLException('Wrong number of arguments for Schema.create function');
2772 schemas = common.toArray(schemas);
2773 types = common.toArray(types);
2775 if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
2776 throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
2779 if (!types.every(function (type) { return type instanceof Type; })) {
2780 throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
2790 module.exports = Schema;
2792 },{"./common":2,"./exception":4,"./type":13}],8:[function(require,module,exports){
2793 // Standard YAML's Core schema.
2794 // http://www.yaml.org/spec/1.2/spec.html#id2804923
2796 // NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
2797 // So, Core schema has no distinctions from JSON schema is JS-YAML.
2803 var Schema = require('../schema');
2806 module.exports = new Schema({
2812 },{"../schema":7,"./json":12}],9:[function(require,module,exports){
2813 // JS-YAML's default schema for `load` function.
2814 // It is not described in the YAML specification.
2816 // This schema is based on JS-YAML's default safe schema and includes
2817 // JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
2819 // Also this schema is used as default base schema at `Schema.create` function.
2825 var Schema = require('../schema');
2828 module.exports = Schema.DEFAULT = new Schema({
2830 require('./default_safe')
2833 require('../type/js/undefined'),
2834 require('../type/js/regexp'),
2835 require('../type/js/function')
2839 },{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(require,module,exports){
2840 // JS-YAML's default schema for `safeLoad` function.
2841 // It is not described in the YAML specification.
2843 // This schema is based on standard YAML's Core schema and includes most of
2844 // extra types described at YAML tag repository. (http://yaml.org/type/)
2850 var Schema = require('../schema');
2853 module.exports = new Schema({
2858 require('../type/timestamp'),
2859 require('../type/merge')
2862 require('../type/binary'),
2863 require('../type/omap'),
2864 require('../type/pairs'),
2865 require('../type/set')
2869 },{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(require,module,exports){
2870 // Standard YAML's Failsafe schema.
2871 // http://www.yaml.org/spec/1.2/spec.html#id2802346
2877 var Schema = require('../schema');
2880 module.exports = new Schema({
2882 require('../type/str'),
2883 require('../type/seq'),
2884 require('../type/map')
2888 },{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(require,module,exports){
2889 // Standard YAML's JSON schema.
2890 // http://www.yaml.org/spec/1.2/spec.html#id2803231
2892 // NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
2893 // So, this schema is not such strict as defined in the YAML specification.
2894 // It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
2900 var Schema = require('../schema');
2903 module.exports = new Schema({
2905 require('./failsafe')
2908 require('../type/null'),
2909 require('../type/bool'),
2910 require('../type/int'),
2911 require('../type/float')
2915 },{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(require,module,exports){
2918 var YAMLException = require('./exception');
2920 var TYPE_CONSTRUCTOR_OPTIONS = [
2931 var YAML_NODE_KINDS = [
2937 function compileStyleAliases(map) {
2941 Object.keys(map).forEach(function (style) {
2942 map[style].forEach(function (alias) {
2943 result[String(alias)] = style;
2951 function Type(tag, options) {
2952 options = options || {};
2954 Object.keys(options).forEach(function (name) {
2955 if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
2956 throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
2960 // TODO: Add tag format check.
2962 this.kind = options['kind'] || null;
2963 this.resolve = options['resolve'] || function () { return true; };
2964 this.construct = options['construct'] || function (data) { return data; };
2965 this.instanceOf = options['instanceOf'] || null;
2966 this.predicate = options['predicate'] || null;
2967 this.represent = options['represent'] || null;
2968 this.defaultStyle = options['defaultStyle'] || null;
2969 this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
2971 if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
2972 throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
2976 module.exports = Type;
2978 },{"./exception":4}],14:[function(require,module,exports){
2981 /*eslint-disable no-bitwise*/
2986 // A trick for browserified version, to not include `Buffer` shim
2987 var _require = require;
2988 NodeBuffer = _require('buffer').Buffer;
2991 var Type = require('../type');
2994 // [ 64, 65, 66 ] -> [ padding, CR, LF ]
2995 var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
2998 function resolveYamlBinary(data) {
2999 if (data === null) return false;
3001 var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
3003 // Convert one by one.
3004 for (idx = 0; idx < max; idx++) {
3005 code = map.indexOf(data.charAt(idx));
3008 if (code > 64) continue;
3010 // Fail on illegal characters
3011 if (code < 0) return false;
3016 // If there are any bits left, source was corrupted
3017 return (bitlen % 8) === 0;
3020 function constructYamlBinary(data) {
3022 input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
3028 // Collect by 6*4 bits (3 bytes)
3030 for (idx = 0; idx < max; idx++) {
3031 if ((idx % 4 === 0) && idx) {
3032 result.push((bits >> 16) & 0xFF);
3033 result.push((bits >> 8) & 0xFF);
3034 result.push(bits & 0xFF);
3037 bits = (bits << 6) | map.indexOf(input.charAt(idx));
3042 tailbits = (max % 4) * 6;
3044 if (tailbits === 0) {
3045 result.push((bits >> 16) & 0xFF);
3046 result.push((bits >> 8) & 0xFF);
3047 result.push(bits & 0xFF);
3048 } else if (tailbits === 18) {
3049 result.push((bits >> 10) & 0xFF);
3050 result.push((bits >> 2) & 0xFF);
3051 } else if (tailbits === 12) {
3052 result.push((bits >> 4) & 0xFF);
3055 // Wrap into Buffer for NodeJS and leave Array for browser
3057 // Support node 6.+ Buffer API when available
3058 return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
3064 function representYamlBinary(object /*, style*/) {
3065 var result = '', bits = 0, idx, tail,
3066 max = object.length,
3069 // Convert every three bytes to 4 ASCII characters.
3071 for (idx = 0; idx < max; idx++) {
3072 if ((idx % 3 === 0) && idx) {
3073 result += map[(bits >> 18) & 0x3F];
3074 result += map[(bits >> 12) & 0x3F];
3075 result += map[(bits >> 6) & 0x3F];
3076 result += map[bits & 0x3F];
3079 bits = (bits << 8) + object[idx];
3087 result += map[(bits >> 18) & 0x3F];
3088 result += map[(bits >> 12) & 0x3F];
3089 result += map[(bits >> 6) & 0x3F];
3090 result += map[bits & 0x3F];
3091 } else if (tail === 2) {
3092 result += map[(bits >> 10) & 0x3F];
3093 result += map[(bits >> 4) & 0x3F];
3094 result += map[(bits << 2) & 0x3F];
3096 } else if (tail === 1) {
3097 result += map[(bits >> 2) & 0x3F];
3098 result += map[(bits << 4) & 0x3F];
3106 function isBinary(object) {
3107 return NodeBuffer && NodeBuffer.isBuffer(object);
3110 module.exports = new Type('tag:yaml.org,2002:binary', {
3112 resolve: resolveYamlBinary,
3113 construct: constructYamlBinary,
3114 predicate: isBinary,
3115 represent: representYamlBinary
3118 },{"../type":13}],15:[function(require,module,exports){
3121 var Type = require('../type');
3123 function resolveYamlBoolean(data) {
3124 if (data === null) return false;
3126 var max = data.length;
3128 return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
3129 (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
3132 function constructYamlBoolean(data) {
3133 return data === 'true' ||
3138 function isBoolean(object) {
3139 return Object.prototype.toString.call(object) === '[object Boolean]';
3142 module.exports = new Type('tag:yaml.org,2002:bool', {
3144 resolve: resolveYamlBoolean,
3145 construct: constructYamlBoolean,
3146 predicate: isBoolean,
3148 lowercase: function (object) { return object ? 'true' : 'false'; },
3149 uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
3150 camelcase: function (object) { return object ? 'True' : 'False'; }
3152 defaultStyle: 'lowercase'
3155 },{"../type":13}],16:[function(require,module,exports){
3158 var common = require('../common');
3159 var Type = require('../type');
3161 var YAML_FLOAT_PATTERN = new RegExp(
3162 // 2.5e4, 2.5 and integers
3163 '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
3165 // special case, seems not from spec
3166 '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
3168 '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
3170 '|[-+]?\\.(?:inf|Inf|INF)' +
3172 '|\\.(?:nan|NaN|NAN))$');
3174 function resolveYamlFloat(data) {
3175 if (data === null) return false;
3177 if (!YAML_FLOAT_PATTERN.test(data) ||
3178 // Quick hack to not allow integers end with `_`
3179 // Probably should update regexp & check speed
3180 data[data.length - 1] === '_') {
3187 function constructYamlFloat(data) {
3188 var value, sign, base, digits;
3190 value = data.replace(/_/g, '').toLowerCase();
3191 sign = value[0] === '-' ? -1 : 1;
3194 if ('+-'.indexOf(value[0]) >= 0) {
3195 value = value.slice(1);
3198 if (value === '.inf') {
3199 return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
3201 } else if (value === '.nan') {
3204 } else if (value.indexOf(':') >= 0) {
3205 value.split(':').forEach(function (v) {
3206 digits.unshift(parseFloat(v, 10));
3212 digits.forEach(function (d) {
3217 return sign * value;
3220 return sign * parseFloat(value, 10);
3224 var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
3226 function representYamlFloat(object, style) {
3229 if (isNaN(object)) {
3231 case 'lowercase': return '.nan';
3232 case 'uppercase': return '.NAN';
3233 case 'camelcase': return '.NaN';
3235 } else if (Number.POSITIVE_INFINITY === object) {
3237 case 'lowercase': return '.inf';
3238 case 'uppercase': return '.INF';
3239 case 'camelcase': return '.Inf';
3241 } else if (Number.NEGATIVE_INFINITY === object) {
3243 case 'lowercase': return '-.inf';
3244 case 'uppercase': return '-.INF';
3245 case 'camelcase': return '-.Inf';
3247 } else if (common.isNegativeZero(object)) {
3251 res = object.toString(10);
3253 // JS stringifier can build scientific format without dots: 5e-100,
3254 // while YAML requres dot: 5.e-100. Fix it with simple hack
3256 return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
3259 function isFloat(object) {
3260 return (Object.prototype.toString.call(object) === '[object Number]') &&
3261 (object % 1 !== 0 || common.isNegativeZero(object));
3264 module.exports = new Type('tag:yaml.org,2002:float', {
3266 resolve: resolveYamlFloat,
3267 construct: constructYamlFloat,
3269 represent: representYamlFloat,
3270 defaultStyle: 'lowercase'
3273 },{"../common":2,"../type":13}],17:[function(require,module,exports){
3276 var common = require('../common');
3277 var Type = require('../type');
3279 function isHexCode(c) {
3280 return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
3281 ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
3282 ((0x61/* a */ <= c) && (c <= 0x66/* f */));
3285 function isOctCode(c) {
3286 return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
3289 function isDecCode(c) {
3290 return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
3293 function resolveYamlInteger(data) {
3294 if (data === null) return false;
3296 var max = data.length,
3301 if (!max) return false;
3306 if (ch === '-' || ch === '+') {
3312 if (index + 1 === max) return true;
3315 // base 2, base 8, base 16
3321 for (; index < max; index++) {
3323 if (ch === '_') continue;
3324 if (ch !== '0' && ch !== '1') return false;
3327 return hasDigits && ch !== '_';
3335 for (; index < max; index++) {
3337 if (ch === '_') continue;
3338 if (!isHexCode(data.charCodeAt(index))) return false;
3341 return hasDigits && ch !== '_';
3345 for (; index < max; index++) {
3347 if (ch === '_') continue;
3348 if (!isOctCode(data.charCodeAt(index))) return false;
3351 return hasDigits && ch !== '_';
3354 // base 10 (except 0) or base 60
3356 // value should not start with `_`;
3357 if (ch === '_') return false;
3359 for (; index < max; index++) {
3361 if (ch === '_') continue;
3362 if (ch === ':') break;
3363 if (!isDecCode(data.charCodeAt(index))) {
3369 // Should have digits and should not end with `_`
3370 if (!hasDigits || ch === '_') return false;
3372 // if !base60 - done;
3373 if (ch !== ':') return true;
3375 // base60 almost not used, no needs to optimize
3376 return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
3379 function constructYamlInteger(data) {
3380 var value = data, sign = 1, ch, base, digits = [];
3382 if (value.indexOf('_') !== -1) {
3383 value = value.replace(/_/g, '');
3388 if (ch === '-' || ch === '+') {
3389 if (ch === '-') sign = -1;
3390 value = value.slice(1);
3394 if (value === '0') return 0;
3397 if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
3398 if (value[1] === 'x') return sign * parseInt(value, 16);
3399 return sign * parseInt(value, 8);
3402 if (value.indexOf(':') !== -1) {
3403 value.split(':').forEach(function (v) {
3404 digits.unshift(parseInt(v, 10));
3410 digits.forEach(function (d) {
3411 value += (d * base);
3415 return sign * value;
3419 return sign * parseInt(value, 10);
3422 function isInteger(object) {
3423 return (Object.prototype.toString.call(object)) === '[object Number]' &&
3424 (object % 1 === 0 && !common.isNegativeZero(object));
3427 module.exports = new Type('tag:yaml.org,2002:int', {
3429 resolve: resolveYamlInteger,
3430 construct: constructYamlInteger,
3431 predicate: isInteger,
3433 binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
3434 octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); },
3435 decimal: function (obj) { return obj.toString(10); },
3436 /* eslint-disable max-len */
3437 hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
3439 defaultStyle: 'decimal',
3441 binary: [ 2, 'bin' ],
3442 octal: [ 8, 'oct' ],
3443 decimal: [ 10, 'dec' ],
3444 hexadecimal: [ 16, 'hex' ]
3448 },{"../common":2,"../type":13}],18:[function(require,module,exports){
3453 // Browserified version does not have esprima
3455 // 1. For node.js just require module as deps
3456 // 2. For browser try to require mudule via external AMD system.
3457 // If not found - try to fallback to window.esprima. If not
3458 // found too - then fail to parse.
3461 // workaround to exclude package from browserify list.
3462 var _require = require;
3463 esprima = _require('esprima');
3466 if (typeof window !== 'undefined') esprima = window.esprima;
3469 var Type = require('../../type');
3471 function resolveJavascriptFunction(data) {
3472 if (data === null) return false;
3475 var source = '(' + data + ')',
3476 ast = esprima.parse(source, { range: true });
3478 if (ast.type !== 'Program' ||
3479 ast.body.length !== 1 ||
3480 ast.body[0].type !== 'ExpressionStatement' ||
3481 (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
3482 ast.body[0].expression.type !== 'FunctionExpression')) {
3492 function constructJavascriptFunction(data) {
3493 /*jslint evil:true*/
3495 var source = '(' + data + ')',
3496 ast = esprima.parse(source, { range: true }),
3500 if (ast.type !== 'Program' ||
3501 ast.body.length !== 1 ||
3502 ast.body[0].type !== 'ExpressionStatement' ||
3503 (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
3504 ast.body[0].expression.type !== 'FunctionExpression')) {
3505 throw new Error('Failed to resolve function');
3508 ast.body[0].expression.params.forEach(function (param) {
3509 params.push(param.name);
3512 body = ast.body[0].expression.body.range;
3514 // Esprima's ranges include the first '{' and the last '}' characters on
3515 // function expressions. So cut them out.
3516 if (ast.body[0].expression.body.type === 'BlockStatement') {
3517 /*eslint-disable no-new-func*/
3518 return new Function(params, source.slice(body[0] + 1, body[1] - 1));
3520 // ES6 arrow functions can omit the BlockStatement. In that case, just return
3522 /*eslint-disable no-new-func*/
3523 return new Function(params, 'return ' + source.slice(body[0], body[1]));
3526 function representJavascriptFunction(object /*, style*/) {
3527 return object.toString();
3530 function isFunction(object) {
3531 return Object.prototype.toString.call(object) === '[object Function]';
3534 module.exports = new Type('tag:yaml.org,2002:js/function', {
3536 resolve: resolveJavascriptFunction,
3537 construct: constructJavascriptFunction,
3538 predicate: isFunction,
3539 represent: representJavascriptFunction
3542 },{"../../type":13}],19:[function(require,module,exports){
3545 var Type = require('../../type');
3547 function resolveJavascriptRegExp(data) {
3548 if (data === null) return false;
3549 if (data.length === 0) return false;
3552 tail = /\/([gim]*)$/.exec(data),
3555 // if regexp starts with '/' it can have modifiers and must be properly closed
3556 // `/foo/gim` - modifiers tail can be maximum 3 chars
3557 if (regexp[0] === '/') {
3558 if (tail) modifiers = tail[1];
3560 if (modifiers.length > 3) return false;
3561 // if expression starts with /, is should be properly terminated
3562 if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
3568 function constructJavascriptRegExp(data) {
3570 tail = /\/([gim]*)$/.exec(data),
3573 // `/foo/gim` - tail can be maximum 4 chars
3574 if (regexp[0] === '/') {
3575 if (tail) modifiers = tail[1];
3576 regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
3579 return new RegExp(regexp, modifiers);
3582 function representJavascriptRegExp(object /*, style*/) {
3583 var result = '/' + object.source + '/';
3585 if (object.global) result += 'g';
3586 if (object.multiline) result += 'm';
3587 if (object.ignoreCase) result += 'i';
3592 function isRegExp(object) {
3593 return Object.prototype.toString.call(object) === '[object RegExp]';
3596 module.exports = new Type('tag:yaml.org,2002:js/regexp', {
3598 resolve: resolveJavascriptRegExp,
3599 construct: constructJavascriptRegExp,
3600 predicate: isRegExp,
3601 represent: representJavascriptRegExp
3604 },{"../../type":13}],20:[function(require,module,exports){
3607 var Type = require('../../type');
3609 function resolveJavascriptUndefined() {
3613 function constructJavascriptUndefined() {
3614 /*eslint-disable no-undefined*/
3618 function representJavascriptUndefined() {
3622 function isUndefined(object) {
3623 return typeof object === 'undefined';
3626 module.exports = new Type('tag:yaml.org,2002:js/undefined', {
3628 resolve: resolveJavascriptUndefined,
3629 construct: constructJavascriptUndefined,
3630 predicate: isUndefined,
3631 represent: representJavascriptUndefined
3634 },{"../../type":13}],21:[function(require,module,exports){
3637 var Type = require('../type');
3639 module.exports = new Type('tag:yaml.org,2002:map', {
3641 construct: function (data) { return data !== null ? data : {}; }
3644 },{"../type":13}],22:[function(require,module,exports){
3647 var Type = require('../type');
3649 function resolveYamlMerge(data) {
3650 return data === '<<' || data === null;
3653 module.exports = new Type('tag:yaml.org,2002:merge', {
3655 resolve: resolveYamlMerge
3658 },{"../type":13}],23:[function(require,module,exports){
3661 var Type = require('../type');
3663 function resolveYamlNull(data) {
3664 if (data === null) return true;
3666 var max = data.length;
3668 return (max === 1 && data === '~') ||
3669 (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
3672 function constructYamlNull() {
3676 function isNull(object) {
3677 return object === null;
3680 module.exports = new Type('tag:yaml.org,2002:null', {
3682 resolve: resolveYamlNull,
3683 construct: constructYamlNull,
3686 canonical: function () { return '~'; },
3687 lowercase: function () { return 'null'; },
3688 uppercase: function () { return 'NULL'; },
3689 camelcase: function () { return 'Null'; }
3691 defaultStyle: 'lowercase'
3694 },{"../type":13}],24:[function(require,module,exports){
3697 var Type = require('../type');
3699 var _hasOwnProperty = Object.prototype.hasOwnProperty;
3700 var _toString = Object.prototype.toString;
3702 function resolveYamlOmap(data) {
3703 if (data === null) return true;
3705 var objectKeys = [], index, length, pair, pairKey, pairHasKey,
3708 for (index = 0, length = object.length; index < length; index += 1) {
3709 pair = object[index];
3712 if (_toString.call(pair) !== '[object Object]') return false;
3714 for (pairKey in pair) {
3715 if (_hasOwnProperty.call(pair, pairKey)) {
3716 if (!pairHasKey) pairHasKey = true;
3721 if (!pairHasKey) return false;
3723 if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
3730 function constructYamlOmap(data) {
3731 return data !== null ? data : [];
3734 module.exports = new Type('tag:yaml.org,2002:omap', {
3736 resolve: resolveYamlOmap,
3737 construct: constructYamlOmap
3740 },{"../type":13}],25:[function(require,module,exports){
3743 var Type = require('../type');
3745 var _toString = Object.prototype.toString;
3747 function resolveYamlPairs(data) {
3748 if (data === null) return true;
3750 var index, length, pair, keys, result,
3753 result = new Array(object.length);
3755 for (index = 0, length = object.length; index < length; index += 1) {
3756 pair = object[index];
3758 if (_toString.call(pair) !== '[object Object]') return false;
3760 keys = Object.keys(pair);
3762 if (keys.length !== 1) return false;
3764 result[index] = [ keys[0], pair[keys[0]] ];
3770 function constructYamlPairs(data) {
3771 if (data === null) return [];
3773 var index, length, pair, keys, result,
3776 result = new Array(object.length);
3778 for (index = 0, length = object.length; index < length; index += 1) {
3779 pair = object[index];
3781 keys = Object.keys(pair);
3783 result[index] = [ keys[0], pair[keys[0]] ];
3789 module.exports = new Type('tag:yaml.org,2002:pairs', {
3791 resolve: resolveYamlPairs,
3792 construct: constructYamlPairs
3795 },{"../type":13}],26:[function(require,module,exports){
3798 var Type = require('../type');
3800 module.exports = new Type('tag:yaml.org,2002:seq', {
3802 construct: function (data) { return data !== null ? data : []; }
3805 },{"../type":13}],27:[function(require,module,exports){
3808 var Type = require('../type');
3810 var _hasOwnProperty = Object.prototype.hasOwnProperty;
3812 function resolveYamlSet(data) {
3813 if (data === null) return true;
3815 var key, object = data;
3817 for (key in object) {
3818 if (_hasOwnProperty.call(object, key)) {
3819 if (object[key] !== null) return false;
3826 function constructYamlSet(data) {
3827 return data !== null ? data : {};
3830 module.exports = new Type('tag:yaml.org,2002:set', {
3832 resolve: resolveYamlSet,
3833 construct: constructYamlSet
3836 },{"../type":13}],28:[function(require,module,exports){
3839 var Type = require('../type');
3841 module.exports = new Type('tag:yaml.org,2002:str', {
3843 construct: function (data) { return data !== null ? data : ''; }
3846 },{"../type":13}],29:[function(require,module,exports){
3849 var Type = require('../type');
3851 var YAML_DATE_REGEXP = new RegExp(
3852 '^([0-9][0-9][0-9][0-9])' + // [1] year
3853 '-([0-9][0-9])' + // [2] month
3854 '-([0-9][0-9])$'); // [3] day
3856 var YAML_TIMESTAMP_REGEXP = new RegExp(
3857 '^([0-9][0-9][0-9][0-9])' + // [1] year
3858 '-([0-9][0-9]?)' + // [2] month
3859 '-([0-9][0-9]?)' + // [3] day
3860 '(?:[Tt]|[ \\t]+)' + // ...
3861 '([0-9][0-9]?)' + // [4] hour
3862 ':([0-9][0-9])' + // [5] minute
3863 ':([0-9][0-9])' + // [6] second
3864 '(?:\\.([0-9]*))?' + // [7] fraction
3865 '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
3866 '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
3868 function resolveYamlTimestamp(data) {
3869 if (data === null) return false;
3870 if (YAML_DATE_REGEXP.exec(data) !== null) return true;
3871 if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
3875 function constructYamlTimestamp(data) {
3876 var match, year, month, day, hour, minute, second, fraction = 0,
3877 delta = null, tz_hour, tz_minute, date;
3879 match = YAML_DATE_REGEXP.exec(data);
3880 if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
3882 if (match === null) throw new Error('Date resolve error');
3884 // match: [1] year [2] month [3] day
3887 month = +(match[2]) - 1; // JS month starts with 0
3890 if (!match[4]) { // no hour
3891 return new Date(Date.UTC(year, month, day));
3894 // match: [4] hour [5] minute [6] second [7] fraction
3897 minute = +(match[5]);
3898 second = +(match[6]);
3901 fraction = match[7].slice(0, 3);
3902 while (fraction.length < 3) { // milli-seconds
3905 fraction = +fraction;
3908 // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
3911 tz_hour = +(match[10]);
3912 tz_minute = +(match[11] || 0);
3913 delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
3914 if (match[9] === '-') delta = -delta;
3917 date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
3919 if (delta) date.setTime(date.getTime() - delta);
3924 function representYamlTimestamp(object /*, style*/) {
3925 return object.toISOString();
3928 module.exports = new Type('tag:yaml.org,2002:timestamp', {
3930 resolve: resolveYamlTimestamp,
3931 construct: constructYamlTimestamp,
3933 represent: representYamlTimestamp
3936 },{"../type":13}],"/":[function(require,module,exports){
3940 var yaml = require('./lib/js-yaml.js');
3943 module.exports = yaml;
3945 },{"./lib/js-yaml.js":1}]},{},[])("/")