foreman_acd 0.9.7 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/lib/foreman_acd/version.rb +1 -1
  3. data/package.json +5 -3
  4. data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +210 -121
  5. data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +79 -91
  6. data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +30 -15
  7. data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +15 -15
  8. data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +96 -63
  9. data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +22 -11
  10. data/webpack/components/ApplicationDefinition/__fixtures__/{applicationDefinitionConfData_1.fixtures.js → applicationDefinitionConfData1.fixtures.js} +77 -105
  11. data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +49 -29
  12. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +4 -4
  13. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionHelper.test.js +16 -0
  14. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +0 -5
  15. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +25 -25
  16. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +9 -1
  17. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +11 -11
  18. data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +30 -25
  19. data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +3 -3
  20. data/webpack/components/ApplicationDefinition/index.js +0 -1
  21. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +91 -105
  22. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +59 -84
  23. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +12 -6
  24. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +21 -27
  25. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +14 -7
  26. data/webpack/components/ApplicationDefinitionImport/__fixtures__/{applicationDefinitionImportConfData_1.fixtures.js → applicationDefinitionImportConfData1.fixtures.js} +32 -40
  27. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +14 -16
  28. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +38 -8
  29. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +0 -2
  30. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +9 -9
  31. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +116 -2
  32. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +3 -3
  33. data/webpack/components/ApplicationInstance/ApplicationInstance.js +344 -193
  34. data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +92 -105
  35. data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +34 -17
  36. data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +4 -7
  37. data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +114 -74
  38. data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +18 -9
  39. data/webpack/components/ApplicationInstance/__fixtures__/{applicationInstanceConfData_1.fixtures.js → applicationInstanceConfData1.fixtures.js} +68 -86
  40. data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +24 -32
  41. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +75 -10
  42. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +0 -8
  43. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +27 -27
  44. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +606 -2
  45. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +12 -12
  46. data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +32 -25
  47. data/webpack/components/ApplicationInstance/components/Service.js +7 -18
  48. data/webpack/components/ApplicationInstance/components/ServiceCounter.js +25 -18
  49. data/webpack/components/ApplicationInstance/index.js +0 -1
  50. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +167 -110
  51. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +20 -25
  52. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +10 -5
  53. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +9 -12
  54. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +12 -6
  55. data/webpack/components/ApplicationInstanceReport/__fixtures__/{applicationInstanceReportData_1.fixtures.js → applicationInstanceReportData1.fixtures.js} +154 -101
  56. data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +3 -10
  57. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +28 -22
  58. data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +5 -7
  59. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +0 -1
  60. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +2 -2
  61. data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +9 -5
  62. data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +1 -3
  63. data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +35 -56
  64. data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +21 -28
  65. data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +6 -3
  66. data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +16 -19
  67. data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -4
  68. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData1.fixtures.js +187 -0
  69. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +13 -24
  70. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +3 -2
  71. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +11 -14
  72. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +5 -5
  73. data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +31 -25
  74. data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +3 -9
  75. data/webpack/components/ParameterSelection/ParameterSelection.js +258 -174
  76. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +110 -100
  77. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +22 -11
  78. data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +13 -11
  79. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +63 -49
  80. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +10 -5
  81. data/webpack/components/ParameterSelection/__fixtures__/{parameterSelectionData_1.fixtures.js → parameterSelectionData1.fixtures.js} +67 -104
  82. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +22 -26
  83. data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +50 -36
  84. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionHelper.test.js +76 -0
  85. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +0 -2
  86. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +23 -25
  87. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +100 -0
  88. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +99 -112
  89. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +18 -19
  90. data/webpack/components/ParameterSelection/index.js +1 -4
  91. data/webpack/components/SyncGitRepo/SyncGitRepo.js +124 -117
  92. data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +64 -74
  93. data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +17 -17
  94. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData1.fixtures.js +7 -0
  95. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +10 -18
  96. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +80 -6
  97. data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +9 -11
  98. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +192 -1
  99. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +4 -4
  100. data/webpack/components/SyncGitRepo/components/FormTextInput.js +26 -21
  101. data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +29 -24
  102. data/webpack/components/SyncGitRepo/index.js +2 -5
  103. data/webpack/components/common/AddTableEntry.js +3 -10
  104. data/webpack/components/common/DeleteTableEntry.js +7 -15
  105. data/webpack/components/common/EditTableEntry.js +7 -7
  106. data/webpack/components/common/ExtSelect.js +12 -8
  107. data/webpack/components/common/ExtTextInput.js +12 -7
  108. data/webpack/components/common/LockTableEntry.js +6 -6
  109. data/webpack/components/common/RailsData.js +6 -16
  110. data/webpack/components/common/__tests__/ExtSelect.test.js +2 -2
  111. data/webpack/components/common/__tests__/RailsData.test.js +0 -2
  112. data/webpack/global_test_setup.js +11 -0
  113. data/webpack/helper.js +10 -21
  114. data/webpack/helper.test.js +17 -29
  115. data/webpack/index.js +25 -7
  116. data/webpack/js-yaml.js +1563 -1135
  117. data/webpack/reducer.js +52 -27
  118. metadata +13 -11
  119. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +0 -191
  120. data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +0 -153
  121. data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +0 -7
data/webpack/js-yaml.js CHANGED
@@ -1,31 +1,33 @@
1
-
2
1
  /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
3
- (function (global, factory) {
4
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
5
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
6
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jsyaml = {}));
7
- }(this, (function (exports) { 'use strict';
8
-
2
+ (function(global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined'
4
+ ? factory(exports)
5
+ : typeof define === 'function' && define.amd
6
+ ? define(['exports'], factory)
7
+ : ((global =
8
+ typeof globalThis !== 'undefined' ? globalThis : global || self),
9
+ factory((global.jsyaml = {})));
10
+ })(this, exports => {
9
11
  function isNothing(subject) {
10
- return (typeof subject === 'undefined') || (subject === null);
12
+ return typeof subject === 'undefined' || subject === null;
11
13
  }
12
14
 
13
-
14
15
  function isObject(subject) {
15
- return (typeof subject === 'object') && (subject !== null);
16
+ return typeof subject === 'object' && subject !== null;
16
17
  }
17
18
 
18
-
19
19
  function toArray(sequence) {
20
20
  if (Array.isArray(sequence)) return sequence;
21
21
  else if (isNothing(sequence)) return [];
22
22
 
23
- return [ sequence ];
23
+ return [sequence];
24
24
  }
25
25
 
26
-
27
26
  function extend(target, source) {
28
- var index, length, key, sourceKeys;
27
+ let index;
28
+ let length;
29
+ let key;
30
+ let sourceKeys;
29
31
 
30
32
  if (source) {
31
33
  sourceKeys = Object.keys(source);
@@ -39,9 +41,9 @@
39
41
  return target;
40
42
  }
41
43
 
42
-
43
44
  function repeat(string, count) {
44
- var result = '', cycle;
45
+ let result = '';
46
+ let cycle;
45
47
 
46
48
  for (cycle = 0; cycle < count; cycle += 1) {
47
49
  result += string;
@@ -50,50 +52,47 @@
50
52
  return result;
51
53
  }
52
54
 
53
-
54
55
  function isNegativeZero(number) {
55
- return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
56
+ return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
56
57
  }
57
58
 
58
-
59
- var isNothing_1 = isNothing;
60
- var isObject_1 = isObject;
61
- var toArray_1 = toArray;
62
- var repeat_1 = repeat;
63
- var isNegativeZero_1 = isNegativeZero;
64
- var extend_1 = extend;
65
-
66
- var common = {
67
- isNothing: isNothing_1,
68
- isObject: isObject_1,
69
- toArray: toArray_1,
70
- repeat: repeat_1,
71
- isNegativeZero: isNegativeZero_1,
72
- extend: extend_1
59
+ const isNothing_1 = isNothing;
60
+ const isObject_1 = isObject;
61
+ const toArray_1 = toArray;
62
+ const repeat_1 = repeat;
63
+ const isNegativeZero_1 = isNegativeZero;
64
+ const extend_1 = extend;
65
+
66
+ const common = {
67
+ isNothing: isNothing_1,
68
+ isObject: isObject_1,
69
+ toArray: toArray_1,
70
+ repeat: repeat_1,
71
+ isNegativeZero: isNegativeZero_1,
72
+ extend: extend_1,
73
73
  };
74
74
 
75
75
  // YAML error class. http://stackoverflow.com/questions/8458984
76
76
 
77
-
78
77
  function formatError(exception, compact) {
79
- var where = '', message = exception.reason || '(unknown reason)';
78
+ let where = '';
79
+ const message = exception.reason || '(unknown reason)';
80
80
 
81
81
  if (!exception.mark) return message;
82
82
 
83
83
  if (exception.mark.name) {
84
- where += 'in "' + exception.mark.name + '" ';
84
+ where += `in "${exception.mark.name}" `;
85
85
  }
86
86
 
87
- where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';
87
+ where += `(${exception.mark.line + 1}:${exception.mark.column + 1})`;
88
88
 
89
89
  if (!compact && exception.mark.snippet) {
90
- where += '\n\n' + exception.mark.snippet;
90
+ where += `\n\n${exception.mark.snippet}`;
91
91
  }
92
92
 
93
- return message + ' ' + where;
93
+ return `${message} ${where}`;
94
94
  }
95
95
 
96
-
97
96
  function YAMLException$1(reason, mark) {
98
97
  // Super constructor
99
98
  Error.call(this);
@@ -109,28 +108,25 @@
109
108
  Error.captureStackTrace(this, this.constructor);
110
109
  } else {
111
110
  // FF, IE 10+ and Safari 6+. Fallback for others
112
- this.stack = (new Error()).stack || '';
111
+ this.stack = new Error().stack || '';
113
112
  }
114
113
  }
115
114
 
116
-
117
115
  // Inherit from Error
118
116
  YAMLException$1.prototype = Object.create(Error.prototype);
119
117
  YAMLException$1.prototype.constructor = YAMLException$1;
120
118
 
121
-
122
119
  YAMLException$1.prototype.toString = function toString(compact) {
123
- return this.name + ': ' + formatError(this, compact);
120
+ return `${this.name}: ${formatError(this, compact)}`;
124
121
  };
125
122
 
126
-
127
- var exception = YAMLException$1;
123
+ const exception = YAMLException$1;
128
124
 
129
125
  // get snippet for a single line, respecting maxLength
130
126
  function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
131
- var head = '';
132
- var tail = '';
133
- var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
127
+ let head = '';
128
+ let tail = '';
129
+ const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
134
130
 
135
131
  if (position - lineStart > maxHalfLength) {
136
132
  head = ' ... ';
@@ -144,31 +140,29 @@
144
140
 
145
141
  return {
146
142
  str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail,
147
- pos: position - lineStart + head.length // relative position
143
+ pos: position - lineStart + head.length, // relative position
148
144
  };
149
145
  }
150
146
 
151
-
152
147
  function padStart(string, max) {
153
148
  return common.repeat(' ', max - string.length) + string;
154
149
  }
155
150
 
156
-
157
151
  function makeSnippet(mark, options) {
158
152
  options = Object.create(options || null);
159
153
 
160
154
  if (!mark.buffer) return null;
161
155
 
162
156
  if (!options.maxLength) options.maxLength = 79;
163
- if (typeof options.indent !== 'number') options.indent = 1;
157
+ if (typeof options.indent !== 'number') options.indent = 1;
164
158
  if (typeof options.linesBefore !== 'number') options.linesBefore = 3;
165
- if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
159
+ if (typeof options.linesAfter !== 'number') options.linesAfter = 2;
166
160
 
167
- var re = /\r?\n|\r|\0/g;
168
- var lineStarts = [ 0 ];
169
- var lineEnds = [];
170
- var match;
171
- var foundLineNo = -1;
161
+ const re = /\r?\n|\r|\0/g;
162
+ const lineStarts = [0];
163
+ const lineEnds = [];
164
+ let match;
165
+ let foundLineNo = -1;
172
166
 
173
167
  while ((match = re.exec(mark.buffer))) {
174
168
  lineEnds.push(match.index);
@@ -181,9 +175,15 @@
181
175
 
182
176
  if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
183
177
 
184
- var result = '', i, line;
185
- var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
186
- var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
178
+ let result = '';
179
+ let i;
180
+ let line;
181
+ const lineNoLength = Math.min(
182
+ mark.line + options.linesAfter,
183
+ lineEnds.length
184
+ ).toString().length;
185
+ const maxLineLength =
186
+ options.maxLength - (options.indent + lineNoLength + 3);
187
187
 
188
188
  for (i = 1; i <= options.linesBefore; i++) {
189
189
  if (foundLineNo - i < 0) break;
@@ -194,14 +194,24 @@
194
194
  mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
195
195
  maxLineLength
196
196
  );
197
- result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +
198
- ' | ' + line.str + '\n' + result;
199
- }
200
-
201
- line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
202
- result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +
203
- ' | ' + line.str + '\n';
204
- result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n';
197
+ result = `${common.repeat(' ', options.indent) +
198
+ padStart((mark.line - i + 1).toString(), lineNoLength)} | ${
199
+ line.str
200
+ }\n${result}`;
201
+ }
202
+
203
+ line = getLine(
204
+ mark.buffer,
205
+ lineStarts[foundLineNo],
206
+ lineEnds[foundLineNo],
207
+ mark.position,
208
+ maxLineLength
209
+ );
210
+ result += `${common.repeat(' ', options.indent) +
211
+ padStart((mark.line + 1).toString(), lineNoLength)} | ${line.str}\n`;
212
+ result +=
213
+ `${common.repeat('-', options.indent + lineNoLength + 3 + line.pos)}^` +
214
+ `\n`;
205
215
 
206
216
  for (i = 1; i <= options.linesAfter; i++) {
207
217
  if (foundLineNo + i >= lineEnds.length) break;
@@ -212,17 +222,18 @@
212
222
  mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
213
223
  maxLineLength
214
224
  );
215
- result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +
216
- ' | ' + line.str + '\n';
225
+ result += `${common.repeat(' ', options.indent) +
226
+ padStart((mark.line + i + 1).toString(), lineNoLength)} | ${
227
+ line.str
228
+ }\n`;
217
229
  }
218
230
 
219
231
  return result.replace(/\n$/, '');
220
232
  }
221
233
 
234
+ const snippet = makeSnippet;
222
235
 
223
- var snippet = makeSnippet;
224
-
225
- var TYPE_CONSTRUCTOR_OPTIONS = [
236
+ const TYPE_CONSTRUCTOR_OPTIONS = [
226
237
  'kind',
227
238
  'multi',
228
239
  'resolve',
@@ -232,21 +243,17 @@
232
243
  'represent',
233
244
  'representName',
234
245
  'defaultStyle',
235
- 'styleAliases'
246
+ 'styleAliases',
236
247
  ];
237
248
 
238
- var YAML_NODE_KINDS = [
239
- 'scalar',
240
- 'sequence',
241
- 'mapping'
242
- ];
249
+ const YAML_NODE_KINDS = ['scalar', 'sequence', 'mapping'];
243
250
 
244
251
  function compileStyleAliases(map) {
245
- var result = {};
252
+ const result = {};
246
253
 
247
254
  if (map !== null) {
248
- Object.keys(map).forEach(function (style) {
249
- map[style].forEach(function (alias) {
255
+ Object.keys(map).forEach(style => {
256
+ map[style].forEach(alias => {
250
257
  result[String(alias)] = style;
251
258
  });
252
259
  });
@@ -258,50 +265,59 @@
258
265
  function Type$1(tag, options) {
259
266
  options = options || {};
260
267
 
261
- Object.keys(options).forEach(function (name) {
268
+ Object.keys(options).forEach(name => {
262
269
  if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
263
- throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
270
+ throw new exception(
271
+ `Unknown option "${name}" is met in definition of "${tag}" YAML type.`
272
+ );
264
273
  }
265
274
  });
266
275
 
267
276
  // TODO: Add tag format check.
268
- this.options = options; // keep original options in case user wants to extend this type later
269
- this.tag = tag;
270
- this.kind = options['kind'] || null;
271
- this.resolve = options['resolve'] || function () { return true; };
272
- this.construct = options['construct'] || function (data) { return data; };
273
- this.instanceOf = options['instanceOf'] || null;
274
- this.predicate = options['predicate'] || null;
275
- this.represent = options['represent'] || null;
276
- this.representName = options['representName'] || null;
277
- this.defaultStyle = options['defaultStyle'] || null;
278
- this.multi = options['multi'] || false;
279
- this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
277
+ this.options = options; // keep original options in case user wants to extend this type later
278
+ this.tag = tag;
279
+ this.kind = options.kind || null;
280
+ this.resolve =
281
+ options.resolve ||
282
+ function() {
283
+ return true;
284
+ };
285
+ this.construct =
286
+ options.construct ||
287
+ function(data) {
288
+ return data;
289
+ };
290
+ this.instanceOf = options.instanceOf || null;
291
+ this.predicate = options.predicate || null;
292
+ this.represent = options.represent || null;
293
+ this.representName = options.representName || null;
294
+ this.defaultStyle = options.defaultStyle || null;
295
+ this.multi = options.multi || false;
296
+ this.styleAliases = compileStyleAliases(options.styleAliases || null);
280
297
 
281
298
  if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
282
- throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
299
+ throw new exception(
300
+ `Unknown kind "${this.kind}" is specified for "${tag}" YAML type.`
301
+ );
283
302
  }
284
303
  }
285
304
 
286
- var type = Type$1;
287
-
288
- /*eslint-disable max-len*/
289
-
290
-
291
-
305
+ const type = Type$1;
292
306
 
307
+ /* eslint-disable max-len */
293
308
 
294
309
  function compileList(schema, name) {
295
- var result = [];
296
-
297
- schema[name].forEach(function (currentType) {
298
- var newIndex = result.length;
310
+ const result = [];
299
311
 
300
- result.forEach(function (previousType, previousIndex) {
301
- if (previousType.tag === currentType.tag &&
302
- previousType.kind === currentType.kind &&
303
- previousType.multi === currentType.multi) {
312
+ schema[name].forEach(currentType => {
313
+ let newIndex = result.length;
304
314
 
315
+ result.forEach((previousType, previousIndex) => {
316
+ if (
317
+ previousType.tag === currentType.tag &&
318
+ previousType.kind === currentType.kind &&
319
+ previousType.multi === currentType.multi
320
+ ) {
305
321
  newIndex = previousIndex;
306
322
  }
307
323
  });
@@ -312,27 +328,28 @@
312
328
  return result;
313
329
  }
314
330
 
315
-
316
331
  function compileMap(/* lists... */) {
317
- var result = {
318
- scalar: {},
319
- sequence: {},
320
- mapping: {},
321
- fallback: {},
322
- multi: {
323
- scalar: [],
324
- sequence: [],
325
- mapping: [],
326
- fallback: []
327
- }
328
- }, index, length;
332
+ const result = {
333
+ scalar: {},
334
+ sequence: {},
335
+ mapping: {},
336
+ fallback: {},
337
+ multi: {
338
+ scalar: [],
339
+ sequence: [],
340
+ mapping: [],
341
+ fallback: [],
342
+ },
343
+ };
344
+ let index;
345
+ let length;
329
346
 
330
347
  function collectType(type) {
331
348
  if (type.multi) {
332
349
  result.multi[type.kind].push(type);
333
- result.multi['fallback'].push(type);
350
+ result.multi.fallback.push(type);
334
351
  } else {
335
- result[type.kind][type.tag] = result['fallback'][type.tag] = type;
352
+ result[type.kind][type.tag] = result.fallback[type.tag] = type;
336
353
  }
337
354
  }
338
355
 
@@ -342,99 +359,113 @@
342
359
  return result;
343
360
  }
344
361
 
345
-
346
362
  function Schema$1(definition) {
347
363
  return this.extend(definition);
348
364
  }
349
365
 
350
-
351
366
  Schema$1.prototype.extend = function extend(definition) {
352
- var implicit = [];
353
- var explicit = [];
367
+ let implicit = [];
368
+ let explicit = [];
354
369
 
355
370
  if (definition instanceof type) {
356
371
  // Schema.extend(type)
357
372
  explicit.push(definition);
358
-
359
373
  } else if (Array.isArray(definition)) {
360
374
  // Schema.extend([ type1, type2, ... ])
361
375
  explicit = explicit.concat(definition);
362
-
363
- } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
376
+ } else if (
377
+ definition &&
378
+ (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))
379
+ ) {
364
380
  // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })
365
381
  if (definition.implicit) implicit = implicit.concat(definition.implicit);
366
382
  if (definition.explicit) explicit = explicit.concat(definition.explicit);
367
-
368
383
  } else {
369
- throw new exception('Schema.extend argument should be a Type, [ Type ], ' +
370
- 'or a schema definition ({ implicit: [...], explicit: [...] })');
384
+ throw new exception(
385
+ 'Schema.extend argument should be a Type, [ Type ], ' +
386
+ 'or a schema definition ({ implicit: [...], explicit: [...] })'
387
+ );
371
388
  }
372
389
 
373
- implicit.forEach(function (type$1) {
390
+ implicit.forEach(type$1 => {
374
391
  if (!(type$1 instanceof type)) {
375
- throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
392
+ throw new exception(
393
+ 'Specified list of YAML types (or a single Type object) contains a non-Type object.'
394
+ );
376
395
  }
377
396
 
378
397
  if (type$1.loadKind && type$1.loadKind !== 'scalar') {
379
- throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
398
+ throw new exception(
399
+ 'There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'
400
+ );
380
401
  }
381
402
 
382
403
  if (type$1.multi) {
383
- throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');
404
+ throw new exception(
405
+ 'There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'
406
+ );
384
407
  }
385
408
  });
386
409
 
387
- explicit.forEach(function (type$1) {
410
+ explicit.forEach(type$1 => {
388
411
  if (!(type$1 instanceof type)) {
389
- throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');
412
+ throw new exception(
413
+ 'Specified list of YAML types (or a single Type object) contains a non-Type object.'
414
+ );
390
415
  }
391
416
  });
392
417
 
393
- var result = Object.create(Schema$1.prototype);
418
+ const result = Object.create(Schema$1.prototype);
394
419
 
395
420
  result.implicit = (this.implicit || []).concat(implicit);
396
421
  result.explicit = (this.explicit || []).concat(explicit);
397
422
 
398
423
  result.compiledImplicit = compileList(result, 'implicit');
399
424
  result.compiledExplicit = compileList(result, 'explicit');
400
- result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
425
+ result.compiledTypeMap = compileMap(
426
+ result.compiledImplicit,
427
+ result.compiledExplicit
428
+ );
401
429
 
402
430
  return result;
403
431
  };
404
432
 
433
+ const schema = Schema$1;
405
434
 
406
- var schema = Schema$1;
407
-
408
- var str = new type('tag:yaml.org,2002:str', {
435
+ const str = new type('tag:yaml.org,2002:str', {
409
436
  kind: 'scalar',
410
- construct: function (data) { return data !== null ? data : ''; }
437
+ construct(data) {
438
+ return data !== null ? data : '';
439
+ },
411
440
  });
412
441
 
413
- var seq = new type('tag:yaml.org,2002:seq', {
442
+ const seq = new type('tag:yaml.org,2002:seq', {
414
443
  kind: 'sequence',
415
- construct: function (data) { return data !== null ? data : []; }
444
+ construct(data) {
445
+ return data !== null ? data : [];
446
+ },
416
447
  });
417
448
 
418
- var map = new type('tag:yaml.org,2002:map', {
449
+ const map = new type('tag:yaml.org,2002:map', {
419
450
  kind: 'mapping',
420
- construct: function (data) { return data !== null ? data : {}; }
451
+ construct(data) {
452
+ return data !== null ? data : {};
453
+ },
421
454
  });
422
455
 
423
- var failsafe = new schema({
424
- explicit: [
425
- str,
426
- seq,
427
- map
428
- ]
456
+ const failsafe = new schema({
457
+ explicit: [str, seq, map],
429
458
  });
430
459
 
431
460
  function resolveYamlNull(data) {
432
461
  if (data === null) return true;
433
462
 
434
- var max = data.length;
463
+ const max = data.length;
435
464
 
436
- return (max === 1 && data === '~') ||
437
- (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
465
+ return (
466
+ (max === 1 && data === '~') ||
467
+ (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'))
468
+ );
438
469
  }
439
470
 
440
471
  function constructYamlNull() {
@@ -445,74 +476,92 @@
445
476
  return object === null;
446
477
  }
447
478
 
448
- var _null = new type('tag:yaml.org,2002:null', {
479
+ const _null = new type('tag:yaml.org,2002:null', {
449
480
  kind: 'scalar',
450
481
  resolve: resolveYamlNull,
451
482
  construct: constructYamlNull,
452
483
  predicate: isNull,
453
484
  represent: {
454
- canonical: function () { return '~'; },
455
- lowercase: function () { return 'null'; },
456
- uppercase: function () { return 'NULL'; },
457
- camelcase: function () { return 'Null'; },
458
- empty: function () { return ''; }
485
+ canonical() {
486
+ return '~';
487
+ },
488
+ lowercase() {
489
+ return 'null';
490
+ },
491
+ uppercase() {
492
+ return 'NULL';
493
+ },
494
+ camelcase() {
495
+ return 'Null';
496
+ },
497
+ empty() {
498
+ return '';
499
+ },
459
500
  },
460
- defaultStyle: 'lowercase'
501
+ defaultStyle: 'lowercase',
461
502
  });
462
503
 
463
504
  function resolveYamlBoolean(data) {
464
505
  if (data === null) return false;
465
506
 
466
- var max = data.length;
507
+ const max = data.length;
467
508
 
468
- return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
469
- (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
509
+ return (
510
+ (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
511
+ (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'))
512
+ );
470
513
  }
471
514
 
472
515
  function constructYamlBoolean(data) {
473
- return data === 'true' ||
474
- data === 'True' ||
475
- data === 'TRUE';
516
+ return data === 'true' || data === 'True' || data === 'TRUE';
476
517
  }
477
518
 
478
519
  function isBoolean(object) {
479
520
  return Object.prototype.toString.call(object) === '[object Boolean]';
480
521
  }
481
522
 
482
- var bool = new type('tag:yaml.org,2002:bool', {
523
+ const bool = new type('tag:yaml.org,2002:bool', {
483
524
  kind: 'scalar',
484
525
  resolve: resolveYamlBoolean,
485
526
  construct: constructYamlBoolean,
486
527
  predicate: isBoolean,
487
528
  represent: {
488
- lowercase: function (object) { return object ? 'true' : 'false'; },
489
- uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
490
- camelcase: function (object) { return object ? 'True' : 'False'; }
529
+ lowercase(object) {
530
+ return object ? 'true' : 'false';
531
+ },
532
+ uppercase(object) {
533
+ return object ? 'TRUE' : 'FALSE';
534
+ },
535
+ camelcase(object) {
536
+ return object ? 'True' : 'False';
537
+ },
491
538
  },
492
- defaultStyle: 'lowercase'
539
+ defaultStyle: 'lowercase',
493
540
  });
494
541
 
495
542
  function isHexCode(c) {
496
- return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
497
- ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
498
- ((0x61/* a */ <= c) && (c <= 0x66/* f */));
543
+ return (
544
+ (c /* 0 */ >= 0x30 && c <= 0x39) /* 9 */ ||
545
+ (c /* A */ >= 0x41 && c <= 0x46) /* F */ ||
546
+ (c /* a */ >= 0x61 && c <= 0x66) /* f */
547
+ );
499
548
  }
500
549
 
501
550
  function isOctCode(c) {
502
- return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
551
+ return c /* 0 */ >= 0x30 && c <= 0x37 /* 7 */;
503
552
  }
504
553
 
505
554
  function isDecCode(c) {
506
- return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
555
+ return c /* 0 */ >= 0x30 && c <= 0x39 /* 9 */;
507
556
  }
508
557
 
509
558
  function resolveYamlInteger(data) {
510
559
  if (data === null) return false;
511
560
 
512
- var max = data.length,
513
- index = 0,
514
- hasDigits = false,
515
- ch;
561
+ const max = data.length;
562
+ let index = 0;
563
+ let hasDigits = false;
564
+ let ch;
516
565
 
517
566
  if (!max) return false;
518
567
 
@@ -543,7 +592,6 @@
543
592
  return hasDigits && ch !== '_';
544
593
  }
545
594
 
546
-
547
595
  if (ch === 'x') {
548
596
  // base 16
549
597
  index++;
@@ -557,7 +605,6 @@
557
605
  return hasDigits && ch !== '_';
558
606
  }
559
607
 
560
-
561
608
  if (ch === 'o') {
562
609
  // base 8
563
610
  index++;
@@ -593,7 +640,9 @@
593
640
  }
594
641
 
595
642
  function constructYamlInteger(data) {
596
- var value = data, sign = 1, ch;
643
+ let value = data;
644
+ let sign = 1;
645
+ let ch;
597
646
 
598
647
  if (value.indexOf('_') !== -1) {
599
648
  value = value.replace(/_/g, '');
@@ -619,49 +668,72 @@
619
668
  }
620
669
 
621
670
  function isInteger(object) {
622
- return (Object.prototype.toString.call(object)) === '[object Number]' &&
623
- (object % 1 === 0 && !common.isNegativeZero(object));
671
+ return (
672
+ Object.prototype.toString.call(object) === '[object Number]' &&
673
+ object % 1 === 0 &&
674
+ !common.isNegativeZero(object)
675
+ );
624
676
  }
625
677
 
626
- var int = new type('tag:yaml.org,2002:int', {
678
+ const int = new type('tag:yaml.org,2002:int', {
627
679
  kind: 'scalar',
628
680
  resolve: resolveYamlInteger,
629
681
  construct: constructYamlInteger,
630
682
  predicate: isInteger,
631
683
  represent: {
632
- binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
633
- octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },
634
- decimal: function (obj) { return obj.toString(10); },
684
+ binary(obj) {
685
+ return obj >= 0
686
+ ? `0b${obj.toString(2)}`
687
+ : `-0b${obj.toString(2).slice(1)}`;
688
+ },
689
+ octal(obj) {
690
+ return obj >= 0
691
+ ? `0o${obj.toString(8)}`
692
+ : `-0o${obj.toString(8).slice(1)}`;
693
+ },
694
+ decimal(obj) {
695
+ return obj.toString(10);
696
+ },
635
697
  /* eslint-disable max-len */
636
- hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
698
+ hexadecimal(obj) {
699
+ return obj >= 0
700
+ ? `0x${obj.toString(16).toUpperCase()}`
701
+ : `-0x${obj
702
+ .toString(16)
703
+ .toUpperCase()
704
+ .slice(1)}`;
705
+ },
637
706
  },
638
707
  defaultStyle: 'decimal',
639
708
  styleAliases: {
640
- binary: [ 2, 'bin' ],
641
- octal: [ 8, 'oct' ],
642
- decimal: [ 10, 'dec' ],
643
- hexadecimal: [ 16, 'hex' ]
644
- }
709
+ binary: [2, 'bin'],
710
+ octal: [8, 'oct'],
711
+ decimal: [10, 'dec'],
712
+ hexadecimal: [16, 'hex'],
713
+ },
645
714
  });
646
715
 
647
- var YAML_FLOAT_PATTERN = new RegExp(
716
+ const YAML_FLOAT_PATTERN = new RegExp(
648
717
  // 2.5e4, 2.5 and integers
649
718
  '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
650
- // .2e4, .2
651
- // special case, seems not from spec
652
- '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
653
- // .inf
654
- '|[-+]?\\.(?:inf|Inf|INF)' +
655
- // .nan
656
- '|\\.(?:nan|NaN|NAN))$');
719
+ // .2e4, .2
720
+ // special case, seems not from spec
721
+ '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
722
+ // .inf
723
+ '|[-+]?\\.(?:inf|Inf|INF)' +
724
+ // .nan
725
+ '|\\.(?:nan|NaN|NAN))$'
726
+ );
657
727
 
658
728
  function resolveYamlFloat(data) {
659
729
  if (data === null) return false;
660
730
 
661
- if (!YAML_FLOAT_PATTERN.test(data) ||
662
- // Quick hack to not allow integers end with `_`
663
- // Probably should update regexp & check speed
664
- data[data.length - 1] === '_') {
731
+ if (
732
+ !YAML_FLOAT_PATTERN.test(data) ||
733
+ // Quick hack to not allow integers end with `_`
734
+ // Probably should update regexp & check speed
735
+ data[data.length - 1] === '_'
736
+ ) {
665
737
  return false;
666
738
  }
667
739
 
@@ -669,47 +741,55 @@
669
741
  }
670
742
 
671
743
  function constructYamlFloat(data) {
672
- var value, sign;
744
+ let value;
745
+ let sign;
673
746
 
674
- value = data.replace(/_/g, '').toLowerCase();
675
- sign = value[0] === '-' ? -1 : 1;
747
+ value = data.replace(/_/g, '').toLowerCase();
748
+ sign = value[0] === '-' ? -1 : 1;
676
749
 
677
750
  if ('+-'.indexOf(value[0]) >= 0) {
678
751
  value = value.slice(1);
679
752
  }
680
753
 
681
754
  if (value === '.inf') {
682
- return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
683
-
755
+ return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
684
756
  } else if (value === '.nan') {
685
757
  return NaN;
686
758
  }
687
759
  return sign * parseFloat(value, 10);
688
760
  }
689
761
 
690
-
691
- var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
762
+ const SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
692
763
 
693
764
  function representYamlFloat(object, style) {
694
- var res;
765
+ let res;
695
766
 
696
767
  if (isNaN(object)) {
697
768
  switch (style) {
698
- case 'lowercase': return '.nan';
699
- case 'uppercase': return '.NAN';
700
- case 'camelcase': return '.NaN';
769
+ case 'lowercase':
770
+ return '.nan';
771
+ case 'uppercase':
772
+ return '.NAN';
773
+ case 'camelcase':
774
+ return '.NaN';
701
775
  }
702
776
  } else if (Number.POSITIVE_INFINITY === object) {
703
777
  switch (style) {
704
- case 'lowercase': return '.inf';
705
- case 'uppercase': return '.INF';
706
- case 'camelcase': return '.Inf';
778
+ case 'lowercase':
779
+ return '.inf';
780
+ case 'uppercase':
781
+ return '.INF';
782
+ case 'camelcase':
783
+ return '.Inf';
707
784
  }
708
785
  } else if (Number.NEGATIVE_INFINITY === object) {
709
786
  switch (style) {
710
- case 'lowercase': return '-.inf';
711
- case 'uppercase': return '-.INF';
712
- case 'camelcase': return '-.Inf';
787
+ case 'lowercase':
788
+ return '-.inf';
789
+ case 'uppercase':
790
+ return '-.INF';
791
+ case 'camelcase':
792
+ return '-.Inf';
713
793
  }
714
794
  } else if (common.isNegativeZero(object)) {
715
795
  return '-0.0';
@@ -724,46 +804,45 @@
724
804
  }
725
805
 
726
806
  function isFloat(object) {
727
- return (Object.prototype.toString.call(object) === '[object Number]') &&
728
- (object % 1 !== 0 || common.isNegativeZero(object));
807
+ return (
808
+ Object.prototype.toString.call(object) === '[object Number]' &&
809
+ (object % 1 !== 0 || common.isNegativeZero(object))
810
+ );
729
811
  }
730
812
 
731
- var float = new type('tag:yaml.org,2002:float', {
813
+ const float = new type('tag:yaml.org,2002:float', {
732
814
  kind: 'scalar',
733
815
  resolve: resolveYamlFloat,
734
816
  construct: constructYamlFloat,
735
817
  predicate: isFloat,
736
818
  represent: representYamlFloat,
737
- defaultStyle: 'lowercase'
819
+ defaultStyle: 'lowercase',
738
820
  });
739
821
 
740
- var json = failsafe.extend({
741
- implicit: [
742
- _null,
743
- bool,
744
- int,
745
- float
746
- ]
822
+ const json = failsafe.extend({
823
+ implicit: [_null, bool, int, float],
747
824
  });
748
825
 
749
- var core = json;
750
-
751
- var YAML_DATE_REGEXP = new RegExp(
752
- '^([0-9][0-9][0-9][0-9])' + // [1] year
753
- '-([0-9][0-9])' + // [2] month
754
- '-([0-9][0-9])$'); // [3] day
755
-
756
- var YAML_TIMESTAMP_REGEXP = new RegExp(
757
- '^([0-9][0-9][0-9][0-9])' + // [1] year
758
- '-([0-9][0-9]?)' + // [2] month
759
- '-([0-9][0-9]?)' + // [3] day
760
- '(?:[Tt]|[ \\t]+)' + // ...
761
- '([0-9][0-9]?)' + // [4] hour
762
- ':([0-9][0-9])' + // [5] minute
763
- ':([0-9][0-9])' + // [6] second
764
- '(?:\\.([0-9]*))?' + // [7] fraction
826
+ const core = json;
827
+
828
+ const YAML_DATE_REGEXP = new RegExp(
829
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
830
+ '-([0-9][0-9])' + // [2] month
831
+ '-([0-9][0-9])$'
832
+ ); // [3] day
833
+
834
+ const YAML_TIMESTAMP_REGEXP = new RegExp(
835
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
836
+ '-([0-9][0-9]?)' + // [2] month
837
+ '-([0-9][0-9]?)' + // [3] day
838
+ '(?:[Tt]|[ \\t]+)' + // ...
839
+ '([0-9][0-9]?)' + // [4] hour
840
+ ':([0-9][0-9])' + // [5] minute
841
+ ':([0-9][0-9])' + // [6] second
842
+ '(?:\\.([0-9]*))?' + // [7] fraction
765
843
  '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
766
- '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
844
+ '(?::([0-9][0-9]))?))?$'
845
+ ); // [11] tz_minute
767
846
 
768
847
  function resolveYamlTimestamp(data) {
769
848
  if (data === null) return false;
@@ -773,8 +852,18 @@
773
852
  }
774
853
 
775
854
  function constructYamlTimestamp(data) {
776
- var match, year, month, day, hour, minute, second, fraction = 0,
777
- delta = null, tz_hour, tz_minute, date;
855
+ let match;
856
+ let year;
857
+ let month;
858
+ let day;
859
+ let hour;
860
+ let minute;
861
+ let second;
862
+ let fraction = 0;
863
+ let delta = null;
864
+ let tz_hour;
865
+ let tz_minute;
866
+ let date;
778
867
 
779
868
  match = YAML_DATE_REGEXP.exec(data);
780
869
  if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
@@ -783,23 +872,25 @@
783
872
 
784
873
  // match: [1] year [2] month [3] day
785
874
 
786
- year = +(match[1]);
787
- month = +(match[2]) - 1; // JS month starts with 0
788
- day = +(match[3]);
875
+ year = +match[1];
876
+ month = +match[2] - 1; // JS month starts with 0
877
+ day = +match[3];
789
878
 
790
- if (!match[4]) { // no hour
879
+ if (!match[4]) {
880
+ // no hour
791
881
  return new Date(Date.UTC(year, month, day));
792
882
  }
793
883
 
794
884
  // match: [4] hour [5] minute [6] second [7] fraction
795
885
 
796
- hour = +(match[4]);
797
- minute = +(match[5]);
798
- second = +(match[6]);
886
+ hour = +match[4];
887
+ minute = +match[5];
888
+ second = +match[6];
799
889
 
800
890
  if (match[7]) {
801
891
  fraction = match[7].slice(0, 3);
802
- while (fraction.length < 3) { // milli-seconds
892
+ while (fraction.length < 3) {
893
+ // milli-seconds
803
894
  fraction += '0';
804
895
  }
805
896
  fraction = +fraction;
@@ -808,7 +899,7 @@
808
899
  // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
809
900
 
810
901
  if (match[9]) {
811
- tz_hour = +(match[10]);
902
+ tz_hour = +match[10];
812
903
  tz_minute = +(match[11] || 0);
813
904
  delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
814
905
  if (match[9] === '-') delta = -delta;
@@ -821,41 +912,41 @@
821
912
  return date;
822
913
  }
823
914
 
824
- function representYamlTimestamp(object /*, style*/) {
915
+ function representYamlTimestamp(object /* , style */) {
825
916
  return object.toISOString();
826
917
  }
827
918
 
828
- var timestamp = new type('tag:yaml.org,2002:timestamp', {
919
+ const timestamp = new type('tag:yaml.org,2002:timestamp', {
829
920
  kind: 'scalar',
830
921
  resolve: resolveYamlTimestamp,
831
922
  construct: constructYamlTimestamp,
832
923
  instanceOf: Date,
833
- represent: representYamlTimestamp
924
+ represent: representYamlTimestamp,
834
925
  });
835
926
 
836
927
  function resolveYamlMerge(data) {
837
928
  return data === '<<' || data === null;
838
929
  }
839
930
 
840
- var merge = new type('tag:yaml.org,2002:merge', {
931
+ const merge = new type('tag:yaml.org,2002:merge', {
841
932
  kind: 'scalar',
842
- resolve: resolveYamlMerge
933
+ resolve: resolveYamlMerge,
843
934
  });
844
935
 
845
- /*eslint-disable no-bitwise*/
846
-
847
-
848
-
849
-
936
+ /* eslint-disable no-bitwise */
850
937
 
851
938
  // [ 64, 65, 66 ] -> [ padding, CR, LF ]
852
- var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
853
-
939
+ const BASE64_MAP =
940
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
854
941
 
855
942
  function resolveYamlBinary(data) {
856
943
  if (data === null) return false;
857
944
 
858
- var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
945
+ let code;
946
+ let idx;
947
+ let bitlen = 0;
948
+ const max = data.length;
949
+ const map = BASE64_MAP;
859
950
 
860
951
  // Convert one by one.
861
952
  for (idx = 0; idx < max; idx++) {
@@ -871,24 +962,25 @@
871
962
  }
872
963
 
873
964
  // If there are any bits left, source was corrupted
874
- return (bitlen % 8) === 0;
965
+ return bitlen % 8 === 0;
875
966
  }
876
967
 
877
968
  function constructYamlBinary(data) {
878
- var idx, tailbits,
879
- input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
880
- max = input.length,
881
- map = BASE64_MAP,
882
- bits = 0,
883
- result = [];
969
+ let idx;
970
+ let tailbits;
971
+ const input = data.replace(/[\r\n=]/g, ''); // remove CR/LF & padding to simplify scan
972
+ const max = input.length;
973
+ const map = BASE64_MAP;
974
+ let bits = 0;
975
+ const result = [];
884
976
 
885
977
  // Collect by 6*4 bits (3 bytes)
886
978
 
887
979
  for (idx = 0; idx < max; idx++) {
888
- if ((idx % 4 === 0) && idx) {
889
- result.push((bits >> 16) & 0xFF);
890
- result.push((bits >> 8) & 0xFF);
891
- result.push(bits & 0xFF);
980
+ if (idx % 4 === 0 && idx) {
981
+ result.push((bits >> 16) & 0xff);
982
+ result.push((bits >> 8) & 0xff);
983
+ result.push(bits & 0xff);
892
984
  }
893
985
 
894
986
  bits = (bits << 6) | map.indexOf(input.charAt(idx));
@@ -899,32 +991,35 @@
899
991
  tailbits = (max % 4) * 6;
900
992
 
901
993
  if (tailbits === 0) {
902
- result.push((bits >> 16) & 0xFF);
903
- result.push((bits >> 8) & 0xFF);
904
- result.push(bits & 0xFF);
994
+ result.push((bits >> 16) & 0xff);
995
+ result.push((bits >> 8) & 0xff);
996
+ result.push(bits & 0xff);
905
997
  } else if (tailbits === 18) {
906
- result.push((bits >> 10) & 0xFF);
907
- result.push((bits >> 2) & 0xFF);
998
+ result.push((bits >> 10) & 0xff);
999
+ result.push((bits >> 2) & 0xff);
908
1000
  } else if (tailbits === 12) {
909
- result.push((bits >> 4) & 0xFF);
1001
+ result.push((bits >> 4) & 0xff);
910
1002
  }
911
1003
 
912
1004
  return new Uint8Array(result);
913
1005
  }
914
1006
 
915
- function representYamlBinary(object /*, style*/) {
916
- var result = '', bits = 0, idx, tail,
917
- max = object.length,
918
- map = BASE64_MAP;
1007
+ function representYamlBinary(object /* , style */) {
1008
+ let result = '';
1009
+ let bits = 0;
1010
+ let idx;
1011
+ let tail;
1012
+ const max = object.length;
1013
+ const map = BASE64_MAP;
919
1014
 
920
1015
  // Convert every three bytes to 4 ASCII characters.
921
1016
 
922
1017
  for (idx = 0; idx < max; idx++) {
923
- if ((idx % 3 === 0) && idx) {
924
- result += map[(bits >> 18) & 0x3F];
925
- result += map[(bits >> 12) & 0x3F];
926
- result += map[(bits >> 6) & 0x3F];
927
- result += map[bits & 0x3F];
1018
+ if (idx % 3 === 0 && idx) {
1019
+ result += map[(bits >> 18) & 0x3f];
1020
+ result += map[(bits >> 12) & 0x3f];
1021
+ result += map[(bits >> 6) & 0x3f];
1022
+ result += map[bits & 0x3f];
928
1023
  }
929
1024
 
930
1025
  bits = (bits << 8) + object[idx];
@@ -935,18 +1030,18 @@
935
1030
  tail = max % 3;
936
1031
 
937
1032
  if (tail === 0) {
938
- result += map[(bits >> 18) & 0x3F];
939
- result += map[(bits >> 12) & 0x3F];
940
- result += map[(bits >> 6) & 0x3F];
941
- result += map[bits & 0x3F];
1033
+ result += map[(bits >> 18) & 0x3f];
1034
+ result += map[(bits >> 12) & 0x3f];
1035
+ result += map[(bits >> 6) & 0x3f];
1036
+ result += map[bits & 0x3f];
942
1037
  } else if (tail === 2) {
943
- result += map[(bits >> 10) & 0x3F];
944
- result += map[(bits >> 4) & 0x3F];
945
- result += map[(bits << 2) & 0x3F];
1038
+ result += map[(bits >> 10) & 0x3f];
1039
+ result += map[(bits >> 4) & 0x3f];
1040
+ result += map[(bits << 2) & 0x3f];
946
1041
  result += map[64];
947
1042
  } else if (tail === 1) {
948
- result += map[(bits >> 2) & 0x3F];
949
- result += map[(bits << 4) & 0x3F];
1043
+ result += map[(bits >> 2) & 0x3f];
1044
+ result += map[(bits << 4) & 0x3f];
950
1045
  result += map[64];
951
1046
  result += map[64];
952
1047
  }
@@ -955,25 +1050,30 @@
955
1050
  }
956
1051
 
957
1052
  function isBinary(obj) {
958
- return Object.prototype.toString.call(obj) === '[object Uint8Array]';
1053
+ return Object.prototype.toString.call(obj) === '[object Uint8Array]';
959
1054
  }
960
1055
 
961
- var binary = new type('tag:yaml.org,2002:binary', {
1056
+ const binary = new type('tag:yaml.org,2002:binary', {
962
1057
  kind: 'scalar',
963
1058
  resolve: resolveYamlBinary,
964
1059
  construct: constructYamlBinary,
965
1060
  predicate: isBinary,
966
- represent: representYamlBinary
1061
+ represent: representYamlBinary,
967
1062
  });
968
1063
 
969
- var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
970
- var _toString$2 = Object.prototype.toString;
1064
+ const _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
1065
+ const _toString$2 = Object.prototype.toString;
971
1066
 
972
1067
  function resolveYamlOmap(data) {
973
1068
  if (data === null) return true;
974
1069
 
975
- var objectKeys = [], index, length, pair, pairKey, pairHasKey,
976
- object = data;
1070
+ const objectKeys = [];
1071
+ let index;
1072
+ let length;
1073
+ let pair;
1074
+ let pairKey;
1075
+ let pairHasKey;
1076
+ const object = data;
977
1077
 
978
1078
  for (index = 0, length = object.length; index < length; index += 1) {
979
1079
  pair = object[index];
@@ -1001,19 +1101,23 @@
1001
1101
  return data !== null ? data : [];
1002
1102
  }
1003
1103
 
1004
- var omap = new type('tag:yaml.org,2002:omap', {
1104
+ const omap = new type('tag:yaml.org,2002:omap', {
1005
1105
  kind: 'sequence',
1006
1106
  resolve: resolveYamlOmap,
1007
- construct: constructYamlOmap
1107
+ construct: constructYamlOmap,
1008
1108
  });
1009
1109
 
1010
- var _toString$1 = Object.prototype.toString;
1110
+ const _toString$1 = Object.prototype.toString;
1011
1111
 
1012
1112
  function resolveYamlPairs(data) {
1013
1113
  if (data === null) return true;
1014
1114
 
1015
- var index, length, pair, keys, result,
1016
- object = data;
1115
+ let index;
1116
+ let length;
1117
+ let pair;
1118
+ let keys;
1119
+ let result;
1120
+ const object = data;
1017
1121
 
1018
1122
  result = new Array(object.length);
1019
1123
 
@@ -1026,7 +1130,7 @@
1026
1130
 
1027
1131
  if (keys.length !== 1) return false;
1028
1132
 
1029
- result[index] = [ keys[0], pair[keys[0]] ];
1133
+ result[index] = [keys[0], pair[keys[0]]];
1030
1134
  }
1031
1135
 
1032
1136
  return true;
@@ -1035,8 +1139,12 @@
1035
1139
  function constructYamlPairs(data) {
1036
1140
  if (data === null) return [];
1037
1141
 
1038
- var index, length, pair, keys, result,
1039
- object = data;
1142
+ let index;
1143
+ let length;
1144
+ let pair;
1145
+ let keys;
1146
+ let result;
1147
+ const object = data;
1040
1148
 
1041
1149
  result = new Array(object.length);
1042
1150
 
@@ -1045,24 +1153,25 @@
1045
1153
 
1046
1154
  keys = Object.keys(pair);
1047
1155
 
1048
- result[index] = [ keys[0], pair[keys[0]] ];
1156
+ result[index] = [keys[0], pair[keys[0]]];
1049
1157
  }
1050
1158
 
1051
1159
  return result;
1052
1160
  }
1053
1161
 
1054
- var pairs = new type('tag:yaml.org,2002:pairs', {
1162
+ const pairs = new type('tag:yaml.org,2002:pairs', {
1055
1163
  kind: 'sequence',
1056
1164
  resolve: resolveYamlPairs,
1057
- construct: constructYamlPairs
1165
+ construct: constructYamlPairs,
1058
1166
  });
1059
1167
 
1060
- var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1168
+ const _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1061
1169
 
1062
1170
  function resolveYamlSet(data) {
1063
1171
  if (data === null) return true;
1064
1172
 
1065
- var key, object = data;
1173
+ let key;
1174
+ const object = data;
1066
1175
 
1067
1176
  for (key in object) {
1068
1177
  if (_hasOwnProperty$2.call(object, key)) {
@@ -1077,90 +1186,78 @@
1077
1186
  return data !== null ? data : {};
1078
1187
  }
1079
1188
 
1080
- var set = new type('tag:yaml.org,2002:set', {
1189
+ const set = new type('tag:yaml.org,2002:set', {
1081
1190
  kind: 'mapping',
1082
1191
  resolve: resolveYamlSet,
1083
- construct: constructYamlSet
1192
+ construct: constructYamlSet,
1084
1193
  });
1085
1194
 
1086
- var _default = core.extend({
1087
- implicit: [
1088
- timestamp,
1089
- merge
1090
- ],
1091
- explicit: [
1092
- binary,
1093
- omap,
1094
- pairs,
1095
- set
1096
- ]
1195
+ const _default = core.extend({
1196
+ implicit: [timestamp, merge],
1197
+ explicit: [binary, omap, pairs, set],
1097
1198
  });
1098
1199
 
1099
- /*eslint-disable max-len,no-use-before-define*/
1100
-
1101
-
1102
-
1103
-
1104
-
1105
-
1200
+ /* eslint-disable max-len,no-use-before-define */
1106
1201
 
1107
- var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1202
+ const _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1108
1203
 
1204
+ const CONTEXT_FLOW_IN = 1;
1205
+ const CONTEXT_FLOW_OUT = 2;
1206
+ const CONTEXT_BLOCK_IN = 3;
1207
+ const CONTEXT_BLOCK_OUT = 4;
1109
1208
 
1110
- var CONTEXT_FLOW_IN = 1;
1111
- var CONTEXT_FLOW_OUT = 2;
1112
- var CONTEXT_BLOCK_IN = 3;
1113
- var CONTEXT_BLOCK_OUT = 4;
1209
+ const CHOMPING_CLIP = 1;
1210
+ const CHOMPING_STRIP = 2;
1211
+ const CHOMPING_KEEP = 3;
1114
1212
 
1213
+ const PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1214
+ const PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
1215
+ const PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
1216
+ const PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
1217
+ const PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
1115
1218
 
1116
- var CHOMPING_CLIP = 1;
1117
- var CHOMPING_STRIP = 2;
1118
- var CHOMPING_KEEP = 3;
1119
-
1120
-
1121
- var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1122
- var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
1123
- var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
1124
- var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
1125
- var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
1126
-
1127
-
1128
- function _class(obj) { return Object.prototype.toString.call(obj); }
1219
+ function _class(obj) {
1220
+ return Object.prototype.toString.call(obj);
1221
+ }
1129
1222
 
1130
1223
  function is_EOL(c) {
1131
- return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
1224
+ return c === 0x0a /* LF */ || c === 0x0d /* CR */;
1132
1225
  }
1133
1226
 
1134
1227
  function is_WHITE_SPACE(c) {
1135
- return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
1228
+ return c === 0x09 /* Tab */ || c === 0x20 /* Space */;
1136
1229
  }
1137
1230
 
1138
1231
  function is_WS_OR_EOL(c) {
1139
- return (c === 0x09/* Tab */) ||
1140
- (c === 0x20/* Space */) ||
1141
- (c === 0x0A/* LF */) ||
1142
- (c === 0x0D/* CR */);
1232
+ return (
1233
+ c === 0x09 /* Tab */ ||
1234
+ c === 0x20 /* Space */ ||
1235
+ c === 0x0a /* LF */ ||
1236
+ c === 0x0d /* CR */
1237
+ );
1143
1238
  }
1144
1239
 
1145
1240
  function is_FLOW_INDICATOR(c) {
1146
- return c === 0x2C/* , */ ||
1147
- c === 0x5B/* [ */ ||
1148
- c === 0x5D/* ] */ ||
1149
- c === 0x7B/* { */ ||
1150
- c === 0x7D/* } */;
1241
+ return (
1242
+ c === 0x2c /* , */ ||
1243
+ c === 0x5b /* [ */ ||
1244
+ c === 0x5d /* ] */ ||
1245
+ c === 0x7b /* { */ ||
1246
+ c === 0x7d /* } */
1247
+ );
1151
1248
  }
1152
1249
 
1153
1250
  function fromHexCode(c) {
1154
- var lc;
1251
+ let lc;
1155
1252
 
1156
- if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
1253
+ if (c /* 0 */ >= 0x30 && c <= 0x39 /* 9 */) {
1157
1254
  return c - 0x30;
1158
1255
  }
1159
1256
 
1160
- /*eslint-disable no-bitwise*/
1257
+ /* eslint-disable no-bitwise */
1161
1258
  lc = c | 0x20;
1162
1259
 
1163
- if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
1260
+ if (lc /* a */ >= 0x61 && lc <= 0x66 /* f */) {
1164
1261
  return lc - 0x61 + 10;
1165
1262
  }
1166
1263
 
@@ -1168,14 +1265,20 @@
1168
1265
  }
1169
1266
 
1170
1267
  function escapedHexLen(c) {
1171
- if (c === 0x78/* x */) { return 2; }
1172
- if (c === 0x75/* u */) { return 4; }
1173
- if (c === 0x55/* U */) { return 8; }
1268
+ if (c === 0x78 /* x */) {
1269
+ return 2;
1270
+ }
1271
+ if (c === 0x75 /* u */) {
1272
+ return 4;
1273
+ }
1274
+ if (c === 0x55 /* U */) {
1275
+ return 8;
1276
+ }
1174
1277
  return 0;
1175
1278
  }
1176
1279
 
1177
1280
  function fromDecimalCode(c) {
1178
- if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
1281
+ if (c /* 0 */ >= 0x30 && c <= 0x39 /* 9 */) {
1179
1282
  return c - 0x30;
1180
1283
  }
1181
1284
 
@@ -1184,66 +1287,84 @@
1184
1287
 
1185
1288
  function simpleEscapeSequence(c) {
1186
1289
  /* eslint-disable indent */
1187
- return (c === 0x30/* 0 */) ? '\x00' :
1188
- (c === 0x61/* a */) ? '\x07' :
1189
- (c === 0x62/* b */) ? '\x08' :
1190
- (c === 0x74/* t */) ? '\x09' :
1191
- (c === 0x09/* Tab */) ? '\x09' :
1192
- (c === 0x6E/* n */) ? '\x0A' :
1193
- (c === 0x76/* v */) ? '\x0B' :
1194
- (c === 0x66/* f */) ? '\x0C' :
1195
- (c === 0x72/* r */) ? '\x0D' :
1196
- (c === 0x65/* e */) ? '\x1B' :
1197
- (c === 0x20/* Space */) ? ' ' :
1198
- (c === 0x22/* " */) ? '\x22' :
1199
- (c === 0x2F/* / */) ? '/' :
1200
- (c === 0x5C/* \ */) ? '\x5C' :
1201
- (c === 0x4E/* N */) ? '\x85' :
1202
- (c === 0x5F/* _ */) ? '\xA0' :
1203
- (c === 0x4C/* L */) ? '\u2028' :
1204
- (c === 0x50/* P */) ? '\u2029' : '';
1290
+ return c === 0x30 /* 0 */
1291
+ ? '\x00'
1292
+ : c === 0x61 /* a */
1293
+ ? '\x07'
1294
+ : c === 0x62 /* b */
1295
+ ? '\x08'
1296
+ : c === 0x74 /* t */
1297
+ ? '\x09'
1298
+ : c === 0x09 /* Tab */
1299
+ ? '\x09'
1300
+ : c === 0x6e /* n */
1301
+ ? '\x0A'
1302
+ : c === 0x76 /* v */
1303
+ ? '\x0B'
1304
+ : c === 0x66 /* f */
1305
+ ? '\x0C'
1306
+ : c === 0x72 /* r */
1307
+ ? '\x0D'
1308
+ : c === 0x65 /* e */
1309
+ ? '\x1B'
1310
+ : c === 0x20 /* Space */
1311
+ ? ' '
1312
+ : c === 0x22 /* " */
1313
+ ? '\x22'
1314
+ : c === 0x2f /* / */
1315
+ ? '/'
1316
+ : c === 0x5c /* \ */
1317
+ ? '\x5C'
1318
+ : c === 0x4e /* N */
1319
+ ? '\x85'
1320
+ : c === 0x5f /* _ */
1321
+ ? '\xA0'
1322
+ : c === 0x4c /* L */
1323
+ ? '\u2028'
1324
+ : c === 0x50 /* P */
1325
+ ? '\u2029'
1326
+ : '';
1205
1327
  }
1206
1328
 
1207
1329
  function charFromCodepoint(c) {
1208
- if (c <= 0xFFFF) {
1330
+ if (c <= 0xffff) {
1209
1331
  return String.fromCharCode(c);
1210
1332
  }
1211
1333
  // Encode UTF-16 surrogate pair
1212
1334
  // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
1213
1335
  return String.fromCharCode(
1214
- ((c - 0x010000) >> 10) + 0xD800,
1215
- ((c - 0x010000) & 0x03FF) + 0xDC00
1336
+ ((c - 0x010000) >> 10) + 0xd800,
1337
+ ((c - 0x010000) & 0x03ff) + 0xdc00
1216
1338
  );
1217
1339
  }
1218
1340
 
1219
- var simpleEscapeCheck = new Array(256); // integer, for fast access
1220
- var simpleEscapeMap = new Array(256);
1221
- for (var i = 0; i < 256; i++) {
1341
+ const simpleEscapeCheck = new Array(256); // integer, for fast access
1342
+ const simpleEscapeMap = new Array(256);
1343
+ for (let i = 0; i < 256; i++) {
1222
1344
  simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
1223
1345
  simpleEscapeMap[i] = simpleEscapeSequence(i);
1224
1346
  }
1225
1347
 
1226
-
1227
1348
  function State$1(input, options) {
1228
1349
  this.input = input;
1229
1350
 
1230
- this.filename = options['filename'] || null;
1231
- this.schema = options['schema'] || _default;
1232
- this.onWarning = options['onWarning'] || null;
1351
+ this.filename = options.filename || null;
1352
+ this.schema = options.schema || _default;
1353
+ this.onWarning = options.onWarning || null;
1233
1354
  // (Hidden) Remove? makes the loader to expect YAML 1.1 documents
1234
1355
  // if such documents have no explicit %YAML directive
1235
- this.legacy = options['legacy'] || false;
1356
+ this.legacy = options.legacy || false;
1236
1357
 
1237
- this.json = options['json'] || false;
1238
- this.listener = options['listener'] || null;
1358
+ this.json = options.json || false;
1359
+ this.listener = options.listener || null;
1239
1360
 
1240
1361
  this.implicitTypes = this.schema.compiledImplicit;
1241
- this.typeMap = this.schema.compiledTypeMap;
1362
+ this.typeMap = this.schema.compiledTypeMap;
1242
1363
 
1243
- this.length = input.length;
1244
- this.position = 0;
1245
- this.line = 0;
1246
- this.lineStart = 0;
1364
+ this.length = input.length;
1365
+ this.position = 0;
1366
+ this.line = 0;
1367
+ this.lineStart = 0;
1247
1368
  this.lineIndent = 0;
1248
1369
 
1249
1370
  // position of first leading tab in the current line,
@@ -1260,18 +1381,16 @@
1260
1381
  this.tag;
1261
1382
  this.anchor;
1262
1383
  this.kind;
1263
- this.result;*/
1264
-
1384
+ this.result; */
1265
1385
  }
1266
1386
 
1267
-
1268
1387
  function generateError(state, message) {
1269
- var mark = {
1270
- name: state.filename,
1271
- buffer: state.input.slice(0, -1), // omit trailing \0
1388
+ const mark = {
1389
+ name: state.filename,
1390
+ buffer: state.input.slice(0, -1), // omit trailing \0
1272
1391
  position: state.position,
1273
- line: state.line,
1274
- column: state.position - state.lineStart
1392
+ line: state.line,
1393
+ column: state.position - state.lineStart,
1275
1394
  };
1276
1395
 
1277
1396
  mark.snippet = snippet(mark);
@@ -1289,12 +1408,11 @@
1289
1408
  }
1290
1409
  }
1291
1410
 
1292
-
1293
- var directiveHandlers = {
1294
-
1411
+ const directiveHandlers = {
1295
1412
  YAML: function handleYamlDirective(state, name, args) {
1296
-
1297
- var match, major, minor;
1413
+ let match;
1414
+ let major;
1415
+ let minor;
1298
1416
 
1299
1417
  if (state.version !== null) {
1300
1418
  throwError(state, 'duplication of %YAML directive');
@@ -1318,7 +1436,7 @@
1318
1436
  }
1319
1437
 
1320
1438
  state.version = args[0];
1321
- state.checkLineBreaks = (minor < 2);
1439
+ state.checkLineBreaks = minor < 2;
1322
1440
 
1323
1441
  if (minor !== 1 && minor !== 2) {
1324
1442
  throwWarning(state, 'unsupported YAML version of the document');
@@ -1326,8 +1444,8 @@
1326
1444
  },
1327
1445
 
1328
1446
  TAG: function handleTagDirective(state, name, args) {
1329
-
1330
- var handle, prefix;
1447
+ let handle;
1448
+ let prefix;
1331
1449
 
1332
1450
  if (args.length !== 2) {
1333
1451
  throwError(state, 'TAG directive accepts exactly two arguments');
@@ -1337,39 +1455,58 @@
1337
1455
  prefix = args[1];
1338
1456
 
1339
1457
  if (!PATTERN_TAG_HANDLE.test(handle)) {
1340
- throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
1458
+ throwError(
1459
+ state,
1460
+ 'ill-formed tag handle (first argument) of the TAG directive'
1461
+ );
1341
1462
  }
1342
1463
 
1343
1464
  if (_hasOwnProperty$1.call(state.tagMap, handle)) {
1344
- throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
1465
+ throwError(
1466
+ state,
1467
+ `there is a previously declared suffix for "${handle}" tag handle`
1468
+ );
1345
1469
  }
1346
1470
 
1347
1471
  if (!PATTERN_TAG_URI.test(prefix)) {
1348
- throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
1472
+ throwError(
1473
+ state,
1474
+ 'ill-formed tag prefix (second argument) of the TAG directive'
1475
+ );
1349
1476
  }
1350
1477
 
1351
1478
  try {
1352
1479
  prefix = decodeURIComponent(prefix);
1353
1480
  } catch (err) {
1354
- throwError(state, 'tag prefix is malformed: ' + prefix);
1481
+ throwError(state, `tag prefix is malformed: ${prefix}`);
1355
1482
  }
1356
1483
 
1357
1484
  state.tagMap[handle] = prefix;
1358
- }
1485
+ },
1359
1486
  };
1360
1487
 
1361
-
1362
1488
  function captureSegment(state, start, end, checkJson) {
1363
- var _position, _length, _character, _result;
1489
+ let _position;
1490
+ let _length;
1491
+ let _character;
1492
+ let _result;
1364
1493
 
1365
1494
  if (start < end) {
1366
1495
  _result = state.input.slice(start, end);
1367
1496
 
1368
1497
  if (checkJson) {
1369
- for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
1498
+ for (
1499
+ _position = 0, _length = _result.length;
1500
+ _position < _length;
1501
+ _position += 1
1502
+ ) {
1370
1503
  _character = _result.charCodeAt(_position);
1371
- if (!(_character === 0x09 ||
1372
- (0x20 <= _character && _character <= 0x10FFFF))) {
1504
+ if (
1505
+ !(
1506
+ _character === 0x09 ||
1507
+ (_character >= 0x20 && _character <= 0x10ffff)
1508
+ )
1509
+ ) {
1373
1510
  throwError(state, 'expected valid JSON character');
1374
1511
  }
1375
1512
  }
@@ -1382,15 +1519,25 @@
1382
1519
  }
1383
1520
 
1384
1521
  function mergeMappings(state, destination, source, overridableKeys) {
1385
- var sourceKeys, key, index, quantity;
1522
+ let sourceKeys;
1523
+ let key;
1524
+ let index;
1525
+ let quantity;
1386
1526
 
1387
1527
  if (!common.isObject(source)) {
1388
- throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
1528
+ throwError(
1529
+ state,
1530
+ 'cannot merge mappings; the provided source object is unacceptable'
1531
+ );
1389
1532
  }
1390
1533
 
1391
1534
  sourceKeys = Object.keys(source);
1392
1535
 
1393
- for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1536
+ for (
1537
+ index = 0, quantity = sourceKeys.length;
1538
+ index < quantity;
1539
+ index += 1
1540
+ ) {
1394
1541
  key = sourceKeys[index];
1395
1542
 
1396
1543
  if (!_hasOwnProperty$1.call(destination, key)) {
@@ -1400,10 +1547,19 @@
1400
1547
  }
1401
1548
  }
1402
1549
 
1403
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,
1404
- startLine, startLineStart, startPos) {
1405
-
1406
- var index, quantity;
1550
+ function storeMappingPair(
1551
+ state,
1552
+ _result,
1553
+ overridableKeys,
1554
+ keyTag,
1555
+ keyNode,
1556
+ valueNode,
1557
+ startLine,
1558
+ startLineStart,
1559
+ startPos
1560
+ ) {
1561
+ let index;
1562
+ let quantity;
1407
1563
 
1408
1564
  // The output is a plain object here, so keys can only be strings.
1409
1565
  // We need to convert keyNode to a string, but doing so can hang the process
@@ -1416,7 +1572,10 @@
1416
1572
  throwError(state, 'nested arrays are not supported inside keys');
1417
1573
  }
1418
1574
 
1419
- if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
1575
+ if (
1576
+ typeof keyNode === 'object' &&
1577
+ _class(keyNode[index]) === '[object Object]'
1578
+ ) {
1420
1579
  keyNode[index] = '[object Object]';
1421
1580
  }
1422
1581
  }
@@ -1429,7 +1588,6 @@
1429
1588
  keyNode = '[object Object]';
1430
1589
  }
1431
1590
 
1432
-
1433
1591
  keyNode = String(keyNode);
1434
1592
 
1435
1593
  if (_result === null) {
@@ -1438,16 +1596,22 @@
1438
1596
 
1439
1597
  if (keyTag === 'tag:yaml.org,2002:merge') {
1440
1598
  if (Array.isArray(valueNode)) {
1441
- for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
1599
+ for (
1600
+ index = 0, quantity = valueNode.length;
1601
+ index < quantity;
1602
+ index += 1
1603
+ ) {
1442
1604
  mergeMappings(state, _result, valueNode[index], overridableKeys);
1443
1605
  }
1444
1606
  } else {
1445
1607
  mergeMappings(state, _result, valueNode, overridableKeys);
1446
1608
  }
1447
1609
  } else {
1448
- if (!state.json &&
1449
- !_hasOwnProperty$1.call(overridableKeys, keyNode) &&
1450
- _hasOwnProperty$1.call(_result, keyNode)) {
1610
+ if (
1611
+ !state.json &&
1612
+ !_hasOwnProperty$1.call(overridableKeys, keyNode) &&
1613
+ _hasOwnProperty$1.call(_result, keyNode)
1614
+ ) {
1451
1615
  state.line = startLine || state.line;
1452
1616
  state.lineStart = startLineStart || state.lineStart;
1453
1617
  state.position = startPos || state.position;
@@ -1460,7 +1624,7 @@
1460
1624
  configurable: true,
1461
1625
  enumerable: true,
1462
1626
  writable: true,
1463
- value: valueNode
1627
+ value: valueNode,
1464
1628
  });
1465
1629
  } else {
1466
1630
  _result[keyNode] = valueNode;
@@ -1472,15 +1636,15 @@
1472
1636
  }
1473
1637
 
1474
1638
  function readLineBreak(state) {
1475
- var ch;
1639
+ let ch;
1476
1640
 
1477
1641
  ch = state.input.charCodeAt(state.position);
1478
1642
 
1479
- if (ch === 0x0A/* LF */) {
1643
+ if (ch === 0x0a /* LF */) {
1480
1644
  state.position++;
1481
- } else if (ch === 0x0D/* CR */) {
1645
+ } else if (ch === 0x0d /* CR */) {
1482
1646
  state.position++;
1483
- if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
1647
+ if (state.input.charCodeAt(state.position) === 0x0a /* LF */) {
1484
1648
  state.position++;
1485
1649
  }
1486
1650
  } else {
@@ -1493,21 +1657,21 @@
1493
1657
  }
1494
1658
 
1495
1659
  function skipSeparationSpace(state, allowComments, checkIndent) {
1496
- var lineBreaks = 0,
1497
- ch = state.input.charCodeAt(state.position);
1660
+ let lineBreaks = 0;
1661
+ let ch = state.input.charCodeAt(state.position);
1498
1662
 
1499
1663
  while (ch !== 0) {
1500
1664
  while (is_WHITE_SPACE(ch)) {
1501
- if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {
1665
+ if (ch === 0x09 /* Tab */ && state.firstTabInLine === -1) {
1502
1666
  state.firstTabInLine = state.position;
1503
1667
  }
1504
1668
  ch = state.input.charCodeAt(++state.position);
1505
1669
  }
1506
1670
 
1507
- if (allowComments && ch === 0x23/* # */) {
1671
+ if (allowComments && ch === 0x23 /* # */) {
1508
1672
  do {
1509
1673
  ch = state.input.charCodeAt(++state.position);
1510
- } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
1674
+ } while (ch !== 0x0a /* LF */ && ch !== 0x0d /* CR */ && ch !== 0);
1511
1675
  }
1512
1676
 
1513
1677
  if (is_EOL(ch)) {
@@ -1517,7 +1681,7 @@
1517
1681
  lineBreaks++;
1518
1682
  state.lineIndent = 0;
1519
1683
 
1520
- while (ch === 0x20/* Space */) {
1684
+ while (ch === 0x20 /* Space */) {
1521
1685
  state.lineIndent++;
1522
1686
  ch = state.input.charCodeAt(++state.position);
1523
1687
  }
@@ -1526,7 +1690,11 @@
1526
1690
  }
1527
1691
  }
1528
1692
 
1529
- if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
1693
+ if (
1694
+ checkIndent !== -1 &&
1695
+ lineBreaks !== 0 &&
1696
+ state.lineIndent < checkIndent
1697
+ ) {
1530
1698
  throwWarning(state, 'deficient indentation');
1531
1699
  }
1532
1700
 
@@ -1534,17 +1702,18 @@
1534
1702
  }
1535
1703
 
1536
1704
  function testDocumentSeparator(state) {
1537
- var _position = state.position,
1538
- ch;
1705
+ let _position = state.position;
1706
+ let ch;
1539
1707
 
1540
1708
  ch = state.input.charCodeAt(_position);
1541
1709
 
1542
1710
  // Condition state.position === state.lineStart is tested
1543
1711
  // in parent on each call, for efficiency. No needs to test here again.
1544
- if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
1545
- ch === state.input.charCodeAt(_position + 1) &&
1546
- ch === state.input.charCodeAt(_position + 2)) {
1547
-
1712
+ if (
1713
+ (ch === 0x2d /* - */ || ch === 0x2e) /* . */ &&
1714
+ ch === state.input.charCodeAt(_position + 1) &&
1715
+ ch === state.input.charCodeAt(_position + 2)
1716
+ ) {
1548
1717
  _position += 3;
1549
1718
 
1550
1719
  ch = state.input.charCodeAt(_position);
@@ -1565,43 +1734,46 @@
1565
1734
  }
1566
1735
  }
1567
1736
 
1568
-
1569
1737
  function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1570
- var preceding,
1571
- following,
1572
- captureStart,
1573
- captureEnd,
1574
- hasPendingContent,
1575
- _line,
1576
- _lineStart,
1577
- _lineIndent,
1578
- _kind = state.kind,
1579
- _result = state.result,
1580
- ch;
1738
+ let preceding;
1739
+ let following;
1740
+ let captureStart;
1741
+ let captureEnd;
1742
+ let hasPendingContent;
1743
+ let _line;
1744
+ let _lineStart;
1745
+ let _lineIndent;
1746
+ const _kind = state.kind;
1747
+ const _result = state.result;
1748
+ let ch;
1581
1749
 
1582
1750
  ch = state.input.charCodeAt(state.position);
1583
1751
 
1584
- if (is_WS_OR_EOL(ch) ||
1585
- is_FLOW_INDICATOR(ch) ||
1586
- ch === 0x23/* # */ ||
1587
- ch === 0x26/* & */ ||
1588
- ch === 0x2A/* * */ ||
1589
- ch === 0x21/* ! */ ||
1590
- ch === 0x7C/* | */ ||
1591
- ch === 0x3E/* > */ ||
1592
- ch === 0x27/* ' */ ||
1593
- ch === 0x22/* " */ ||
1594
- ch === 0x25/* % */ ||
1595
- ch === 0x40/* @ */ ||
1596
- ch === 0x60/* ` */) {
1752
+ if (
1753
+ is_WS_OR_EOL(ch) ||
1754
+ is_FLOW_INDICATOR(ch) ||
1755
+ ch === 0x23 /* # */ ||
1756
+ ch === 0x26 /* & */ ||
1757
+ ch === 0x2a /* * */ ||
1758
+ ch === 0x21 /* ! */ ||
1759
+ ch === 0x7c /* | */ ||
1760
+ ch === 0x3e /* > */ ||
1761
+ ch === 0x27 /* ' */ ||
1762
+ ch === 0x22 /* " */ ||
1763
+ ch === 0x25 /* % */ ||
1764
+ ch === 0x40 /* @ */ ||
1765
+ ch === 0x60 /* ` */
1766
+ ) {
1597
1767
  return false;
1598
1768
  }
1599
1769
 
1600
- if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
1770
+ if (ch === 0x3f /* ? */ || ch === 0x2d /* - */) {
1601
1771
  following = state.input.charCodeAt(state.position + 1);
1602
1772
 
1603
- if (is_WS_OR_EOL(following) ||
1604
- withinFlowCollection && is_FLOW_INDICATOR(following)) {
1773
+ if (
1774
+ is_WS_OR_EOL(following) ||
1775
+ (withinFlowCollection && is_FLOW_INDICATOR(following))
1776
+ ) {
1605
1777
  return false;
1606
1778
  }
1607
1779
  }
@@ -1612,25 +1784,26 @@
1612
1784
  hasPendingContent = false;
1613
1785
 
1614
1786
  while (ch !== 0) {
1615
- if (ch === 0x3A/* : */) {
1787
+ if (ch === 0x3a /* : */) {
1616
1788
  following = state.input.charCodeAt(state.position + 1);
1617
1789
 
1618
- if (is_WS_OR_EOL(following) ||
1619
- withinFlowCollection && is_FLOW_INDICATOR(following)) {
1790
+ if (
1791
+ is_WS_OR_EOL(following) ||
1792
+ (withinFlowCollection && is_FLOW_INDICATOR(following))
1793
+ ) {
1620
1794
  break;
1621
1795
  }
1622
-
1623
- } else if (ch === 0x23/* # */) {
1796
+ } else if (ch === 0x23 /* # */) {
1624
1797
  preceding = state.input.charCodeAt(state.position - 1);
1625
1798
 
1626
1799
  if (is_WS_OR_EOL(preceding)) {
1627
1800
  break;
1628
1801
  }
1629
-
1630
- } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
1631
- withinFlowCollection && is_FLOW_INDICATOR(ch)) {
1802
+ } else if (
1803
+ (state.position === state.lineStart && testDocumentSeparator(state)) ||
1804
+ (withinFlowCollection && is_FLOW_INDICATOR(ch))
1805
+ ) {
1632
1806
  break;
1633
-
1634
1807
  } else if (is_EOL(ch)) {
1635
1808
  _line = state.line;
1636
1809
  _lineStart = state.lineStart;
@@ -1676,12 +1849,13 @@
1676
1849
  }
1677
1850
 
1678
1851
  function readSingleQuotedScalar(state, nodeIndent) {
1679
- var ch,
1680
- captureStart, captureEnd;
1852
+ let ch;
1853
+ let captureStart;
1854
+ let captureEnd;
1681
1855
 
1682
1856
  ch = state.input.charCodeAt(state.position);
1683
1857
 
1684
- if (ch !== 0x27/* ' */) {
1858
+ if (ch !== 0x27 /* ' */) {
1685
1859
  return false;
1686
1860
  }
1687
1861
 
@@ -1691,46 +1865,52 @@
1691
1865
  captureStart = captureEnd = state.position;
1692
1866
 
1693
1867
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1694
- if (ch === 0x27/* ' */) {
1868
+ if (ch === 0x27 /* ' */) {
1695
1869
  captureSegment(state, captureStart, state.position, true);
1696
1870
  ch = state.input.charCodeAt(++state.position);
1697
1871
 
1698
- if (ch === 0x27/* ' */) {
1872
+ if (ch === 0x27 /* ' */) {
1699
1873
  captureStart = state.position;
1700
1874
  state.position++;
1701
1875
  captureEnd = state.position;
1702
1876
  } else {
1703
1877
  return true;
1704
1878
  }
1705
-
1706
1879
  } else if (is_EOL(ch)) {
1707
1880
  captureSegment(state, captureStart, captureEnd, true);
1708
1881
  writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1709
1882
  captureStart = captureEnd = state.position;
1710
-
1711
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1712
- throwError(state, 'unexpected end of the document within a single quoted scalar');
1713
-
1883
+ } else if (
1884
+ state.position === state.lineStart &&
1885
+ testDocumentSeparator(state)
1886
+ ) {
1887
+ throwError(
1888
+ state,
1889
+ 'unexpected end of the document within a single quoted scalar'
1890
+ );
1714
1891
  } else {
1715
1892
  state.position++;
1716
1893
  captureEnd = state.position;
1717
1894
  }
1718
1895
  }
1719
1896
 
1720
- throwError(state, 'unexpected end of the stream within a single quoted scalar');
1897
+ throwError(
1898
+ state,
1899
+ 'unexpected end of the stream within a single quoted scalar'
1900
+ );
1721
1901
  }
1722
1902
 
1723
1903
  function readDoubleQuotedScalar(state, nodeIndent) {
1724
- var captureStart,
1725
- captureEnd,
1726
- hexLength,
1727
- hexResult,
1728
- tmp,
1729
- ch;
1904
+ let captureStart;
1905
+ let captureEnd;
1906
+ let hexLength;
1907
+ let hexResult;
1908
+ let tmp;
1909
+ let ch;
1730
1910
 
1731
1911
  ch = state.input.charCodeAt(state.position);
1732
1912
 
1733
- if (ch !== 0x22/* " */) {
1913
+ if (ch !== 0x22 /* " */) {
1734
1914
  return false;
1735
1915
  }
1736
1916
 
@@ -1740,12 +1920,11 @@
1740
1920
  captureStart = captureEnd = state.position;
1741
1921
 
1742
1922
  while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1743
- if (ch === 0x22/* " */) {
1923
+ if (ch === 0x22 /* " */) {
1744
1924
  captureSegment(state, captureStart, state.position, true);
1745
1925
  state.position++;
1746
1926
  return true;
1747
-
1748
- } else if (ch === 0x5C/* \ */) {
1927
+ } else if (ch === 0x5c /* \ */) {
1749
1928
  captureSegment(state, captureStart, state.position, true);
1750
1929
  ch = state.input.charCodeAt(++state.position);
1751
1930
 
@@ -1756,7 +1935,6 @@
1756
1935
  } else if (ch < 256 && simpleEscapeCheck[ch]) {
1757
1936
  state.result += simpleEscapeMap[ch];
1758
1937
  state.position++;
1759
-
1760
1938
  } else if ((tmp = escapedHexLen(ch)) > 0) {
1761
1939
  hexLength = tmp;
1762
1940
  hexResult = 0;
@@ -1766,7 +1944,6 @@
1766
1944
 
1767
1945
  if ((tmp = fromHexCode(ch)) >= 0) {
1768
1946
  hexResult = (hexResult << 4) + tmp;
1769
-
1770
1947
  } else {
1771
1948
  throwError(state, 'expected hexadecimal character');
1772
1949
  }
@@ -1775,57 +1952,62 @@
1775
1952
  state.result += charFromCodepoint(hexResult);
1776
1953
 
1777
1954
  state.position++;
1778
-
1779
1955
  } else {
1780
1956
  throwError(state, 'unknown escape sequence');
1781
1957
  }
1782
1958
 
1783
1959
  captureStart = captureEnd = state.position;
1784
-
1785
1960
  } else if (is_EOL(ch)) {
1786
1961
  captureSegment(state, captureStart, captureEnd, true);
1787
1962
  writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1788
1963
  captureStart = captureEnd = state.position;
1789
-
1790
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1791
- throwError(state, 'unexpected end of the document within a double quoted scalar');
1792
-
1964
+ } else if (
1965
+ state.position === state.lineStart &&
1966
+ testDocumentSeparator(state)
1967
+ ) {
1968
+ throwError(
1969
+ state,
1970
+ 'unexpected end of the document within a double quoted scalar'
1971
+ );
1793
1972
  } else {
1794
1973
  state.position++;
1795
1974
  captureEnd = state.position;
1796
1975
  }
1797
1976
  }
1798
1977
 
1799
- throwError(state, 'unexpected end of the stream within a double quoted scalar');
1978
+ throwError(
1979
+ state,
1980
+ 'unexpected end of the stream within a double quoted scalar'
1981
+ );
1800
1982
  }
1801
1983
 
1802
1984
  function readFlowCollection(state, nodeIndent) {
1803
- var readNext = true,
1804
- _line,
1805
- _lineStart,
1806
- _pos,
1807
- _tag = state.tag,
1808
- _result,
1809
- _anchor = state.anchor,
1810
- following,
1811
- terminator,
1812
- isPair,
1813
- isExplicitPair,
1814
- isMapping,
1815
- overridableKeys = Object.create(null),
1816
- keyNode,
1817
- keyTag,
1818
- valueNode,
1819
- ch;
1985
+ let readNext = true;
1986
+ let _line;
1987
+ let _lineStart;
1988
+ let _pos;
1989
+ const _tag = state.tag;
1990
+ let _result;
1991
+ const _anchor = state.anchor;
1992
+ let following;
1993
+ let terminator;
1994
+ let isPair;
1995
+ let isExplicitPair;
1996
+ let isMapping;
1997
+ const overridableKeys = Object.create(null);
1998
+ let keyNode;
1999
+ let keyTag;
2000
+ let valueNode;
2001
+ let ch;
1820
2002
 
1821
2003
  ch = state.input.charCodeAt(state.position);
1822
2004
 
1823
- if (ch === 0x5B/* [ */) {
1824
- terminator = 0x5D;/* ] */
2005
+ if (ch === 0x5b /* [ */) {
2006
+ terminator = 0x5d; /* ] */
1825
2007
  isMapping = false;
1826
2008
  _result = [];
1827
- } else if (ch === 0x7B/* { */) {
1828
- terminator = 0x7D;/* } */
2009
+ } else if (ch === 0x7b /* { */) {
2010
+ terminator = 0x7d; /* } */
1829
2011
  isMapping = true;
1830
2012
  _result = {};
1831
2013
  } else {
@@ -1852,7 +2034,7 @@
1852
2034
  return true;
1853
2035
  } else if (!readNext) {
1854
2036
  throwError(state, 'missed comma between flow collection entries');
1855
- } else if (ch === 0x2C/* , */) {
2037
+ } else if (ch === 0x2c /* , */) {
1856
2038
  // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4
1857
2039
  throwError(state, "expected the node content, but found ','");
1858
2040
  }
@@ -1860,7 +2042,7 @@
1860
2042
  keyTag = keyNode = valueNode = null;
1861
2043
  isPair = isExplicitPair = false;
1862
2044
 
1863
- if (ch === 0x3F/* ? */) {
2045
+ if (ch === 0x3f /* ? */) {
1864
2046
  following = state.input.charCodeAt(state.position + 1);
1865
2047
 
1866
2048
  if (is_WS_OR_EOL(following)) {
@@ -1880,7 +2062,7 @@
1880
2062
 
1881
2063
  ch = state.input.charCodeAt(state.position);
1882
2064
 
1883
- if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
2065
+ if ((isExplicitPair || state.line === _line) && ch === 0x3a /* : */) {
1884
2066
  isPair = true;
1885
2067
  ch = state.input.charCodeAt(++state.position);
1886
2068
  skipSeparationSpace(state, true, nodeIndent);
@@ -1889,9 +2071,31 @@
1889
2071
  }
1890
2072
 
1891
2073
  if (isMapping) {
1892
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
2074
+ storeMappingPair(
2075
+ state,
2076
+ _result,
2077
+ overridableKeys,
2078
+ keyTag,
2079
+ keyNode,
2080
+ valueNode,
2081
+ _line,
2082
+ _lineStart,
2083
+ _pos
2084
+ );
1893
2085
  } else if (isPair) {
1894
- _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
2086
+ _result.push(
2087
+ storeMappingPair(
2088
+ state,
2089
+ null,
2090
+ overridableKeys,
2091
+ keyTag,
2092
+ keyNode,
2093
+ valueNode,
2094
+ _line,
2095
+ _lineStart,
2096
+ _pos
2097
+ )
2098
+ );
1895
2099
  } else {
1896
2100
  _result.push(keyNode);
1897
2101
  }
@@ -1900,7 +2104,7 @@
1900
2104
 
1901
2105
  ch = state.input.charCodeAt(state.position);
1902
2106
 
1903
- if (ch === 0x2C/* , */) {
2107
+ if (ch === 0x2c /* , */) {
1904
2108
  readNext = true;
1905
2109
  ch = state.input.charCodeAt(++state.position);
1906
2110
  } else {
@@ -1912,22 +2116,22 @@
1912
2116
  }
1913
2117
 
1914
2118
  function readBlockScalar(state, nodeIndent) {
1915
- var captureStart,
1916
- folding,
1917
- chomping = CHOMPING_CLIP,
1918
- didReadContent = false,
1919
- detectedIndent = false,
1920
- textIndent = nodeIndent,
1921
- emptyLines = 0,
1922
- atMoreIndented = false,
1923
- tmp,
1924
- ch;
2119
+ let captureStart;
2120
+ let folding;
2121
+ let chomping = CHOMPING_CLIP;
2122
+ let didReadContent = false;
2123
+ let detectedIndent = false;
2124
+ let textIndent = nodeIndent;
2125
+ let emptyLines = 0;
2126
+ let atMoreIndented = false;
2127
+ let tmp;
2128
+ let ch;
1925
2129
 
1926
2130
  ch = state.input.charCodeAt(state.position);
1927
2131
 
1928
- if (ch === 0x7C/* | */) {
2132
+ if (ch === 0x7c /* | */) {
1929
2133
  folding = false;
1930
- } else if (ch === 0x3E/* > */) {
2134
+ } else if (ch === 0x3e /* > */) {
1931
2135
  folding = true;
1932
2136
  } else {
1933
2137
  return false;
@@ -1939,35 +2143,38 @@
1939
2143
  while (ch !== 0) {
1940
2144
  ch = state.input.charCodeAt(++state.position);
1941
2145
 
1942
- if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
2146
+ if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {
1943
2147
  if (CHOMPING_CLIP === chomping) {
1944
- chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
2148
+ chomping = ch === 0x2b /* + */ ? CHOMPING_KEEP : CHOMPING_STRIP;
1945
2149
  } else {
1946
2150
  throwError(state, 'repeat of a chomping mode identifier');
1947
2151
  }
1948
-
1949
2152
  } else if ((tmp = fromDecimalCode(ch)) >= 0) {
1950
2153
  if (tmp === 0) {
1951
- throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
2154
+ throwError(
2155
+ state,
2156
+ 'bad explicit indentation width of a block scalar; it cannot be less than one'
2157
+ );
1952
2158
  } else if (!detectedIndent) {
1953
2159
  textIndent = nodeIndent + tmp - 1;
1954
2160
  detectedIndent = true;
1955
2161
  } else {
1956
2162
  throwError(state, 'repeat of an indentation width identifier');
1957
2163
  }
1958
-
1959
2164
  } else {
1960
2165
  break;
1961
2166
  }
1962
2167
  }
1963
2168
 
1964
2169
  if (is_WHITE_SPACE(ch)) {
1965
- do { ch = state.input.charCodeAt(++state.position); }
1966
- while (is_WHITE_SPACE(ch));
2170
+ do {
2171
+ ch = state.input.charCodeAt(++state.position);
2172
+ } while (is_WHITE_SPACE(ch));
1967
2173
 
1968
- if (ch === 0x23/* # */) {
1969
- do { ch = state.input.charCodeAt(++state.position); }
1970
- while (!is_EOL(ch) && (ch !== 0));
2174
+ if (ch === 0x23 /* # */) {
2175
+ do {
2176
+ ch = state.input.charCodeAt(++state.position);
2177
+ } while (!is_EOL(ch) && ch !== 0);
1971
2178
  }
1972
2179
  }
1973
2180
 
@@ -1977,8 +2184,10 @@
1977
2184
 
1978
2185
  ch = state.input.charCodeAt(state.position);
1979
2186
 
1980
- while ((!detectedIndent || state.lineIndent < textIndent) &&
1981
- (ch === 0x20/* Space */)) {
2187
+ while (
2188
+ (!detectedIndent || state.lineIndent < textIndent) &&
2189
+ ch === 0x20 /* Space */
2190
+ ) {
1982
2191
  state.lineIndent++;
1983
2192
  ch = state.input.charCodeAt(++state.position);
1984
2193
  }
@@ -1994,12 +2203,15 @@
1994
2203
 
1995
2204
  // End of the scalar.
1996
2205
  if (state.lineIndent < textIndent) {
1997
-
1998
2206
  // Perform the chomping.
1999
2207
  if (chomping === CHOMPING_KEEP) {
2000
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
2208
+ state.result += common.repeat(
2209
+ '\n',
2210
+ didReadContent ? 1 + emptyLines : emptyLines
2211
+ );
2001
2212
  } else if (chomping === CHOMPING_CLIP) {
2002
- if (didReadContent) { // i.e. only if the scalar is not empty.
2213
+ if (didReadContent) {
2214
+ // i.e. only if the scalar is not empty.
2003
2215
  state.result += '\n';
2004
2216
  }
2005
2217
  }
@@ -2010,33 +2222,39 @@
2010
2222
 
2011
2223
  // Folded style: use fancy rules to handle line breaks.
2012
2224
  if (folding) {
2013
-
2014
2225
  // Lines starting with white space characters (more-indented lines) are not folded.
2015
2226
  if (is_WHITE_SPACE(ch)) {
2016
2227
  atMoreIndented = true;
2017
2228
  // except for the first content line (cf. Example 8.1)
2018
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
2229
+ state.result += common.repeat(
2230
+ '\n',
2231
+ didReadContent ? 1 + emptyLines : emptyLines
2232
+ );
2019
2233
 
2020
- // End of more-indented block.
2234
+ // End of more-indented block.
2021
2235
  } else if (atMoreIndented) {
2022
2236
  atMoreIndented = false;
2023
2237
  state.result += common.repeat('\n', emptyLines + 1);
2024
2238
 
2025
- // Just one line break - perceive as the same line.
2239
+ // Just one line break - perceive as the same line.
2026
2240
  } else if (emptyLines === 0) {
2027
- if (didReadContent) { // i.e. only if we have already read some scalar content.
2241
+ if (didReadContent) {
2242
+ // i.e. only if we have already read some scalar content.
2028
2243
  state.result += ' ';
2029
2244
  }
2030
2245
 
2031
- // Several line breaks - perceive as different lines.
2246
+ // Several line breaks - perceive as different lines.
2032
2247
  } else {
2033
2248
  state.result += common.repeat('\n', emptyLines);
2034
2249
  }
2035
2250
 
2036
- // Literal style: just add exact number of line breaks between content lines.
2251
+ // Literal style: just add exact number of line breaks between content lines.
2037
2252
  } else {
2038
2253
  // Keep all line breaks except the header line break.
2039
- state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
2254
+ state.result += common.repeat(
2255
+ '\n',
2256
+ didReadContent ? 1 + emptyLines : emptyLines
2257
+ );
2040
2258
  }
2041
2259
 
2042
2260
  didReadContent = true;
@@ -2044,7 +2262,7 @@
2044
2262
  emptyLines = 0;
2045
2263
  captureStart = state.position;
2046
2264
 
2047
- while (!is_EOL(ch) && (ch !== 0)) {
2265
+ while (!is_EOL(ch) && ch !== 0) {
2048
2266
  ch = state.input.charCodeAt(++state.position);
2049
2267
  }
2050
2268
 
@@ -2055,13 +2273,13 @@
2055
2273
  }
2056
2274
 
2057
2275
  function readBlockSequence(state, nodeIndent) {
2058
- var _line,
2059
- _tag = state.tag,
2060
- _anchor = state.anchor,
2061
- _result = [],
2062
- following,
2063
- detected = false,
2064
- ch;
2276
+ let _line;
2277
+ const _tag = state.tag;
2278
+ const _anchor = state.anchor;
2279
+ const _result = [];
2280
+ let following;
2281
+ let detected = false;
2282
+ let ch;
2065
2283
 
2066
2284
  // there is a leading tab before this token, so it can't be a block sequence/mapping;
2067
2285
  // it can still be flow sequence/mapping or a scalar
@@ -2079,7 +2297,7 @@
2079
2297
  throwError(state, 'tab characters must not be used in indentation');
2080
2298
  }
2081
2299
 
2082
- if (ch !== 0x2D/* - */) {
2300
+ if (ch !== 0x2d /* - */) {
2083
2301
  break;
2084
2302
  }
2085
2303
 
@@ -2107,7 +2325,7 @@
2107
2325
 
2108
2326
  ch = state.input.charCodeAt(state.position);
2109
2327
 
2110
- if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
2328
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
2111
2329
  throwError(state, 'bad indentation of a sequence entry');
2112
2330
  } else if (state.lineIndent < nodeIndent) {
2113
2331
  break;
@@ -2125,22 +2343,22 @@
2125
2343
  }
2126
2344
 
2127
2345
  function readBlockMapping(state, nodeIndent, flowIndent) {
2128
- var following,
2129
- allowCompact,
2130
- _line,
2131
- _keyLine,
2132
- _keyLineStart,
2133
- _keyPos,
2134
- _tag = state.tag,
2135
- _anchor = state.anchor,
2136
- _result = {},
2137
- overridableKeys = Object.create(null),
2138
- keyTag = null,
2139
- keyNode = null,
2140
- valueNode = null,
2141
- atExplicitKey = false,
2142
- detected = false,
2143
- ch;
2346
+ let following;
2347
+ let allowCompact;
2348
+ let _line;
2349
+ let _keyLine;
2350
+ let _keyLineStart;
2351
+ let _keyPos;
2352
+ const _tag = state.tag;
2353
+ const _anchor = state.anchor;
2354
+ const _result = {};
2355
+ const overridableKeys = Object.create(null);
2356
+ let keyTag = null;
2357
+ let keyNode = null;
2358
+ let valueNode = null;
2359
+ let atExplicitKey = false;
2360
+ let detected = false;
2361
+ let ch;
2144
2362
 
2145
2363
  // there is a leading tab before this token, so it can't be a block sequence/mapping;
2146
2364
  // it can still be flow sequence/mapping or a scalar
@@ -2165,33 +2383,46 @@
2165
2383
  // Explicit notation case. There are two separate blocks:
2166
2384
  // first for the key (denoted by "?") and second for the value (denoted by ":")
2167
2385
  //
2168
- if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
2169
-
2170
- if (ch === 0x3F/* ? */) {
2386
+ if (
2387
+ (ch === 0x3f /* ? */ || ch === 0x3a /*: */) &&
2388
+ is_WS_OR_EOL(following)
2389
+ ) {
2390
+ if (ch === 0x3f /* ? */) {
2171
2391
  if (atExplicitKey) {
2172
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2392
+ storeMappingPair(
2393
+ state,
2394
+ _result,
2395
+ overridableKeys,
2396
+ keyTag,
2397
+ keyNode,
2398
+ null,
2399
+ _keyLine,
2400
+ _keyLineStart,
2401
+ _keyPos
2402
+ );
2173
2403
  keyTag = keyNode = valueNode = null;
2174
2404
  }
2175
2405
 
2176
2406
  detected = true;
2177
2407
  atExplicitKey = true;
2178
2408
  allowCompact = true;
2179
-
2180
2409
  } else if (atExplicitKey) {
2181
2410
  // i.e. 0x3A/* : */ === character after the explicit key.
2182
2411
  atExplicitKey = false;
2183
2412
  allowCompact = true;
2184
-
2185
2413
  } else {
2186
- throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
2414
+ throwError(
2415
+ state,
2416
+ 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'
2417
+ );
2187
2418
  }
2188
2419
 
2189
2420
  state.position += 1;
2190
2421
  ch = following;
2191
2422
 
2192
- //
2193
- // Implicit notation case. Flow-style node as the key first, then ":", and the value.
2194
- //
2423
+ //
2424
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
2425
+ //
2195
2426
  } else {
2196
2427
  _keyLine = state.line;
2197
2428
  _keyLineStart = state.lineStart;
@@ -2210,15 +2441,28 @@
2210
2441
  ch = state.input.charCodeAt(++state.position);
2211
2442
  }
2212
2443
 
2213
- if (ch === 0x3A/* : */) {
2444
+ if (ch === 0x3a /* : */) {
2214
2445
  ch = state.input.charCodeAt(++state.position);
2215
2446
 
2216
2447
  if (!is_WS_OR_EOL(ch)) {
2217
- throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
2448
+ throwError(
2449
+ state,
2450
+ 'a whitespace character is expected after the key-value separator within a block mapping'
2451
+ );
2218
2452
  }
2219
2453
 
2220
2454
  if (atExplicitKey) {
2221
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2455
+ storeMappingPair(
2456
+ state,
2457
+ _result,
2458
+ overridableKeys,
2459
+ keyTag,
2460
+ keyNode,
2461
+ null,
2462
+ _keyLine,
2463
+ _keyLineStart,
2464
+ _keyPos
2465
+ );
2222
2466
  keyTag = keyNode = valueNode = null;
2223
2467
  }
2224
2468
 
@@ -2227,19 +2471,21 @@
2227
2471
  allowCompact = false;
2228
2472
  keyTag = state.tag;
2229
2473
  keyNode = state.result;
2230
-
2231
2474
  } else if (detected) {
2232
- throwError(state, 'can not read an implicit mapping pair; a colon is missed');
2233
-
2475
+ throwError(
2476
+ state,
2477
+ 'can not read an implicit mapping pair; a colon is missed'
2478
+ );
2234
2479
  } else {
2235
2480
  state.tag = _tag;
2236
2481
  state.anchor = _anchor;
2237
2482
  return true; // Keep the result of `composeNode`.
2238
2483
  }
2239
-
2240
2484
  } else if (detected) {
2241
- throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
2242
-
2485
+ throwError(
2486
+ state,
2487
+ 'can not read a block mapping entry; a multiline key may not be an implicit key'
2488
+ );
2243
2489
  } else {
2244
2490
  state.tag = _tag;
2245
2491
  state.anchor = _anchor;
@@ -2257,7 +2503,9 @@
2257
2503
  _keyPos = state.position;
2258
2504
  }
2259
2505
 
2260
- if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
2506
+ if (
2507
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)
2508
+ ) {
2261
2509
  if (atExplicitKey) {
2262
2510
  keyNode = state.result;
2263
2511
  } else {
@@ -2266,7 +2514,17 @@
2266
2514
  }
2267
2515
 
2268
2516
  if (!atExplicitKey) {
2269
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
2517
+ storeMappingPair(
2518
+ state,
2519
+ _result,
2520
+ overridableKeys,
2521
+ keyTag,
2522
+ keyNode,
2523
+ valueNode,
2524
+ _keyLine,
2525
+ _keyLineStart,
2526
+ _keyPos
2527
+ );
2270
2528
  keyTag = keyNode = valueNode = null;
2271
2529
  }
2272
2530
 
@@ -2274,7 +2532,7 @@
2274
2532
  ch = state.input.charCodeAt(state.position);
2275
2533
  }
2276
2534
 
2277
- if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
2535
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
2278
2536
  throwError(state, 'bad indentation of a mapping entry');
2279
2537
  } else if (state.lineIndent < nodeIndent) {
2280
2538
  break;
@@ -2287,7 +2545,17 @@
2287
2545
 
2288
2546
  // Special case: last mapping's node contains only the key in explicit notation.
2289
2547
  if (atExplicitKey) {
2290
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
2548
+ storeMappingPair(
2549
+ state,
2550
+ _result,
2551
+ overridableKeys,
2552
+ keyTag,
2553
+ keyNode,
2554
+ null,
2555
+ _keyLine,
2556
+ _keyLineStart,
2557
+ _keyPos
2558
+ );
2291
2559
  }
2292
2560
 
2293
2561
  // Expose the resulting mapping.
@@ -2302,16 +2570,16 @@
2302
2570
  }
2303
2571
 
2304
2572
  function readTagProperty(state) {
2305
- var _position,
2306
- isVerbatim = false,
2307
- isNamed = false,
2308
- tagHandle,
2309
- tagName,
2310
- ch;
2573
+ let _position;
2574
+ let isVerbatim = false;
2575
+ let isNamed = false;
2576
+ let tagHandle;
2577
+ let tagName;
2578
+ let ch;
2311
2579
 
2312
2580
  ch = state.input.charCodeAt(state.position);
2313
2581
 
2314
- if (ch !== 0x21/* ! */) return false;
2582
+ if (ch !== 0x21 /* ! */) return false;
2315
2583
 
2316
2584
  if (state.tag !== null) {
2317
2585
  throwError(state, 'duplication of a tag property');
@@ -2319,15 +2587,13 @@
2319
2587
 
2320
2588
  ch = state.input.charCodeAt(++state.position);
2321
2589
 
2322
- if (ch === 0x3C/* < */) {
2590
+ if (ch === 0x3c /* < */) {
2323
2591
  isVerbatim = true;
2324
2592
  ch = state.input.charCodeAt(++state.position);
2325
-
2326
- } else if (ch === 0x21/* ! */) {
2593
+ } else if (ch === 0x21 /* ! */) {
2327
2594
  isNamed = true;
2328
2595
  tagHandle = '!!';
2329
2596
  ch = state.input.charCodeAt(++state.position);
2330
-
2331
2597
  } else {
2332
2598
  tagHandle = '!';
2333
2599
  }
@@ -2335,8 +2601,9 @@
2335
2601
  _position = state.position;
2336
2602
 
2337
2603
  if (isVerbatim) {
2338
- do { ch = state.input.charCodeAt(++state.position); }
2339
- while (ch !== 0 && ch !== 0x3E/* > */);
2604
+ do {
2605
+ ch = state.input.charCodeAt(++state.position);
2606
+ } while (ch !== 0 && ch !== 0x3e /* > */);
2340
2607
 
2341
2608
  if (state.position < state.length) {
2342
2609
  tagName = state.input.slice(_position, state.position);
@@ -2346,13 +2613,15 @@
2346
2613
  }
2347
2614
  } else {
2348
2615
  while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2349
-
2350
- if (ch === 0x21/* ! */) {
2616
+ if (ch === 0x21 /* ! */) {
2351
2617
  if (!isNamed) {
2352
2618
  tagHandle = state.input.slice(_position - 1, state.position + 1);
2353
2619
 
2354
2620
  if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
2355
- throwError(state, 'named tag handle cannot contain such characters');
2621
+ throwError(
2622
+ state,
2623
+ 'named tag handle cannot contain such characters'
2624
+ );
2356
2625
  }
2357
2626
 
2358
2627
  isNamed = true;
@@ -2368,46 +2637,45 @@
2368
2637
  tagName = state.input.slice(_position, state.position);
2369
2638
 
2370
2639
  if (PATTERN_FLOW_INDICATORS.test(tagName)) {
2371
- throwError(state, 'tag suffix cannot contain flow indicator characters');
2640
+ throwError(
2641
+ state,
2642
+ 'tag suffix cannot contain flow indicator characters'
2643
+ );
2372
2644
  }
2373
2645
  }
2374
2646
 
2375
2647
  if (tagName && !PATTERN_TAG_URI.test(tagName)) {
2376
- throwError(state, 'tag name cannot contain such characters: ' + tagName);
2648
+ throwError(state, `tag name cannot contain such characters: ${tagName}`);
2377
2649
  }
2378
2650
 
2379
2651
  try {
2380
2652
  tagName = decodeURIComponent(tagName);
2381
2653
  } catch (err) {
2382
- throwError(state, 'tag name is malformed: ' + tagName);
2654
+ throwError(state, `tag name is malformed: ${tagName}`);
2383
2655
  }
2384
2656
 
2385
2657
  if (isVerbatim) {
2386
2658
  state.tag = tagName;
2387
-
2388
2659
  } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
2389
2660
  state.tag = state.tagMap[tagHandle] + tagName;
2390
-
2391
2661
  } else if (tagHandle === '!') {
2392
- state.tag = '!' + tagName;
2393
-
2662
+ state.tag = `!${tagName}`;
2394
2663
  } else if (tagHandle === '!!') {
2395
- state.tag = 'tag:yaml.org,2002:' + tagName;
2396
-
2664
+ state.tag = `tag:yaml.org,2002:${tagName}`;
2397
2665
  } else {
2398
- throwError(state, 'undeclared tag handle "' + tagHandle + '"');
2666
+ throwError(state, `undeclared tag handle "${tagHandle}"`);
2399
2667
  }
2400
2668
 
2401
2669
  return true;
2402
2670
  }
2403
2671
 
2404
2672
  function readAnchorProperty(state) {
2405
- var _position,
2406
- ch;
2673
+ let _position;
2674
+ let ch;
2407
2675
 
2408
2676
  ch = state.input.charCodeAt(state.position);
2409
2677
 
2410
- if (ch !== 0x26/* & */) return false;
2678
+ if (ch !== 0x26 /* & */) return false;
2411
2679
 
2412
2680
  if (state.anchor !== null) {
2413
2681
  throwError(state, 'duplication of an anchor property');
@@ -2421,7 +2689,10 @@
2421
2689
  }
2422
2690
 
2423
2691
  if (state.position === _position) {
2424
- throwError(state, 'name of an anchor node must contain at least one character');
2692
+ throwError(
2693
+ state,
2694
+ 'name of an anchor node must contain at least one character'
2695
+ );
2425
2696
  }
2426
2697
 
2427
2698
  state.anchor = state.input.slice(_position, state.position);
@@ -2429,12 +2700,13 @@
2429
2700
  }
2430
2701
 
2431
2702
  function readAlias(state) {
2432
- var _position, alias,
2433
- ch;
2703
+ let _position;
2704
+ let alias;
2705
+ let ch;
2434
2706
 
2435
2707
  ch = state.input.charCodeAt(state.position);
2436
2708
 
2437
- if (ch !== 0x2A/* * */) return false;
2709
+ if (ch !== 0x2a /* * */) return false;
2438
2710
 
2439
2711
  ch = state.input.charCodeAt(++state.position);
2440
2712
  _position = state.position;
@@ -2444,13 +2716,16 @@
2444
2716
  }
2445
2717
 
2446
2718
  if (state.position === _position) {
2447
- throwError(state, 'name of an alias node must contain at least one character');
2719
+ throwError(
2720
+ state,
2721
+ 'name of an alias node must contain at least one character'
2722
+ );
2448
2723
  }
2449
2724
 
2450
2725
  alias = state.input.slice(_position, state.position);
2451
2726
 
2452
2727
  if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
2453
- throwError(state, 'unidentified alias "' + alias + '"');
2728
+ throwError(state, `unidentified alias "${alias}"`);
2454
2729
  }
2455
2730
 
2456
2731
  state.result = state.anchorMap[alias];
@@ -2458,32 +2733,37 @@
2458
2733
  return true;
2459
2734
  }
2460
2735
 
2461
- function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
2462
- var allowBlockStyles,
2463
- allowBlockScalars,
2464
- allowBlockCollections,
2465
- indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
2466
- atNewLine = false,
2467
- hasContent = false,
2468
- typeIndex,
2469
- typeQuantity,
2470
- typeList,
2471
- type,
2472
- flowIndent,
2473
- blockIndent;
2736
+ function composeNode(
2737
+ state,
2738
+ parentIndent,
2739
+ nodeContext,
2740
+ allowToSeek,
2741
+ allowCompact
2742
+ ) {
2743
+ let allowBlockStyles;
2744
+ let allowBlockScalars;
2745
+ let allowBlockCollections;
2746
+ let indentStatus = 1; // 1: this>parent, 0: this=parent, -1: this<parent
2747
+ let atNewLine = false;
2748
+ let hasContent = false;
2749
+ let typeIndex;
2750
+ let typeQuantity;
2751
+ let typeList;
2752
+ let type;
2753
+ let flowIndent;
2754
+ let blockIndent;
2474
2755
 
2475
2756
  if (state.listener !== null) {
2476
2757
  state.listener('open', state);
2477
2758
  }
2478
2759
 
2479
- state.tag = null;
2760
+ state.tag = null;
2480
2761
  state.anchor = null;
2481
- state.kind = null;
2762
+ state.kind = null;
2482
2763
  state.result = null;
2483
2764
 
2484
2765
  allowBlockStyles = allowBlockScalars = allowBlockCollections =
2485
- CONTEXT_BLOCK_OUT === nodeContext ||
2486
- CONTEXT_BLOCK_IN === nodeContext;
2766
+ CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
2487
2767
 
2488
2768
  if (allowToSeek) {
2489
2769
  if (skipSeparationSpace(state, true, -1)) {
@@ -2532,25 +2812,29 @@
2532
2812
  blockIndent = state.position - state.lineStart;
2533
2813
 
2534
2814
  if (indentStatus === 1) {
2535
- if (allowBlockCollections &&
2815
+ if (
2816
+ (allowBlockCollections &&
2536
2817
  (readBlockSequence(state, blockIndent) ||
2537
- readBlockMapping(state, blockIndent, flowIndent)) ||
2538
- readFlowCollection(state, flowIndent)) {
2818
+ readBlockMapping(state, blockIndent, flowIndent))) ||
2819
+ readFlowCollection(state, flowIndent)
2820
+ ) {
2539
2821
  hasContent = true;
2540
2822
  } else {
2541
- if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
2542
- readSingleQuotedScalar(state, flowIndent) ||
2543
- readDoubleQuotedScalar(state, flowIndent)) {
2823
+ if (
2824
+ (allowBlockScalars && readBlockScalar(state, flowIndent)) ||
2825
+ readSingleQuotedScalar(state, flowIndent) ||
2826
+ readDoubleQuotedScalar(state, flowIndent)
2827
+ ) {
2544
2828
  hasContent = true;
2545
-
2546
2829
  } else if (readAlias(state)) {
2547
2830
  hasContent = true;
2548
2831
 
2549
2832
  if (state.tag !== null || state.anchor !== null) {
2550
2833
  throwError(state, 'alias node should not have any properties');
2551
2834
  }
2552
-
2553
- } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
2835
+ } else if (
2836
+ readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)
2837
+ ) {
2554
2838
  hasContent = true;
2555
2839
 
2556
2840
  if (state.tag === null) {
@@ -2565,7 +2849,8 @@
2565
2849
  } else if (indentStatus === 0) {
2566
2850
  // Special case: block sequences are allowed to have same indentation level as the parent.
2567
2851
  // http://www.yaml.org/spec/1.2/spec.html#id2799784
2568
- hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
2852
+ hasContent =
2853
+ allowBlockCollections && readBlockSequence(state, blockIndent);
2569
2854
  }
2570
2855
  }
2571
2856
 
@@ -2573,7 +2858,6 @@
2573
2858
  if (state.anchor !== null) {
2574
2859
  state.anchorMap[state.anchor] = state.result;
2575
2860
  }
2576
-
2577
2861
  } else if (state.tag === '?') {
2578
2862
  // Implicit resolving is not allowed for non-scalar types, and '?'
2579
2863
  // non-specific tag is only automatically assigned to plain scalars.
@@ -2582,13 +2866,21 @@
2582
2866
  // tag, for example like this: "!<?> [0]"
2583
2867
  //
2584
2868
  if (state.result !== null && state.kind !== 'scalar') {
2585
- throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
2869
+ throwError(
2870
+ state,
2871
+ `unacceptable node kind for !<?> tag; it should be "scalar", not "${state.kind}"`
2872
+ );
2586
2873
  }
2587
2874
 
2588
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
2875
+ for (
2876
+ typeIndex = 0, typeQuantity = state.implicitTypes.length;
2877
+ typeIndex < typeQuantity;
2878
+ typeIndex += 1
2879
+ ) {
2589
2880
  type = state.implicitTypes[typeIndex];
2590
2881
 
2591
- if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
2882
+ if (type.resolve(state.result)) {
2883
+ // `state.result` updated in resolver if matched
2592
2884
  state.result = type.construct(state.result);
2593
2885
  state.tag = type.tag;
2594
2886
  if (state.anchor !== null) {
@@ -2598,15 +2890,27 @@
2598
2890
  }
2599
2891
  }
2600
2892
  } else if (state.tag !== '!') {
2601
- if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
2893
+ if (
2894
+ _hasOwnProperty$1.call(
2895
+ state.typeMap[state.kind || 'fallback'],
2896
+ state.tag
2897
+ )
2898
+ ) {
2602
2899
  type = state.typeMap[state.kind || 'fallback'][state.tag];
2603
2900
  } else {
2604
2901
  // looking for multi type
2605
2902
  type = null;
2606
2903
  typeList = state.typeMap.multi[state.kind || 'fallback'];
2607
2904
 
2608
- for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
2609
- if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
2905
+ for (
2906
+ typeIndex = 0, typeQuantity = typeList.length;
2907
+ typeIndex < typeQuantity;
2908
+ typeIndex += 1
2909
+ ) {
2910
+ if (
2911
+ state.tag.slice(0, typeList[typeIndex].tag.length) ===
2912
+ typeList[typeIndex].tag
2913
+ ) {
2610
2914
  type = typeList[typeIndex];
2611
2915
  break;
2612
2916
  }
@@ -2614,15 +2918,22 @@
2614
2918
  }
2615
2919
 
2616
2920
  if (!type) {
2617
- throwError(state, 'unknown tag !<' + state.tag + '>');
2921
+ throwError(state, `unknown tag !<${state.tag}>`);
2618
2922
  }
2619
2923
 
2620
2924
  if (state.result !== null && type.kind !== state.kind) {
2621
- throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
2925
+ throwError(
2926
+ state,
2927
+ `unacceptable node kind for !<${state.tag}> tag; it should be "${type.kind}", not "${state.kind}"`
2928
+ );
2622
2929
  }
2623
2930
 
2624
- if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched
2625
- throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
2931
+ if (!type.resolve(state.result, state.tag)) {
2932
+ // `state.result` updated in resolver if matched
2933
+ throwError(
2934
+ state,
2935
+ `cannot resolve a node with !<${state.tag}> explicit tag`
2936
+ );
2626
2937
  } else {
2627
2938
  state.result = type.construct(state.result, state.tag);
2628
2939
  if (state.anchor !== null) {
@@ -2634,16 +2945,16 @@
2634
2945
  if (state.listener !== null) {
2635
2946
  state.listener('close', state);
2636
2947
  }
2637
- return state.tag !== null || state.anchor !== null || hasContent;
2948
+ return state.tag !== null || state.anchor !== null || hasContent;
2638
2949
  }
2639
2950
 
2640
2951
  function readDocument(state) {
2641
- var documentStart = state.position,
2642
- _position,
2643
- directiveName,
2644
- directiveArgs,
2645
- hasDirectives = false,
2646
- ch;
2952
+ const documentStart = state.position;
2953
+ let _position;
2954
+ let directiveName;
2955
+ let directiveArgs;
2956
+ let hasDirectives = false;
2957
+ let ch;
2647
2958
 
2648
2959
  state.version = null;
2649
2960
  state.checkLineBreaks = state.legacy;
@@ -2655,7 +2966,7 @@
2655
2966
 
2656
2967
  ch = state.input.charCodeAt(state.position);
2657
2968
 
2658
- if (state.lineIndent > 0 || ch !== 0x25/* % */) {
2969
+ if (state.lineIndent > 0 || ch !== 0x25 /* % */) {
2659
2970
  break;
2660
2971
  }
2661
2972
 
@@ -2671,7 +2982,10 @@
2671
2982
  directiveArgs = [];
2672
2983
 
2673
2984
  if (directiveName.length < 1) {
2674
- throwError(state, 'directive name must not be less than one character in length');
2985
+ throwError(
2986
+ state,
2987
+ 'directive name must not be less than one character in length'
2988
+ );
2675
2989
  }
2676
2990
 
2677
2991
  while (ch !== 0) {
@@ -2679,9 +2993,10 @@
2679
2993
  ch = state.input.charCodeAt(++state.position);
2680
2994
  }
2681
2995
 
2682
- if (ch === 0x23/* # */) {
2683
- do { ch = state.input.charCodeAt(++state.position); }
2684
- while (ch !== 0 && !is_EOL(ch));
2996
+ if (ch === 0x23 /* # */) {
2997
+ do {
2998
+ ch = state.input.charCodeAt(++state.position);
2999
+ } while (ch !== 0 && !is_EOL(ch));
2685
3000
  break;
2686
3001
  }
2687
3002
 
@@ -2701,19 +3016,20 @@
2701
3016
  if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
2702
3017
  directiveHandlers[directiveName](state, directiveName, directiveArgs);
2703
3018
  } else {
2704
- throwWarning(state, 'unknown document directive "' + directiveName + '"');
3019
+ throwWarning(state, `unknown document directive "${directiveName}"`);
2705
3020
  }
2706
3021
  }
2707
3022
 
2708
3023
  skipSeparationSpace(state, true, -1);
2709
3024
 
2710
- if (state.lineIndent === 0 &&
2711
- state.input.charCodeAt(state.position) === 0x2D/* - */ &&
2712
- state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
2713
- state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
3025
+ if (
3026
+ state.lineIndent === 0 &&
3027
+ state.input.charCodeAt(state.position) === 0x2d /* - */ &&
3028
+ state.input.charCodeAt(state.position + 1) === 0x2d /* - */ &&
3029
+ state.input.charCodeAt(state.position + 2) === 0x2d /* - */
3030
+ ) {
2714
3031
  state.position += 3;
2715
3032
  skipSeparationSpace(state, true, -1);
2716
-
2717
3033
  } else if (hasDirectives) {
2718
3034
  throwError(state, 'directives end mark is expected');
2719
3035
  }
@@ -2721,51 +3037,56 @@
2721
3037
  composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2722
3038
  skipSeparationSpace(state, true, -1);
2723
3039
 
2724
- if (state.checkLineBreaks &&
2725
- PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
3040
+ if (
3041
+ state.checkLineBreaks &&
3042
+ PATTERN_NON_ASCII_LINE_BREAKS.test(
3043
+ state.input.slice(documentStart, state.position)
3044
+ )
3045
+ ) {
2726
3046
  throwWarning(state, 'non-ASCII line breaks are interpreted as content');
2727
3047
  }
2728
3048
 
2729
3049
  state.documents.push(state.result);
2730
3050
 
2731
3051
  if (state.position === state.lineStart && testDocumentSeparator(state)) {
2732
-
2733
- if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
3052
+ if (state.input.charCodeAt(state.position) === 0x2e /* . */) {
2734
3053
  state.position += 3;
2735
3054
  skipSeparationSpace(state, true, -1);
2736
3055
  }
2737
3056
  return;
2738
3057
  }
2739
3058
 
2740
- if (state.position < (state.length - 1)) {
2741
- throwError(state, 'end of the stream or a document separator is expected');
3059
+ if (state.position < state.length - 1) {
3060
+ throwError(
3061
+ state,
3062
+ 'end of the stream or a document separator is expected'
3063
+ );
2742
3064
  } else {
2743
- return;
2744
3065
  }
2745
3066
  }
2746
3067
 
2747
-
2748
3068
  function loadDocuments(input, options) {
2749
3069
  input = String(input);
2750
3070
  options = options || {};
2751
3071
 
2752
3072
  if (input.length !== 0) {
2753
-
2754
3073
  // Add tailing `\n` if not exists
2755
- if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
2756
- input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
3074
+ if (
3075
+ input.charCodeAt(input.length - 1) !== 0x0a /* LF */ &&
3076
+ input.charCodeAt(input.length - 1) !== 0x0d /* CR */
3077
+ ) {
2757
3078
  input += '\n';
2758
3079
  }
2759
3080
 
2760
3081
  // Strip BOM
2761
- if (input.charCodeAt(0) === 0xFEFF) {
3082
+ if (input.charCodeAt(0) === 0xfeff) {
2762
3083
  input = input.slice(1);
2763
3084
  }
2764
3085
  }
2765
3086
 
2766
- var state = new State$1(input, options);
3087
+ const state = new State$1(input, options);
2767
3088
 
2768
- var nullpos = input.indexOf('\0');
3089
+ const nullpos = input.indexOf('\0');
2769
3090
 
2770
3091
  if (nullpos !== -1) {
2771
3092
  state.position = nullpos;
@@ -2775,120 +3096,139 @@
2775
3096
  // Use 0 as string terminator. That significantly simplifies bounds check.
2776
3097
  state.input += '\0';
2777
3098
 
2778
- while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
3099
+ while (state.input.charCodeAt(state.position) === 0x20 /* Space */) {
2779
3100
  state.lineIndent += 1;
2780
3101
  state.position += 1;
2781
3102
  }
2782
3103
 
2783
- while (state.position < (state.length - 1)) {
3104
+ while (state.position < state.length - 1) {
2784
3105
  readDocument(state);
2785
3106
  }
2786
3107
 
2787
3108
  return state.documents;
2788
3109
  }
2789
3110
 
2790
-
2791
3111
  function loadAll$1(input, iterator, options) {
2792
- if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
3112
+ if (
3113
+ iterator !== null &&
3114
+ typeof iterator === 'object' &&
3115
+ typeof options === 'undefined'
3116
+ ) {
2793
3117
  options = iterator;
2794
3118
  iterator = null;
2795
3119
  }
2796
3120
 
2797
- var documents = loadDocuments(input, options);
3121
+ const documents = loadDocuments(input, options);
2798
3122
 
2799
3123
  if (typeof iterator !== 'function') {
2800
3124
  return documents;
2801
3125
  }
2802
3126
 
2803
- for (var index = 0, length = documents.length; index < length; index += 1) {
3127
+ for (let index = 0, { length } = documents; index < length; index += 1) {
2804
3128
  iterator(documents[index]);
2805
3129
  }
2806
3130
  }
2807
3131
 
2808
-
2809
3132
  function load$1(input, options) {
2810
- var documents = loadDocuments(input, options);
3133
+ const documents = loadDocuments(input, options);
2811
3134
 
2812
3135
  if (documents.length === 0) {
2813
- /*eslint-disable no-undefined*/
3136
+ /* eslint-disable no-undefined */
2814
3137
  return undefined;
2815
3138
  } else if (documents.length === 1) {
2816
3139
  return documents[0];
2817
3140
  }
2818
- throw new exception('expected a single document in the stream, but found more');
3141
+ throw new exception(
3142
+ 'expected a single document in the stream, but found more'
3143
+ );
2819
3144
  }
2820
3145
 
3146
+ const loadAll_1 = loadAll$1;
3147
+ const load_1 = load$1;
2821
3148
 
2822
- var loadAll_1 = loadAll$1;
2823
- var load_1 = load$1;
2824
-
2825
- var loader = {
2826
- loadAll: loadAll_1,
2827
- load: load_1
3149
+ const loader = {
3150
+ loadAll: loadAll_1,
3151
+ load: load_1,
2828
3152
  };
2829
3153
 
2830
- /*eslint-disable no-use-before-define*/
2831
-
2832
-
2833
-
2834
-
2835
-
2836
- var _toString = Object.prototype.toString;
2837
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
2838
-
2839
- var CHAR_BOM = 0xFEFF;
2840
- var CHAR_TAB = 0x09; /* Tab */
2841
- var CHAR_LINE_FEED = 0x0A; /* LF */
2842
- var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
2843
- var CHAR_SPACE = 0x20; /* Space */
2844
- var CHAR_EXCLAMATION = 0x21; /* ! */
2845
- var CHAR_DOUBLE_QUOTE = 0x22; /* " */
2846
- var CHAR_SHARP = 0x23; /* # */
2847
- var CHAR_PERCENT = 0x25; /* % */
2848
- var CHAR_AMPERSAND = 0x26; /* & */
2849
- var CHAR_SINGLE_QUOTE = 0x27; /* ' */
2850
- var CHAR_ASTERISK = 0x2A; /* * */
2851
- var CHAR_COMMA = 0x2C; /* , */
2852
- var CHAR_MINUS = 0x2D; /* - */
2853
- var CHAR_COLON = 0x3A; /* : */
2854
- var CHAR_EQUALS = 0x3D; /* = */
2855
- var CHAR_GREATER_THAN = 0x3E; /* > */
2856
- var CHAR_QUESTION = 0x3F; /* ? */
2857
- var CHAR_COMMERCIAL_AT = 0x40; /* @ */
2858
- var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
2859
- var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
2860
- var CHAR_GRAVE_ACCENT = 0x60; /* ` */
2861
- var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
2862
- var CHAR_VERTICAL_LINE = 0x7C; /* | */
2863
- var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
2864
-
2865
- var ESCAPE_SEQUENCES = {};
2866
-
2867
- ESCAPE_SEQUENCES[0x00] = '\\0';
2868
- ESCAPE_SEQUENCES[0x07] = '\\a';
2869
- ESCAPE_SEQUENCES[0x08] = '\\b';
2870
- ESCAPE_SEQUENCES[0x09] = '\\t';
2871
- ESCAPE_SEQUENCES[0x0A] = '\\n';
2872
- ESCAPE_SEQUENCES[0x0B] = '\\v';
2873
- ESCAPE_SEQUENCES[0x0C] = '\\f';
2874
- ESCAPE_SEQUENCES[0x0D] = '\\r';
2875
- ESCAPE_SEQUENCES[0x1B] = '\\e';
2876
- ESCAPE_SEQUENCES[0x22] = '\\"';
2877
- ESCAPE_SEQUENCES[0x5C] = '\\\\';
2878
- ESCAPE_SEQUENCES[0x85] = '\\N';
2879
- ESCAPE_SEQUENCES[0xA0] = '\\_';
3154
+ /* eslint-disable no-use-before-define */
3155
+
3156
+ const _toString = Object.prototype.toString;
3157
+ const _hasOwnProperty = Object.prototype.hasOwnProperty;
3158
+
3159
+ const CHAR_BOM = 0xfeff;
3160
+ const CHAR_TAB = 0x09; /* Tab */
3161
+ const CHAR_LINE_FEED = 0x0a; /* LF */
3162
+ const CHAR_CARRIAGE_RETURN = 0x0d; /* CR */
3163
+ const CHAR_SPACE = 0x20; /* Space */
3164
+ const CHAR_EXCLAMATION = 0x21; /* ! */
3165
+ const CHAR_DOUBLE_QUOTE = 0x22; /* " */
3166
+ const CHAR_SHARP = 0x23; /* # */
3167
+ const CHAR_PERCENT = 0x25; /* % */
3168
+ const CHAR_AMPERSAND = 0x26; /* & */
3169
+ const CHAR_SINGLE_QUOTE = 0x27; /* ' */
3170
+ const CHAR_ASTERISK = 0x2a; /* * */
3171
+ const CHAR_COMMA = 0x2c; /* , */
3172
+ const CHAR_MINUS = 0x2d; /* - */
3173
+ const CHAR_COLON = 0x3a; /* : */
3174
+ const CHAR_EQUALS = 0x3d; /* = */
3175
+ const CHAR_GREATER_THAN = 0x3e; /* > */
3176
+ const CHAR_QUESTION = 0x3f; /* ? */
3177
+ const CHAR_COMMERCIAL_AT = 0x40; /* @ */
3178
+ const CHAR_LEFT_SQUARE_BRACKET = 0x5b; /* [ */
3179
+ const CHAR_RIGHT_SQUARE_BRACKET = 0x5d; /* ] */
3180
+ const CHAR_GRAVE_ACCENT = 0x60; /* ` */
3181
+ const CHAR_LEFT_CURLY_BRACKET = 0x7b; /* { */
3182
+ const CHAR_VERTICAL_LINE = 0x7c; /* | */
3183
+ const CHAR_RIGHT_CURLY_BRACKET = 0x7d; /* } */
3184
+
3185
+ const ESCAPE_SEQUENCES = {};
3186
+
3187
+ ESCAPE_SEQUENCES[0x00] = '\\0';
3188
+ ESCAPE_SEQUENCES[0x07] = '\\a';
3189
+ ESCAPE_SEQUENCES[0x08] = '\\b';
3190
+ ESCAPE_SEQUENCES[0x09] = '\\t';
3191
+ ESCAPE_SEQUENCES[0x0a] = '\\n';
3192
+ ESCAPE_SEQUENCES[0x0b] = '\\v';
3193
+ ESCAPE_SEQUENCES[0x0c] = '\\f';
3194
+ ESCAPE_SEQUENCES[0x0d] = '\\r';
3195
+ ESCAPE_SEQUENCES[0x1b] = '\\e';
3196
+ ESCAPE_SEQUENCES[0x22] = '\\"';
3197
+ ESCAPE_SEQUENCES[0x5c] = '\\\\';
3198
+ ESCAPE_SEQUENCES[0x85] = '\\N';
3199
+ ESCAPE_SEQUENCES[0xa0] = '\\_';
2880
3200
  ESCAPE_SEQUENCES[0x2028] = '\\L';
2881
3201
  ESCAPE_SEQUENCES[0x2029] = '\\P';
2882
3202
 
2883
- var DEPRECATED_BOOLEANS_SYNTAX = [
2884
- 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
2885
- 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
3203
+ const DEPRECATED_BOOLEANS_SYNTAX = [
3204
+ 'y',
3205
+ 'Y',
3206
+ 'yes',
3207
+ 'Yes',
3208
+ 'YES',
3209
+ 'on',
3210
+ 'On',
3211
+ 'ON',
3212
+ 'n',
3213
+ 'N',
3214
+ 'no',
3215
+ 'No',
3216
+ 'NO',
3217
+ 'off',
3218
+ 'Off',
3219
+ 'OFF',
2886
3220
  ];
2887
3221
 
2888
- var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
3222
+ const DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
2889
3223
 
2890
3224
  function compileStyleMap(schema, map) {
2891
- var result, keys, index, length, tag, style, type;
3225
+ let result;
3226
+ let keys;
3227
+ let index;
3228
+ let length;
3229
+ let tag;
3230
+ let style;
3231
+ let type;
2892
3232
 
2893
3233
  if (map === null) return {};
2894
3234
 
@@ -2900,9 +3240,9 @@
2900
3240
  style = String(map[tag]);
2901
3241
 
2902
3242
  if (tag.slice(0, 2) === '!!') {
2903
- tag = 'tag:yaml.org,2002:' + tag.slice(2);
3243
+ tag = `tag:yaml.org,2002:${tag.slice(2)}`;
2904
3244
  }
2905
- type = schema.compiledTypeMap['fallback'][tag];
3245
+ type = schema.compiledTypeMap.fallback[tag];
2906
3246
 
2907
3247
  if (type && _hasOwnProperty.call(type.styleAliases, style)) {
2908
3248
  style = type.styleAliases[style];
@@ -2915,45 +3255,52 @@
2915
3255
  }
2916
3256
 
2917
3257
  function encodeHex(character) {
2918
- var string, handle, length;
3258
+ let string;
3259
+ let handle;
3260
+ let length;
2919
3261
 
2920
3262
  string = character.toString(16).toUpperCase();
2921
3263
 
2922
- if (character <= 0xFF) {
3264
+ if (character <= 0xff) {
2923
3265
  handle = 'x';
2924
3266
  length = 2;
2925
- } else if (character <= 0xFFFF) {
3267
+ } else if (character <= 0xffff) {
2926
3268
  handle = 'u';
2927
3269
  length = 4;
2928
- } else if (character <= 0xFFFFFFFF) {
3270
+ } else if (character <= 0xffffffff) {
2929
3271
  handle = 'U';
2930
3272
  length = 8;
2931
3273
  } else {
2932
- throw new exception('code point within a string may not be greater than 0xFFFFFFFF');
3274
+ throw new exception(
3275
+ 'code point within a string may not be greater than 0xFFFFFFFF'
3276
+ );
2933
3277
  }
2934
3278
 
2935
- return '\\' + handle + common.repeat('0', length - string.length) + string;
3279
+ return `\\${handle}${common.repeat('0', length - string.length)}${string}`;
2936
3280
  }
2937
3281
 
2938
-
2939
- var QUOTING_TYPE_SINGLE = 1,
2940
- QUOTING_TYPE_DOUBLE = 2;
3282
+ const QUOTING_TYPE_SINGLE = 1;
3283
+ const QUOTING_TYPE_DOUBLE = 2;
2941
3284
 
2942
3285
  function State(options) {
2943
- this.schema = options['schema'] || _default;
2944
- this.indent = Math.max(1, (options['indent'] || 2));
2945
- this.noArrayIndent = options['noArrayIndent'] || false;
2946
- this.skipInvalid = options['skipInvalid'] || false;
2947
- this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
2948
- this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
2949
- this.sortKeys = options['sortKeys'] || false;
2950
- this.lineWidth = options['lineWidth'] || 80;
2951
- this.noRefs = options['noRefs'] || false;
2952
- this.noCompatMode = options['noCompatMode'] || false;
2953
- this.condenseFlow = options['condenseFlow'] || false;
2954
- this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
2955
- this.forceQuotes = options['forceQuotes'] || false;
2956
- this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;
3286
+ this.schema = options.schema || _default;
3287
+ this.indent = Math.max(1, options.indent || 2);
3288
+ this.noArrayIndent = options.noArrayIndent || false;
3289
+ this.skipInvalid = options.skipInvalid || false;
3290
+ this.flowLevel = common.isNothing(options.flowLevel)
3291
+ ? -1
3292
+ : options.flowLevel;
3293
+ this.styleMap = compileStyleMap(this.schema, options.styles || null);
3294
+ this.sortKeys = options.sortKeys || false;
3295
+ this.lineWidth = options.lineWidth || 80;
3296
+ this.noRefs = options.noRefs || false;
3297
+ this.noCompatMode = options.noCompatMode || false;
3298
+ this.condenseFlow = options.condenseFlow || false;
3299
+ this.quotingType =
3300
+ options.quotingType === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
3301
+ this.forceQuotes = options.forceQuotes || false;
3302
+ this.replacer =
3303
+ typeof options.replacer === 'function' ? options.replacer : null;
2957
3304
 
2958
3305
  this.implicitTypes = this.schema.compiledImplicit;
2959
3306
  this.explicitTypes = this.schema.compiledExplicit;
@@ -2967,12 +3314,12 @@
2967
3314
 
2968
3315
  // Indents every line in a string. Empty lines (\n only) are not indented.
2969
3316
  function indentString(string, spaces) {
2970
- var ind = common.repeat(' ', spaces),
2971
- position = 0,
2972
- next = -1,
2973
- result = '',
2974
- line,
2975
- length = string.length;
3317
+ const ind = common.repeat(' ', spaces);
3318
+ let position = 0;
3319
+ let next = -1;
3320
+ let result = '';
3321
+ let line;
3322
+ const { length } = string;
2976
3323
 
2977
3324
  while (position < length) {
2978
3325
  next = string.indexOf('\n', position);
@@ -2993,13 +3340,19 @@
2993
3340
  }
2994
3341
 
2995
3342
  function generateNextLine(state, level) {
2996
- return '\n' + common.repeat(' ', state.indent * level);
3343
+ return `\n${common.repeat(' ', state.indent * level)}`;
2997
3344
  }
2998
3345
 
2999
3346
  function testImplicitResolving(state, str) {
3000
- var index, length, type;
3001
-
3002
- for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
3347
+ let index;
3348
+ let length;
3349
+ let type;
3350
+
3351
+ for (
3352
+ index = 0, length = state.implicitTypes.length;
3353
+ index < length;
3354
+ index += 1
3355
+ ) {
3003
3356
  type = state.implicitTypes[index];
3004
3357
 
3005
3358
  if (type.resolve(str)) {
@@ -3020,10 +3373,12 @@
3020
3373
  // should also be escaped. [However,] This isn’t mandatory"
3021
3374
  // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
3022
3375
  function isPrintable(c) {
3023
- return (0x00020 <= c && c <= 0x00007E)
3024
- || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
3025
- || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)
3026
- || (0x10000 <= c && c <= 0x10FFFF);
3376
+ return (
3377
+ (c >= 0x00020 && c <= 0x00007e) ||
3378
+ (c >= 0x000a1 && c <= 0x00d7ff && c !== 0x2028 && c !== 0x2029) ||
3379
+ (c >= 0x0e000 && c <= 0x00fffd && c !== CHAR_BOM) ||
3380
+ (c >= 0x10000 && c <= 0x10ffff)
3381
+ );
3027
3382
  }
3028
3383
 
3029
3384
  // [34] ns-char ::= nb-char - s-white
@@ -3032,11 +3387,13 @@
3032
3387
  // Including s-white (for some reason, examples doesn't match specs in this aspect)
3033
3388
  // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark
3034
3389
  function isNsCharOrWhitespace(c) {
3035
- return isPrintable(c)
3036
- && c !== CHAR_BOM
3390
+ return (
3391
+ isPrintable(c) &&
3392
+ c !== CHAR_BOM &&
3037
3393
  // - b-char
3038
- && c !== CHAR_CARRIAGE_RETURN
3039
- && c !== CHAR_LINE_FEED;
3394
+ c !== CHAR_CARRIAGE_RETURN &&
3395
+ c !== CHAR_LINE_FEED
3396
+ );
3040
3397
  }
3041
3398
 
3042
3399
  // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out
@@ -3049,25 +3406,25 @@
3049
3406
  // | ( /* An ns-char preceding */ “#” )
3050
3407
  // | ( “:” /* Followed by an ns-plain-safe(c) */ )
3051
3408
  function isPlainSafe(c, prev, inblock) {
3052
- var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
3053
- var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
3409
+ const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
3410
+ const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
3054
3411
  return (
3055
3412
  // ns-plain-safe
3056
- inblock ? // c = flow-in
3057
- cIsNsCharOrWhitespace
3058
- : cIsNsCharOrWhitespace
3413
+ ((inblock // c = flow-in
3414
+ ? cIsNsCharOrWhitespace
3415
+ : cIsNsCharOrWhitespace &&
3059
3416
  // - c-flow-indicator
3060
- && c !== CHAR_COMMA
3061
- && c !== CHAR_LEFT_SQUARE_BRACKET
3062
- && c !== CHAR_RIGHT_SQUARE_BRACKET
3063
- && c !== CHAR_LEFT_CURLY_BRACKET
3064
- && c !== CHAR_RIGHT_CURLY_BRACKET
3065
- )
3417
+ c !== CHAR_COMMA &&
3418
+ c !== CHAR_LEFT_SQUARE_BRACKET &&
3419
+ c !== CHAR_RIGHT_SQUARE_BRACKET &&
3420
+ c !== CHAR_LEFT_CURLY_BRACKET &&
3421
+ c !== CHAR_RIGHT_CURLY_BRACKET) &&
3066
3422
  // ns-plain-char
3067
- && c !== CHAR_SHARP // false on '#'
3068
- && !(prev === CHAR_COLON && !cIsNsChar) // false on ': '
3069
- || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'
3070
- || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'
3423
+ c !== CHAR_SHARP && // false on '#'
3424
+ !(prev === CHAR_COLON && !cIsNsChar)) || // false on ': '
3425
+ (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) || // change to true on '[^ ]#'
3426
+ (prev === CHAR_COLON && cIsNsChar)
3427
+ ); // change to true on ':[^ ]'
3071
3428
  }
3072
3429
 
3073
3430
  // Simplified test for values allowed as the first character in plain style.
@@ -3075,32 +3432,35 @@
3075
3432
  // Uses a subset of ns-char - c-indicator
3076
3433
  // where ns-char = nb-char - s-white.
3077
3434
  // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part
3078
- return isPrintable(c) && c !== CHAR_BOM
3079
- && !isWhitespace(c) // - s-white
3435
+ return (
3436
+ isPrintable(c) &&
3437
+ c !== CHAR_BOM &&
3438
+ !isWhitespace(c) && // - s-white
3080
3439
  // - (c-indicator ::=
3081
3440
  // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
3082
- && c !== CHAR_MINUS
3083
- && c !== CHAR_QUESTION
3084
- && c !== CHAR_COLON
3085
- && c !== CHAR_COMMA
3086
- && c !== CHAR_LEFT_SQUARE_BRACKET
3087
- && c !== CHAR_RIGHT_SQUARE_BRACKET
3088
- && c !== CHAR_LEFT_CURLY_BRACKET
3089
- && c !== CHAR_RIGHT_CURLY_BRACKET
3441
+ c !== CHAR_MINUS &&
3442
+ c !== CHAR_QUESTION &&
3443
+ c !== CHAR_COLON &&
3444
+ c !== CHAR_COMMA &&
3445
+ c !== CHAR_LEFT_SQUARE_BRACKET &&
3446
+ c !== CHAR_RIGHT_SQUARE_BRACKET &&
3447
+ c !== CHAR_LEFT_CURLY_BRACKET &&
3448
+ c !== CHAR_RIGHT_CURLY_BRACKET &&
3090
3449
  // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
3091
- && c !== CHAR_SHARP
3092
- && c !== CHAR_AMPERSAND
3093
- && c !== CHAR_ASTERISK
3094
- && c !== CHAR_EXCLAMATION
3095
- && c !== CHAR_VERTICAL_LINE
3096
- && c !== CHAR_EQUALS
3097
- && c !== CHAR_GREATER_THAN
3098
- && c !== CHAR_SINGLE_QUOTE
3099
- && c !== CHAR_DOUBLE_QUOTE
3450
+ c !== CHAR_SHARP &&
3451
+ c !== CHAR_AMPERSAND &&
3452
+ c !== CHAR_ASTERISK &&
3453
+ c !== CHAR_EXCLAMATION &&
3454
+ c !== CHAR_VERTICAL_LINE &&
3455
+ c !== CHAR_EQUALS &&
3456
+ c !== CHAR_GREATER_THAN &&
3457
+ c !== CHAR_SINGLE_QUOTE &&
3458
+ c !== CHAR_DOUBLE_QUOTE &&
3100
3459
  // | “%” | “@” | “`”)
3101
- && c !== CHAR_PERCENT
3102
- && c !== CHAR_COMMERCIAL_AT
3103
- && c !== CHAR_GRAVE_ACCENT;
3460
+ c !== CHAR_PERCENT &&
3461
+ c !== CHAR_COMMERCIAL_AT &&
3462
+ c !== CHAR_GRAVE_ACCENT
3463
+ );
3104
3464
  }
3105
3465
 
3106
3466
  // Simplified test for values allowed as the last character in plain style.
@@ -3111,12 +3471,13 @@
3111
3471
 
3112
3472
  // Same as 'string'.codePointAt(pos), but works in older browsers.
3113
3473
  function codePointAt(string, pos) {
3114
- var first = string.charCodeAt(pos), second;
3115
- if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {
3474
+ const first = string.charCodeAt(pos);
3475
+ let second;
3476
+ if (first >= 0xd800 && first <= 0xdbff && pos + 1 < string.length) {
3116
3477
  second = string.charCodeAt(pos + 1);
3117
- if (second >= 0xDC00 && second <= 0xDFFF) {
3478
+ if (second >= 0xdc00 && second <= 0xdfff) {
3118
3479
  // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
3119
- return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
3480
+ return (first - 0xd800) * 0x400 + second - 0xdc00 + 0x10000;
3120
3481
  }
3121
3482
  }
3122
3483
  return first;
@@ -3124,15 +3485,15 @@
3124
3485
 
3125
3486
  // Determines whether block indentation indicator is required.
3126
3487
  function needIndentIndicator(string) {
3127
- var leadingSpaceRe = /^\n* /;
3488
+ const leadingSpaceRe = /^\n* /;
3128
3489
  return leadingSpaceRe.test(string);
3129
3490
  }
3130
3491
 
3131
- var STYLE_PLAIN = 1,
3132
- STYLE_SINGLE = 2,
3133
- STYLE_LITERAL = 3,
3134
- STYLE_FOLDED = 4,
3135
- STYLE_DOUBLE = 5;
3492
+ const STYLE_PLAIN = 1;
3493
+ const STYLE_SINGLE = 2;
3494
+ const STYLE_LITERAL = 3;
3495
+ const STYLE_FOLDED = 4;
3496
+ const STYLE_DOUBLE = 5;
3136
3497
 
3137
3498
  // Determines which scalar styles are possible and returns the preferred style.
3138
3499
  // lineWidth = -1 => no limit.
@@ -3141,23 +3502,31 @@
3141
3502
  // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
3142
3503
  // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
3143
3504
  // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
3144
- function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,
3145
- testAmbiguousType, quotingType, forceQuotes, inblock) {
3146
-
3147
- var i;
3148
- var char = 0;
3149
- var prevChar = null;
3150
- var hasLineBreak = false;
3151
- var hasFoldableLine = false; // only checked if shouldTrackWidth
3152
- var shouldTrackWidth = lineWidth !== -1;
3153
- var previousLineBreak = -1; // count the first line correctly
3154
- var plain = isPlainSafeFirst(codePointAt(string, 0))
3155
- && isPlainSafeLast(codePointAt(string, string.length - 1));
3505
+ function chooseScalarStyle(
3506
+ string,
3507
+ singleLineOnly,
3508
+ indentPerLevel,
3509
+ lineWidth,
3510
+ testAmbiguousType,
3511
+ quotingType,
3512
+ forceQuotes,
3513
+ inblock
3514
+ ) {
3515
+ let i;
3516
+ let char = 0;
3517
+ let prevChar = null;
3518
+ let hasLineBreak = false;
3519
+ let hasFoldableLine = false; // only checked if shouldTrackWidth
3520
+ const shouldTrackWidth = lineWidth !== -1;
3521
+ let previousLineBreak = -1; // count the first line correctly
3522
+ let plain =
3523
+ isPlainSafeFirst(codePointAt(string, 0)) &&
3524
+ isPlainSafeLast(codePointAt(string, string.length - 1));
3156
3525
 
3157
3526
  if (singleLineOnly || forceQuotes) {
3158
3527
  // Case: no block styles.
3159
3528
  // Check for disallowed characters to rule out plain and single.
3160
- for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
3529
+ for (i = 0; i < string.length; char >= 0x10000 ? (i += 2) : i++) {
3161
3530
  char = codePointAt(string, i);
3162
3531
  if (!isPrintable(char)) {
3163
3532
  return STYLE_DOUBLE;
@@ -3167,16 +3536,17 @@
3167
3536
  }
3168
3537
  } else {
3169
3538
  // Case: block styles permitted.
3170
- for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
3539
+ for (i = 0; i < string.length; char >= 0x10000 ? (i += 2) : i++) {
3171
3540
  char = codePointAt(string, i);
3172
3541
  if (char === CHAR_LINE_FEED) {
3173
3542
  hasLineBreak = true;
3174
3543
  // Check if any line can be folded.
3175
3544
  if (shouldTrackWidth) {
3176
- hasFoldableLine = hasFoldableLine ||
3545
+ hasFoldableLine =
3546
+ hasFoldableLine ||
3177
3547
  // Foldable line = too long, and not more-indented.
3178
3548
  (i - previousLineBreak - 1 > lineWidth &&
3179
- string[previousLineBreak + 1] !== ' ');
3549
+ string[previousLineBreak + 1] !== ' ');
3180
3550
  previousLineBreak = i;
3181
3551
  }
3182
3552
  } else if (!isPrintable(char)) {
@@ -3186,9 +3556,11 @@
3186
3556
  prevChar = char;
3187
3557
  }
3188
3558
  // in case the end is missing a \n
3189
- hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
3190
- (i - previousLineBreak - 1 > lineWidth &&
3191
- string[previousLineBreak + 1] !== ' '));
3559
+ hasFoldableLine =
3560
+ hasFoldableLine ||
3561
+ (shouldTrackWidth &&
3562
+ i - previousLineBreak - 1 > lineWidth &&
3563
+ string[previousLineBreak + 1] !== ' ');
3192
3564
  }
3193
3565
  // Although every style can represent \n without escaping, prefer block styles
3194
3566
  // for multiline, since they're more readable and they don't add empty lines.
@@ -3220,17 +3592,22 @@
3220
3592
  // • Ending newline => removed then restored.
3221
3593
  // Importantly, this keeps the "+" chomp indicator from gaining an extra line.
3222
3594
  function writeScalar(state, string, level, iskey, inblock) {
3223
- state.dump = (function () {
3595
+ state.dump = (function() {
3224
3596
  if (string.length === 0) {
3225
3597
  return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
3226
3598
  }
3227
3599
  if (!state.noCompatMode) {
3228
- if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
3229
- return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'");
3600
+ if (
3601
+ DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 ||
3602
+ DEPRECATED_BASE60_SYNTAX.test(string)
3603
+ ) {
3604
+ return state.quotingType === QUOTING_TYPE_DOUBLE
3605
+ ? `"${string}"`
3606
+ : `'${string}'`;
3230
3607
  }
3231
3608
  }
3232
3609
 
3233
- var indent = state.indent * Math.max(1, level); // no 0-indent scalars
3610
+ const indent = state.indent * Math.max(1, level); // no 0-indent scalars
3234
3611
  // As indentation gets deeper, let the width decrease monotonically
3235
3612
  // to the lower bound min(state.lineWidth, 40).
3236
3613
  // Note that this implies
@@ -3238,48 +3615,65 @@
3238
3615
  // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
3239
3616
  // This behaves better than a constant minimum width which disallows narrower options,
3240
3617
  // or an indent threshold which causes the width to suddenly increase.
3241
- var lineWidth = state.lineWidth === -1
3242
- ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
3618
+ const lineWidth =
3619
+ state.lineWidth === -1
3620
+ ? -1
3621
+ : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
3243
3622
 
3244
3623
  // Without knowing if keys are implicit/explicit, assume implicit for safety.
3245
- var singleLineOnly = iskey
3624
+ const singleLineOnly =
3625
+ iskey ||
3246
3626
  // No block styles in flow mode.
3247
- || (state.flowLevel > -1 && level >= state.flowLevel);
3627
+ (state.flowLevel > -1 && level >= state.flowLevel);
3248
3628
  function testAmbiguity(string) {
3249
3629
  return testImplicitResolving(state, string);
3250
3630
  }
3251
3631
 
3252
- switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,
3253
- testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
3254
-
3632
+ switch (
3633
+ chooseScalarStyle(
3634
+ string,
3635
+ singleLineOnly,
3636
+ state.indent,
3637
+ lineWidth,
3638
+ testAmbiguity,
3639
+ state.quotingType,
3640
+ state.forceQuotes && !iskey,
3641
+ inblock
3642
+ )
3643
+ ) {
3255
3644
  case STYLE_PLAIN:
3256
3645
  return string;
3257
3646
  case STYLE_SINGLE:
3258
- return "'" + string.replace(/'/g, "''") + "'";
3647
+ return `'${string.replace(/'/g, "''")}'`;
3259
3648
  case STYLE_LITERAL:
3260
- return '|' + blockHeader(string, state.indent)
3261
- + dropEndingNewline(indentString(string, indent));
3649
+ return `|${blockHeader(string, state.indent)}${dropEndingNewline(
3650
+ indentString(string, indent)
3651
+ )}`;
3262
3652
  case STYLE_FOLDED:
3263
- return '>' + blockHeader(string, state.indent)
3264
- + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
3653
+ return `>${blockHeader(string, state.indent)}${dropEndingNewline(
3654
+ indentString(foldString(string, lineWidth), indent)
3655
+ )}`;
3265
3656
  case STYLE_DOUBLE:
3266
- return '"' + escapeString(string) + '"';
3657
+ return `"${escapeString(string)}"`;
3267
3658
  default:
3268
3659
  throw new exception('impossible error: invalid scalar style');
3269
3660
  }
3270
- }());
3661
+ })();
3271
3662
  }
3272
3663
 
3273
3664
  // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
3274
3665
  function blockHeader(string, indentPerLevel) {
3275
- var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
3666
+ const indentIndicator = needIndentIndicator(string)
3667
+ ? String(indentPerLevel)
3668
+ : '';
3276
3669
 
3277
3670
  // note the special case: the string '\n' counts as a "trailing" empty line.
3278
- var clip = string[string.length - 1] === '\n';
3279
- var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
3280
- var chomp = keep ? '+' : (clip ? '' : '-');
3671
+ const clip = string[string.length - 1] === '\n';
3672
+ const keep =
3673
+ clip && (string[string.length - 2] === '\n' || string === '\n');
3674
+ const chomp = keep ? '+' : clip ? '' : '-';
3281
3675
 
3282
- return indentIndicator + chomp + '\n';
3676
+ return `${indentIndicator + chomp}\n`;
3283
3677
  }
3284
3678
 
3285
3679
  // (See the note for writeScalar.)
@@ -3294,28 +3688,29 @@
3294
3688
  // unless they're before or after a more-indented line, or at the very
3295
3689
  // beginning or end, in which case $k$ maps to $k$.
3296
3690
  // Therefore, parse each chunk as newline(s) followed by a content line.
3297
- var lineRe = /(\n+)([^\n]*)/g;
3691
+ const lineRe = /(\n+)([^\n]*)/g;
3298
3692
 
3299
3693
  // first line (possibly an empty line)
3300
- var result = (function () {
3301
- var nextLF = string.indexOf('\n');
3694
+ let result = (function() {
3695
+ let nextLF = string.indexOf('\n');
3302
3696
  nextLF = nextLF !== -1 ? nextLF : string.length;
3303
3697
  lineRe.lastIndex = nextLF;
3304
3698
  return foldLine(string.slice(0, nextLF), width);
3305
- }());
3699
+ })();
3306
3700
  // If we haven't reached the first content line yet, don't add an extra \n.
3307
- var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
3308
- var moreIndented;
3701
+ let prevMoreIndented = string[0] === '\n' || string[0] === ' ';
3702
+ let moreIndented;
3309
3703
 
3310
3704
  // rest of the lines
3311
- var match;
3705
+ let match;
3312
3706
  while ((match = lineRe.exec(string))) {
3313
- var prefix = match[1], line = match[2];
3314
- moreIndented = (line[0] === ' ');
3315
- result += prefix
3316
- + (!prevMoreIndented && !moreIndented && line !== ''
3317
- ? '\n' : '')
3318
- + foldLine(line, width);
3707
+ const prefix = match[1];
3708
+ const line = match[2];
3709
+ moreIndented = line[0] === ' ';
3710
+ result +=
3711
+ prefix +
3712
+ (!prevMoreIndented && !moreIndented && line !== '' ? '\n' : '') +
3713
+ foldLine(line, width);
3319
3714
  prevMoreIndented = moreIndented;
3320
3715
  }
3321
3716
 
@@ -3330,11 +3725,14 @@
3330
3725
  if (line === '' || line[0] === ' ') return line;
3331
3726
 
3332
3727
  // Since a more-indented line adds a \n, breaks can't be followed by a space.
3333
- var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
3334
- var match;
3728
+ const breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
3729
+ let match;
3335
3730
  // start is an inclusive index. end, curr, and next are exclusive.
3336
- var start = 0, end, curr = 0, next = 0;
3337
- var result = '';
3731
+ let start = 0;
3732
+ let end;
3733
+ let curr = 0;
3734
+ let next = 0;
3735
+ let result = '';
3338
3736
 
3339
3737
  // Invariants: 0 <= start <= length-1.
3340
3738
  // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
@@ -3344,10 +3742,10 @@
3344
3742
  next = match.index;
3345
3743
  // maintain invariant: curr - start <= width
3346
3744
  if (next - start > width) {
3347
- end = (curr > start) ? curr : next; // derive end <= length-2
3348
- result += '\n' + line.slice(start, end);
3745
+ end = curr > start ? curr : next; // derive end <= length-2
3746
+ result += `\n${line.slice(start, end)}`;
3349
3747
  // skip the space that was output as \n
3350
- start = end + 1; // derive start <= length-1
3748
+ start = end + 1; // derive start <= length-1
3351
3749
  }
3352
3750
  curr = next;
3353
3751
  }
@@ -3357,7 +3755,7 @@
3357
3755
  result += '\n';
3358
3756
  // Insert a break if the remainder is too long and there is a break available.
3359
3757
  if (line.length - start > width && curr > start) {
3360
- result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
3758
+ result += `${line.slice(start, curr)}\n${line.slice(curr + 1)}`;
3361
3759
  } else {
3362
3760
  result += line.slice(start);
3363
3761
  }
@@ -3367,11 +3765,11 @@
3367
3765
 
3368
3766
  // Escapes a double-quoted string.
3369
3767
  function escapeString(string) {
3370
- var result = '';
3371
- var char = 0;
3372
- var escapeSeq;
3768
+ let result = '';
3769
+ let char = 0;
3770
+ let escapeSeq;
3373
3771
 
3374
- for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {
3772
+ for (let i = 0; i < string.length; char >= 0x10000 ? (i += 2) : i++) {
3375
3773
  char = codePointAt(string, i);
3376
3774
  escapeSeq = ESCAPE_SEQUENCES[char];
3377
3775
 
@@ -3387,11 +3785,11 @@
3387
3785
  }
3388
3786
 
3389
3787
  function writeFlowSequence(state, level, object) {
3390
- var _result = '',
3391
- _tag = state.tag,
3392
- index,
3393
- length,
3394
- value;
3788
+ let _result = '';
3789
+ const _tag = state.tag;
3790
+ let index;
3791
+ let length;
3792
+ let value;
3395
3793
 
3396
3794
  for (index = 0, length = object.length; index < length; index += 1) {
3397
3795
  value = object[index];
@@ -3401,25 +3799,26 @@
3401
3799
  }
3402
3800
 
3403
3801
  // Write only valid elements, put null instead of invalid elements.
3404
- if (writeNode(state, level, value, false, false) ||
3405
- (typeof value === 'undefined' &&
3406
- writeNode(state, level, null, false, false))) {
3407
-
3408
- if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');
3802
+ if (
3803
+ writeNode(state, level, value, false, false) ||
3804
+ (typeof value === 'undefined' &&
3805
+ writeNode(state, level, null, false, false))
3806
+ ) {
3807
+ if (_result !== '') _result += `,${!state.condenseFlow ? ' ' : ''}`;
3409
3808
  _result += state.dump;
3410
3809
  }
3411
3810
  }
3412
3811
 
3413
3812
  state.tag = _tag;
3414
- state.dump = '[' + _result + ']';
3813
+ state.dump = `[${_result}]`;
3415
3814
  }
3416
3815
 
3417
3816
  function writeBlockSequence(state, level, object, compact) {
3418
- var _result = '',
3419
- _tag = state.tag,
3420
- index,
3421
- length,
3422
- value;
3817
+ let _result = '';
3818
+ const _tag = state.tag;
3819
+ let index;
3820
+ let length;
3821
+ let value;
3423
3822
 
3424
3823
  for (index = 0, length = object.length; index < length; index += 1) {
3425
3824
  value = object[index];
@@ -3429,10 +3828,11 @@
3429
3828
  }
3430
3829
 
3431
3830
  // Write only valid elements, put null instead of invalid elements.
3432
- if (writeNode(state, level + 1, value, true, true, false, true) ||
3433
- (typeof value === 'undefined' &&
3434
- writeNode(state, level + 1, null, true, true, false, true))) {
3435
-
3831
+ if (
3832
+ writeNode(state, level + 1, value, true, true, false, true) ||
3833
+ (typeof value === 'undefined' &&
3834
+ writeNode(state, level + 1, null, true, true, false, true))
3835
+ ) {
3436
3836
  if (!compact || _result !== '') {
3437
3837
  _result += generateNextLine(state, level);
3438
3838
  }
@@ -3452,17 +3852,16 @@
3452
3852
  }
3453
3853
 
3454
3854
  function writeFlowMapping(state, level, object) {
3455
- var _result = '',
3456
- _tag = state.tag,
3457
- objectKeyList = Object.keys(object),
3458
- index,
3459
- length,
3460
- objectKey,
3461
- objectValue,
3462
- pairBuffer;
3855
+ let _result = '';
3856
+ const _tag = state.tag;
3857
+ const objectKeyList = Object.keys(object);
3858
+ let index;
3859
+ let length;
3860
+ let objectKey;
3861
+ let objectValue;
3862
+ let pairBuffer;
3463
3863
 
3464
3864
  for (index = 0, length = objectKeyList.length; index < length; index += 1) {
3465
-
3466
3865
  pairBuffer = '';
3467
3866
  if (_result !== '') pairBuffer += ', ';
3468
3867
 
@@ -3481,7 +3880,9 @@
3481
3880
 
3482
3881
  if (state.dump.length > 1024) pairBuffer += '? ';
3483
3882
 
3484
- pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
3883
+ pairBuffer += `${state.dump + (state.condenseFlow ? '"' : '')}:${
3884
+ state.condenseFlow ? '' : ' '
3885
+ }`;
3485
3886
 
3486
3887
  if (!writeNode(state, level, objectValue, false, false)) {
3487
3888
  continue; // Skip this pair because of invalid value.
@@ -3494,19 +3895,19 @@
3494
3895
  }
3495
3896
 
3496
3897
  state.tag = _tag;
3497
- state.dump = '{' + _result + '}';
3898
+ state.dump = `{${_result}}`;
3498
3899
  }
3499
3900
 
3500
3901
  function writeBlockMapping(state, level, object, compact) {
3501
- var _result = '',
3502
- _tag = state.tag,
3503
- objectKeyList = Object.keys(object),
3504
- index,
3505
- length,
3506
- objectKey,
3507
- objectValue,
3508
- explicitPair,
3509
- pairBuffer;
3902
+ let _result = '';
3903
+ const _tag = state.tag;
3904
+ const objectKeyList = Object.keys(object);
3905
+ let index;
3906
+ let length;
3907
+ let objectKey;
3908
+ let objectValue;
3909
+ let explicitPair;
3910
+ let pairBuffer;
3510
3911
 
3511
3912
  // Allow sorting keys so that the output file is deterministic
3512
3913
  if (state.sortKeys === true) {
@@ -3538,8 +3939,9 @@
3538
3939
  continue; // Skip this pair because of invalid key.
3539
3940
  }
3540
3941
 
3541
- explicitPair = (state.tag !== null && state.tag !== '?') ||
3542
- (state.dump && state.dump.length > 1024);
3942
+ explicitPair =
3943
+ (state.tag !== null && state.tag !== '?') ||
3944
+ (state.dump && state.dump.length > 1024);
3543
3945
 
3544
3946
  if (explicitPair) {
3545
3947
  if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
@@ -3576,17 +3978,24 @@
3576
3978
  }
3577
3979
 
3578
3980
  function detectType(state, object, explicit) {
3579
- var _result, typeList, index, length, type, style;
3981
+ let _result;
3982
+ let typeList;
3983
+ let index;
3984
+ let length;
3985
+ let type;
3986
+ let style;
3580
3987
 
3581
3988
  typeList = explicit ? state.explicitTypes : state.implicitTypes;
3582
3989
 
3583
3990
  for (index = 0, length = typeList.length; index < length; index += 1) {
3584
3991
  type = typeList[index];
3585
3992
 
3586
- if ((type.instanceOf || type.predicate) &&
3587
- (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
3588
- (!type.predicate || type.predicate(object))) {
3589
-
3993
+ if (
3994
+ (type.instanceOf || type.predicate) &&
3995
+ (!type.instanceOf ||
3996
+ (typeof object === 'object' && object instanceof type.instanceOf)) &&
3997
+ (!type.predicate || type.predicate(object))
3998
+ ) {
3590
3999
  if (explicit) {
3591
4000
  if (type.multi && type.representName) {
3592
4001
  state.tag = type.representName(object);
@@ -3605,7 +4014,9 @@
3605
4014
  } else if (_hasOwnProperty.call(type.represent, style)) {
3606
4015
  _result = type.represent[style](object, style);
3607
4016
  } else {
3608
- throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
4017
+ throw new exception(
4018
+ `!<${type.tag}> tag resolver accepts not "${style}" style`
4019
+ );
3609
4020
  }
3610
4021
 
3611
4022
  state.dump = _result;
@@ -3629,59 +4040,64 @@
3629
4040
  detectType(state, object, true);
3630
4041
  }
3631
4042
 
3632
- var type = _toString.call(state.dump);
3633
- var inblock = block;
3634
- var tagStr;
4043
+ const type = _toString.call(state.dump);
4044
+ const inblock = block;
4045
+ let tagStr;
3635
4046
 
3636
4047
  if (block) {
3637
- block = (state.flowLevel < 0 || state.flowLevel > level);
4048
+ block = state.flowLevel < 0 || state.flowLevel > level;
3638
4049
  }
3639
4050
 
3640
- var objectOrArray = type === '[object Object]' || type === '[object Array]',
3641
- duplicateIndex,
3642
- duplicate;
4051
+ const objectOrArray =
4052
+ type === '[object Object]' || type === '[object Array]';
4053
+ let duplicateIndex;
4054
+ let duplicate;
3643
4055
 
3644
4056
  if (objectOrArray) {
3645
4057
  duplicateIndex = state.duplicates.indexOf(object);
3646
4058
  duplicate = duplicateIndex !== -1;
3647
4059
  }
3648
4060
 
3649
- if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
4061
+ if (
4062
+ (state.tag !== null && state.tag !== '?') ||
4063
+ duplicate ||
4064
+ (state.indent !== 2 && level > 0)
4065
+ ) {
3650
4066
  compact = false;
3651
4067
  }
3652
4068
 
3653
4069
  if (duplicate && state.usedDuplicates[duplicateIndex]) {
3654
- state.dump = '*ref_' + duplicateIndex;
4070
+ state.dump = `*ref_${duplicateIndex}`;
3655
4071
  } else {
3656
4072
  if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
3657
4073
  state.usedDuplicates[duplicateIndex] = true;
3658
4074
  }
3659
4075
  if (type === '[object Object]') {
3660
- if (block && (Object.keys(state.dump).length !== 0)) {
4076
+ if (block && Object.keys(state.dump).length !== 0) {
3661
4077
  writeBlockMapping(state, level, state.dump, compact);
3662
4078
  if (duplicate) {
3663
- state.dump = '&ref_' + duplicateIndex + state.dump;
4079
+ state.dump = `&ref_${duplicateIndex}${state.dump}`;
3664
4080
  }
3665
4081
  } else {
3666
4082
  writeFlowMapping(state, level, state.dump);
3667
4083
  if (duplicate) {
3668
- state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
4084
+ state.dump = `&ref_${duplicateIndex} ${state.dump}`;
3669
4085
  }
3670
4086
  }
3671
4087
  } else if (type === '[object Array]') {
3672
- if (block && (state.dump.length !== 0)) {
4088
+ if (block && state.dump.length !== 0) {
3673
4089
  if (state.noArrayIndent && !isblockseq && level > 0) {
3674
4090
  writeBlockSequence(state, level - 1, state.dump, compact);
3675
4091
  } else {
3676
4092
  writeBlockSequence(state, level, state.dump, compact);
3677
4093
  }
3678
4094
  if (duplicate) {
3679
- state.dump = '&ref_' + duplicateIndex + state.dump;
4095
+ state.dump = `&ref_${duplicateIndex}${state.dump}`;
3680
4096
  }
3681
4097
  } else {
3682
4098
  writeFlowSequence(state, level, state.dump);
3683
4099
  if (duplicate) {
3684
- state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
4100
+ state.dump = `&ref_${duplicateIndex} ${state.dump}`;
3685
4101
  }
3686
4102
  }
3687
4103
  } else if (type === '[object String]') {
@@ -3692,7 +4108,7 @@
3692
4108
  return false;
3693
4109
  } else {
3694
4110
  if (state.skipInvalid) return false;
3695
- throw new exception('unacceptable kind of an object to dump ' + type);
4111
+ throw new exception(`unacceptable kind of an object to dump ${type}`);
3696
4112
  }
3697
4113
 
3698
4114
  if (state.tag !== null && state.tag !== '?') {
@@ -3714,14 +4130,14 @@
3714
4130
  ).replace(/!/g, '%21');
3715
4131
 
3716
4132
  if (state.tag[0] === '!') {
3717
- tagStr = '!' + tagStr;
4133
+ tagStr = `!${tagStr}`;
3718
4134
  } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {
3719
- tagStr = '!!' + tagStr.slice(18);
4135
+ tagStr = `!!${tagStr.slice(18)}`;
3720
4136
  } else {
3721
- tagStr = '!<' + tagStr + '>';
4137
+ tagStr = `!<${tagStr}>`;
3722
4138
  }
3723
4139
 
3724
- state.dump = tagStr + ' ' + state.dump;
4140
+ state.dump = `${tagStr} ${state.dump}`;
3725
4141
  }
3726
4142
  }
3727
4143
 
@@ -3729,23 +4145,27 @@
3729
4145
  }
3730
4146
 
3731
4147
  function getDuplicateReferences(object, state) {
3732
- var objects = [],
3733
- duplicatesIndexes = [],
3734
- index,
3735
- length;
4148
+ const objects = [];
4149
+ const duplicatesIndexes = [];
4150
+ let index;
4151
+ let length;
3736
4152
 
3737
4153
  inspectNode(object, objects, duplicatesIndexes);
3738
4154
 
3739
- for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
4155
+ for (
4156
+ index = 0, length = duplicatesIndexes.length;
4157
+ index < length;
4158
+ index += 1
4159
+ ) {
3740
4160
  state.duplicates.push(objects[duplicatesIndexes[index]]);
3741
4161
  }
3742
4162
  state.usedDuplicates = new Array(length);
3743
4163
  }
3744
4164
 
3745
4165
  function inspectNode(object, objects, duplicatesIndexes) {
3746
- var objectKeyList,
3747
- index,
3748
- length;
4166
+ let objectKeyList;
4167
+ let index;
4168
+ let length;
3749
4169
 
3750
4170
  if (object !== null && typeof object === 'object') {
3751
4171
  index = objects.indexOf(object);
@@ -3763,8 +4183,16 @@
3763
4183
  } else {
3764
4184
  objectKeyList = Object.keys(object);
3765
4185
 
3766
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
3767
- inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
4186
+ for (
4187
+ index = 0, length = objectKeyList.length;
4188
+ index < length;
4189
+ index += 1
4190
+ ) {
4191
+ inspectNode(
4192
+ object[objectKeyList[index]],
4193
+ objects,
4194
+ duplicatesIndexes
4195
+ );
3768
4196
  }
3769
4197
  }
3770
4198
  }
@@ -3774,83 +4202,84 @@
3774
4202
  function dump$1(input, options) {
3775
4203
  options = options || {};
3776
4204
 
3777
- var state = new State(options);
4205
+ const state = new State(options);
3778
4206
 
3779
4207
  if (!state.noRefs) getDuplicateReferences(input, state);
3780
4208
 
3781
- var value = input;
4209
+ let value = input;
3782
4210
 
3783
4211
  if (state.replacer) {
3784
4212
  value = state.replacer.call({ '': value }, '', value);
3785
4213
  }
3786
4214
 
3787
- if (writeNode(state, 0, value, true, true)) return state.dump + '\n';
4215
+ if (writeNode(state, 0, value, true, true)) return `${state.dump}\n`;
3788
4216
 
3789
4217
  return '';
3790
4218
  }
3791
4219
 
3792
- var dump_1 = dump$1;
4220
+ const dump_1 = dump$1;
3793
4221
 
3794
- var dumper = {
3795
- dump: dump_1
4222
+ const dumper = {
4223
+ dump: dump_1,
3796
4224
  };
3797
4225
 
3798
4226
  function renamed(from, to) {
3799
- return function () {
3800
- throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +
3801
- 'Use yaml.' + to + ' instead, which is now safe by default.');
4227
+ return function() {
4228
+ throw new Error(
4229
+ `Function yaml.${from} is removed in js-yaml 4. ` +
4230
+ `Use yaml.${to} instead, which is now safe by default.`
4231
+ );
3802
4232
  };
3803
4233
  }
3804
4234
 
3805
-
3806
- var Type = type;
3807
- var Schema = schema;
3808
- var FAILSAFE_SCHEMA = failsafe;
3809
- var JSON_SCHEMA = json;
3810
- var CORE_SCHEMA = core;
3811
- var DEFAULT_SCHEMA = _default;
3812
- var load = loader.load;
3813
- var loadAll = loader.loadAll;
3814
- var dump = dumper.dump;
3815
- var YAMLException = exception;
4235
+ const Type = type;
4236
+ const Schema = schema;
4237
+ const FAILSAFE_SCHEMA = failsafe;
4238
+ const JSON_SCHEMA = json;
4239
+ const CORE_SCHEMA = core;
4240
+ const DEFAULT_SCHEMA = _default;
4241
+ const { load } = loader;
4242
+ const { loadAll } = loader;
4243
+ const { dump } = dumper;
4244
+ const YAMLException = exception;
3816
4245
 
3817
4246
  // Re-export all types in case user wants to create custom schema
3818
- var types = {
3819
- binary: binary,
3820
- float: float,
3821
- map: map,
3822
- null: _null,
3823
- pairs: pairs,
3824
- set: set,
3825
- timestamp: timestamp,
3826
- bool: bool,
3827
- int: int,
3828
- merge: merge,
3829
- omap: omap,
3830
- seq: seq,
3831
- str: str
4247
+ const types = {
4248
+ binary,
4249
+ float,
4250
+ map,
4251
+ null: _null,
4252
+ pairs,
4253
+ set,
4254
+ timestamp,
4255
+ bool,
4256
+ int,
4257
+ merge,
4258
+ omap,
4259
+ seq,
4260
+ str,
3832
4261
  };
3833
4262
 
3834
4263
  // Removed functions from JS-YAML 3.0.x
3835
- var safeLoad = renamed('safeLoad', 'load');
3836
- var safeLoadAll = renamed('safeLoadAll', 'loadAll');
3837
- var safeDump = renamed('safeDump', 'dump');
3838
-
3839
- var jsYaml = {
3840
- Type: Type,
3841
- Schema: Schema,
3842
- FAILSAFE_SCHEMA: FAILSAFE_SCHEMA,
3843
- JSON_SCHEMA: JSON_SCHEMA,
3844
- CORE_SCHEMA: CORE_SCHEMA,
3845
- DEFAULT_SCHEMA: DEFAULT_SCHEMA,
3846
- load: load,
3847
- loadAll: loadAll,
3848
- dump: dump,
3849
- YAMLException: YAMLException,
3850
- types: types,
3851
- safeLoad: safeLoad,
3852
- safeLoadAll: safeLoadAll,
3853
- safeDump: safeDump
4264
+ const safeLoad = renamed('safeLoad', 'load');
4265
+ const safeLoadAll = renamed('safeLoadAll', 'loadAll');
4266
+ const safeDump = renamed('safeDump', 'dump');
4267
+
4268
+ const jsYaml = {
4269
+ Type,
4270
+ Schema,
4271
+ FAILSAFE_SCHEMA,
4272
+ JSON_SCHEMA,
4273
+ CORE_SCHEMA,
4274
+ DEFAULT_SCHEMA,
4275
+ load,
4276
+ loadAll,
4277
+ dump,
4278
+ YAMLException,
4279
+ types,
4280
+ safeLoad,
4281
+ safeLoadAll,
4282
+ safeDump,
3854
4283
  };
3855
4284
 
3856
4285
  exports.CORE_SCHEMA = CORE_SCHEMA;
@@ -3870,5 +4299,4 @@
3870
4299
  exports.types = types;
3871
4300
 
3872
4301
  Object.defineProperty(exports, '__esModule', { value: true });
3873
-
3874
- })));
4302
+ });