From 29066267dfac4695e839f345f188533e5a009dae Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Thu, 28 May 2026 16:08:47 +0300 Subject: [PATCH 01/23] benchmark => tinybench --- benchmark/benchmark.js | 122 -------------------- benchmark/benchmark.mjs | 103 +++++++++++++++++ benchmark/implementations/current/index.js | 3 - benchmark/implementations/current/index.mjs | 5 + benchmark/profile.js | 14 --- package.json | 5 +- 6 files changed, 110 insertions(+), 142 deletions(-) delete mode 100755 benchmark/benchmark.js create mode 100755 benchmark/benchmark.mjs delete mode 100644 benchmark/implementations/current/index.js create mode 100644 benchmark/implementations/current/index.mjs delete mode 100755 benchmark/profile.js diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100755 index 6deec089..00000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env node - -'use strict'; - -/*eslint-disable no-console*/ - -var path = require('path'); -var fs = require('fs'); -var util = require('util'); -var Benchmark = require('benchmark'); -var ansi = require('ansi'); -var cursor = ansi(process.stdout); - - -var IMPLS_DIRECTORY = path.join(__dirname, 'implementations'); -var IMPLS_PATHS = {}; -var IMPLS = []; - - -fs.readdirSync(IMPLS_DIRECTORY).sort().forEach(function (name) { - var file = path.join(IMPLS_DIRECTORY, name); - var code = require(file); - - IMPLS_PATHS[name] = file; - IMPLS.push({ - name: name, - run: code.load - }); -}); - - -var SAMPLES_DIRECTORY = path.join(__dirname, 'samples'); -var SAMPLES = []; - - -fs.readdirSync(SAMPLES_DIRECTORY).sort().forEach(function (sample) { - var filepath = path.join(SAMPLES_DIRECTORY, sample), - extname = path.extname(filepath), - basename = path.basename(filepath, extname), - content = fs.readFileSync(filepath, 'utf8'), - title = util.format('%s (%d characters)', sample, content.length); - - function onComplete() { - cursor.write('\n'); - } - - var suite = new Benchmark.Suite(title, { - - onStart: function onStart() { - console.log('\nSample: %s', title); - }, - - onComplete: onComplete - - }); - - - IMPLS.forEach(function (impl) { - suite.add(impl.name, { - - onCycle: function onCycle(event) { - cursor.horizontalAbsolute(); - cursor.eraseLine(); - cursor.write(' > ' + event.target); - }, - - onComplete: onComplete, - - fn: function () { impl.run(content); } - }); - }); - - - SAMPLES.push({ - name: basename, - title: title, - content: content, - suite: suite - }); -}); - - -function select(patterns) { - var result = []; - - if (!(patterns instanceof Array)) patterns = [ patterns ]; - - function checkName(name) { - return patterns.length === 0 || patterns.some(function (regexp) { - return regexp.test(name); - }); - } - - SAMPLES.forEach(function (sample) { - if (checkName(sample.name)) result.push(sample); - }); - - return result; -} - - -function run(files) { - var selected = select(files); - - if (selected.length > 0) { - console.log('Selected samples: (%d of %d)', selected.length, SAMPLES.length); - selected.forEach(function (sample) { - console.log(' > %s', sample.name); - }); - } else { - console.log("There isn't any sample matches any of these patterns: %s", util.inspect(files)); - } - - selected.forEach(function (sample) { - sample.suite.run(); - }); -} - - -run(process.argv.slice(2).map(function (source) { - return new RegExp(source, 'i'); -})); diff --git a/benchmark/benchmark.mjs b/benchmark/benchmark.mjs new file mode 100755 index 00000000..a4715fa8 --- /dev/null +++ b/benchmark/benchmark.mjs @@ -0,0 +1,103 @@ +#!/usr/bin/env node +/* eslint no-console:0 */ + +import fs from 'node:fs'; +import util from 'node:util'; +import { Bench } from 'tinybench'; + +const IMPLS = []; + +for (const name of fs.readdirSync(new URL('./implementations', import.meta.url)).sort()) { + const filepath = new URL(`./implementations/${name}/index.mjs`, import.meta.url); + const code = await import(filepath); + + IMPLS.push({ name, code }); +} + +const SAMPLES = []; + +fs.readdirSync(new URL('./samples', import.meta.url)).sort().forEach(function (sample) { + const filepath = new URL(`./samples/${sample}`, import.meta.url); + + const content = {}; + + content.string = fs.readFileSync(filepath, 'utf8'); + + const title = `(${content.string.length} bytes)`; + + const bench = new Bench({ name: title }); + + IMPLS.forEach(function (impl) { + bench.add(impl.name, function () { impl.code.run(content.string); }); + }); + + SAMPLES.push({ name: sample.split('.')[0], filename: sample, title, content, bench }); +}); + +function formatNumber(num) { + return num.toLocaleString('en-US', { maximumFractionDigits: 0 }); +} + +function formatTask(task) { + const result = task.result; + + if (result.state !== 'completed') { + return `${task.name}: ${result.state}`; + } + + return [ + task.name, + `${formatNumber(result.throughput.mean)} ops/sec`, + `+/-${result.throughput.rme.toFixed(2)}%`, + `${result.throughput.samplesCount} samples` + ].join(' '); +} + +function select(patterns) { + const result = []; + + if (!(patterns instanceof Array)) { + patterns = [ patterns ]; + } + + function checkName(name) { + return patterns.length === 0 || patterns.some(function (regexp) { + return regexp.test(name); + }); + } + + SAMPLES.forEach(function (sample) { + if (checkName(sample.name)) { + result.push(sample); + } + }); + + return result; +} + +async function run(files) { + const selected = select(files); + + if (selected.length > 0) { + console.log('Selected samples: (%d of %d)', selected.length, SAMPLES.length); + selected.forEach(function (sample) { + console.log(' > %s', sample.name); + }); + } else { + console.log('There isn\'t any sample matches any of these patterns: %s', util.inspect(files)); + } + + for (const sample of selected) { + console.log('\n\nSample: %s %s', sample.filename, sample.title); + + sample.bench.addEventListener('cycle', function (event) { + console.log(' > %s', formatTask(event.task)); + }); + + await sample.bench.run(); + } +} + +await run(process.argv.slice(2).map(function (source) { + return new RegExp(source, 'i'); +})); diff --git a/benchmark/implementations/current/index.js b/benchmark/implementations/current/index.js deleted file mode 100644 index ab29912f..00000000 --- a/benchmark/implementations/current/index.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('../../../'); diff --git a/benchmark/implementations/current/index.mjs b/benchmark/implementations/current/index.mjs new file mode 100644 index 00000000..c8176350 --- /dev/null +++ b/benchmark/implementations/current/index.mjs @@ -0,0 +1,5 @@ +import yaml from '../../../index.js'; + +export function run(data) { + return yaml.load(data); +} diff --git a/benchmark/profile.js b/benchmark/profile.js deleted file mode 100755 index 27d18ca6..00000000 --- a/benchmark/profile.js +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env node - - -'use strict'; - -var fs = require('fs'); -var path = require('path'); -var yaml = require('../'); - -var data = fs.readFileSync(path.join(__dirname, '/samples/document_nodeca_application.yaml'), 'utf8'); - -for (var i = 0; i < 10000; i++) { - yaml.load(data); -} diff --git a/package.json b/package.json index 878aecd4..7cfb4898 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,6 @@ "devDependencies": { "@rollup/plugin-commonjs": "^17.0.0", "@rollup/plugin-node-resolve": "^11.0.0", - "ansi": "^0.3.1", - "benchmark": "^2.1.4", "codemirror": "^5.13.4", "eslint": "^7.0.0", "fast-check": "^2.8.0", @@ -61,6 +59,7 @@ "rollup": "^2.34.1", "rollup-plugin-node-polyfills": "^0.2.1", "rollup-plugin-terser": "^7.0.2", - "shelljs": "^0.8.4" + "shelljs": "^0.8.4", + "tinybench": "^6.0.2" } } From 4bd56bef6718ad848bce7a33c3d513d857b6b3cc Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Thu, 28 May 2026 16:33:09 +0300 Subject: [PATCH 02/23] tests: drop orphaned fixtures --- test/unported/aliases-cdumper-bug.code | 1 - test/unported/aliases.events | 8 - test/unported/documents.events | 11 - ...scalar-in-simple-key-context-bug.canonical | 6 - ...lock-scalar-in-simple-key-context-bug.data | 4 - ...nacceptable-unicode-character-bug.skip-ext | 0 test/unported/empty-anchor.emitter-error | 5 - test/unported/empty-document-bug.canonical | 1 - test/unported/empty-document-bug.data | 0 test/unported/empty-document-bug.empty | 0 test/unported/empty-tag-handle.emitter-error | 5 - test/unported/empty-tag-prefix.emitter-error | 5 - test/unported/empty-tag.emitter-error | 5 - .../expected-document-end.emitter-error | 6 - .../expected-document-start.emitter-error | 4 - test/unported/expected-node-1.emitter-error | 4 - test/unported/expected-node-2.emitter-error | 7 - test/unported/expected-nothing.emitter-error | 4 - .../expected-stream-start.emitter-error | 2 - test/unported/invalid-anchor.emitter-error | 5 - .../invalid-tag-handle-1.emitter-error | 5 - .../invalid-tag-handle-2.emitter-error | 5 - test/unported/invalid-utf8-byte.loader-error | 66 --- test/unported/invalid-utf8-byte.stream-error | 66 --- test/unported/latin.unicode | 384 ------------------ test/unported/mappings.events | 44 -- test/unported/no-alias-anchor.emitter-error | 8 - test/unported/no-alias-anchor.skip-ext | 0 test/unported/no-tag.emitter-error | 5 - .../recursive-anchor.former-loader-error | 4 - test/unported/recursive-dict.recursive | 3 - test/unported/recursive-list.recursive | 2 - test/unported/recursive-set.recursive | 7 - test/unported/recursive-state.recursive | 2 - test/unported/recursive-tuple.recursive | 3 - test/unported/recursive.former-dumper-error | 3 - test/unported/resolver.data | 30 -- test/unported/run-parser-crash-bug.data | 8 - test/unported/scalars.events | 28 -- test/unported/scan-document-end-bug.canonical | 3 - test/unported/scan-document-end-bug.data | 3 - test/unported/scan-line-break-bug.canonical | 3 - test/unported/scan-line-break-bug.data | 3 - test/unported/sequences.events | 81 ---- .../serializer-is-already-opened.dumper-error | 3 - .../serializer-is-closed-1.dumper-error | 4 - .../serializer-is-closed-2.dumper-error | 4 - .../serializer-is-not-opened-1.dumper-error | 2 - .../serializer-is-not-opened-2.dumper-error | 2 - test/unported/sloppy-indentation.canonical | 18 - test/unported/sloppy-indentation.data | 17 - test/unported/spec-02-01.data | 3 - test/unported/spec-02-02.data | 3 - test/unported/spec-02-03.data | 8 - test/unported/spec-02-04.data | 8 - test/unported/spec-02-05.data | 3 - test/unported/spec-02-06.data | 5 - test/unported/spec-02-07.data | 10 - test/unported/spec-02-08.data | 10 - test/unported/spec-02-09.data | 8 - test/unported/spec-02-10.data | 8 - test/unported/spec-02-11.data | 9 - test/unported/spec-02-12.data | 8 - test/unported/spec-02-13.data | 4 - test/unported/spec-02-14.data | 4 - test/unported/spec-02-15.data | 8 - test/unported/spec-02-16.data | 7 - test/unported/spec-02-17.data | 7 - test/unported/spec-02-18.data | 6 - test/unported/spec-02-19.data | 5 - test/unported/spec-02-20.data | 6 - test/unported/spec-02-21.data | 4 - test/unported/spec-02-22.data | 4 - test/unported/spec-02-23.data | 13 - test/unported/spec-02-24.data | 14 - test/unported/spec-02-25.data | 7 - test/unported/spec-02-26.data | 7 - test/unported/spec-02-27.data | 29 -- test/unported/spec-02-28.data | 26 -- test/unported/spec-05-01-utf8.data | 1 - test/unported/spec-05-01-utf8.empty | 2 - test/unported/spec-05-02-utf8.data | 3 - test/unported/spec-05-02-utf8.error | 3 - test/unported/spec-05-03.canonical | 14 - test/unported/spec-05-03.data | 7 - test/unported/spec-05-04.canonical | 13 - test/unported/spec-05-04.data | 2 - test/unported/spec-05-05.data | 1 - test/unported/spec-05-05.empty | 2 - test/unported/spec-05-06.canonical | 8 - test/unported/spec-05-06.data | 2 - test/unported/spec-05-07.canonical | 8 - test/unported/spec-05-07.data | 4 - test/unported/spec-05-08.canonical | 8 - test/unported/spec-05-08.data | 2 - test/unported/spec-05-09.canonical | 3 - test/unported/spec-05-09.data | 2 - test/unported/spec-05-10.data | 2 - test/unported/spec-05-10.error | 3 - test/unported/spec-05-11.canonical | 6 - test/unported/spec-05-11.data | 3 - test/unported/spec-05-12.data | 9 - test/unported/spec-05-12.error | 8 - test/unported/spec-05-13.canonical | 5 - test/unported/spec-05-13.data | 3 - test/unported/spec-05-14.canonical | 7 - test/unported/spec-05-14.data | 2 - test/unported/spec-05-15.data | 3 - test/unported/spec-05-15.error | 3 - test/unported/spec-06-01.canonical | 15 - test/unported/spec-06-01.data | 14 - test/unported/spec-06-02.data | 3 - test/unported/spec-06-02.empty | 2 - test/unported/spec-06-03.canonical | 6 - test/unported/spec-06-03.data | 2 - test/unported/spec-06-04.canonical | 6 - test/unported/spec-06-04.data | 4 - test/unported/spec-06-05.canonical | 16 - test/unported/spec-06-05.data | 6 - test/unported/spec-06-06.canonical | 10 - test/unported/spec-06-06.data | 7 - test/unported/spec-06-07.canonical | 6 - test/unported/spec-06-07.data | 8 - test/unported/spec-06-08.canonical | 5 - test/unported/spec-06-08.data | 2 - test/unported/spec-07-01.canonical | 3 - test/unported/spec-07-01.data | 3 - test/unported/spec-07-01.skip-ext | 0 test/unported/spec-07-02.canonical | 3 - test/unported/spec-07-02.data | 4 - test/unported/spec-07-02.skip-ext | 0 test/unported/spec-07-03.data | 3 - test/unported/spec-07-03.error | 3 - test/unported/spec-07-04.canonical | 3 - test/unported/spec-07-04.data | 3 - test/unported/spec-07-05.data | 3 - test/unported/spec-07-05.error | 4 - test/unported/spec-07-06.canonical | 6 - test/unported/spec-07-06.data | 5 - test/unported/spec-07-07a.canonical | 3 - test/unported/spec-07-07a.data | 2 - test/unported/spec-07-07b.canonical | 3 - test/unported/spec-07-07b.data | 4 - test/unported/spec-07-08.canonical | 7 - test/unported/spec-07-08.data | 9 - test/unported/spec-07-09.canonical | 9 - test/unported/spec-07-09.data | 11 - test/unported/spec-07-10.canonical | 15 - test/unported/spec-07-10.data | 11 - test/unported/spec-07-11.data | 2 - test/unported/spec-07-11.empty | 2 - test/unported/spec-07-12a.canonical | 6 - test/unported/spec-07-12a.data | 3 - test/unported/spec-07-12b.canonical | 3 - test/unported/spec-07-12b.data | 4 - test/unported/spec-07-13.canonical | 9 - test/unported/spec-07-13.data | 9 - test/unported/spec-08-01.canonical | 8 - test/unported/spec-08-01.data | 2 - test/unported/spec-08-02.canonical | 8 - test/unported/spec-08-02.data | 2 - test/unported/spec-08-03.canonical | 6 - test/unported/spec-08-03.data | 2 - test/unported/spec-08-04.data | 2 - test/unported/spec-08-04.error | 6 - test/unported/spec-08-05.canonical | 7 - test/unported/spec-08-05.data | 5 - test/unported/spec-08-06.data | 5 - test/unported/spec-08-06.error | 4 - test/unported/spec-08-07.canonical | 8 - test/unported/spec-08-07.data | 4 - test/unported/spec-08-08.canonical | 15 - test/unported/spec-08-08.data | 13 - test/unported/spec-08-09.canonical | 21 - test/unported/spec-08-09.data | 11 - test/unported/spec-08-10.canonical | 23 -- test/unported/spec-08-10.data | 15 - test/unported/spec-08-11.canonical | 8 - test/unported/spec-08-11.data | 2 - test/unported/spec-08-12.canonical | 10 - test/unported/spec-08-12.data | 8 - test/unported/spec-08-13.canonical | 10 - test/unported/spec-08-13.data | 4 - test/unported/spec-08-13.skip-ext | 0 test/unported/spec-08-14.canonical | 10 - test/unported/spec-08-14.data | 5 - test/unported/spec-08-15.canonical | 11 - test/unported/spec-08-15.data | 5 - test/unported/spec-09-01.canonical | 11 - test/unported/spec-09-01.data | 6 - test/unported/spec-09-02.canonical | 7 - test/unported/spec-09-02.data | 6 - test/unported/spec-09-03.canonical | 7 - test/unported/spec-09-03.data | 6 - test/unported/spec-09-04.canonical | 6 - test/unported/spec-09-04.data | 4 - test/unported/spec-09-05.canonical | 7 - test/unported/spec-09-05.data | 8 - test/unported/spec-09-06.canonical | 3 - test/unported/spec-09-06.data | 1 - test/unported/spec-09-07.canonical | 11 - test/unported/spec-09-07.data | 6 - test/unported/spec-09-08.canonical | 6 - test/unported/spec-09-08.data | 1 - test/unported/spec-09-09.canonical | 7 - test/unported/spec-09-09.data | 6 - test/unported/spec-09-10.canonical | 5 - test/unported/spec-09-10.data | 3 - test/unported/spec-09-11.canonical | 6 - test/unported/spec-09-11.data | 5 - test/unported/spec-09-12.canonical | 12 - test/unported/spec-09-12.data | 8 - test/unported/spec-09-13.canonical | 11 - test/unported/spec-09-13.data | 6 - test/unported/spec-09-14.data | 14 - test/unported/spec-09-14.error | 6 - test/unported/spec-09-15.canonical | 18 - test/unported/spec-09-15.data | 13 - test/unported/spec-09-16.canonical | 6 - test/unported/spec-09-16.data | 3 - test/unported/spec-09-17.canonical | 4 - test/unported/spec-09-17.data | 3 - test/unported/spec-09-18.canonical | 8 - test/unported/spec-09-18.data | 9 - test/unported/spec-09-19.canonical | 6 - test/unported/spec-09-19.data | 4 - test/unported/spec-09-20.canonical | 8 - test/unported/spec-09-20.data | 11 - test/unported/spec-09-20.skip-ext | 0 test/unported/spec-09-21.data | 8 - test/unported/spec-09-21.error | 7 - test/unported/spec-09-22.canonical | 10 - test/unported/spec-09-22.data | 4 - test/unported/spec-09-23.canonical | 10 - test/unported/spec-09-23.data | 11 - test/unported/spec-09-24.canonical | 10 - test/unported/spec-09-24.data | 6 - test/unported/spec-09-25.canonical | 4 - test/unported/spec-09-25.data | 3 - test/unported/spec-09-26.canonical | 3 - test/unported/spec-09-26.data | 8 - test/unported/spec-09-27.canonical | 3 - test/unported/spec-09-27.data | 8 - test/unported/spec-09-28.canonical | 3 - test/unported/spec-09-28.data | 8 - test/unported/spec-09-29.canonical | 4 - test/unported/spec-09-29.data | 4 - test/unported/spec-09-30.canonical | 7 - test/unported/spec-09-30.data | 14 - test/unported/spec-09-31.canonical | 7 - test/unported/spec-09-31.data | 14 - test/unported/spec-09-32.canonical | 7 - test/unported/spec-09-32.data | 14 - test/unported/spec-09-33.canonical | 7 - test/unported/spec-09-33.data | 14 - test/unported/spec-10-01.canonical | 12 - test/unported/spec-10-01.data | 2 - test/unported/spec-10-02.canonical | 14 - test/unported/spec-10-02.data | 8 - test/unported/spec-10-03.canonical | 12 - test/unported/spec-10-03.data | 4 - test/unported/spec-10-04.canonical | 11 - test/unported/spec-10-04.data | 4 - test/unported/spec-10-05.canonical | 14 - test/unported/spec-10-05.data | 7 - test/unported/spec-10-06.canonical | 16 - test/unported/spec-10-06.data | 2 - test/unported/spec-10-07.canonical | 16 - test/unported/spec-10-07.data | 7 - test/unported/spec-10-08.data | 5 - test/unported/spec-10-08.error | 5 - test/unported/spec-10-09.canonical | 8 - test/unported/spec-10-09.data | 4 - test/unported/spec-10-10.canonical | 16 - test/unported/spec-10-10.data | 8 - test/unported/spec-10-11.canonical | 24 -- test/unported/spec-10-11.data | 7 - test/unported/spec-10-12.canonical | 9 - test/unported/spec-10-12.data | 3 - test/unported/spec-10-13.canonical | 11 - test/unported/spec-10-13.data | 5 - test/unported/spec-10-14.canonical | 11 - test/unported/spec-10-14.data | 4 - test/unported/spec-10-15.canonical | 18 - test/unported/spec-10-15.data | 3 - test/unported/tags.events | 12 - test/unported/unknown.dumper-error | 1 - .../unsupported-version.emitter-error | 5 - test/unsupported/bool.detect | 1 - .../colon-in-flow-context.loader-error | 1 - test/unsupported/construct-python-bool.code | 1 - test/unsupported/construct-python-bool.data | 1 - .../construct-python-bytes-py3.code | 1 - .../construct-python-bytes-py3.data | 1 - .../unsupported/construct-python-complex.code | 1 - .../unsupported/construct-python-complex.data | 8 - test/unsupported/construct-python-float.code | 1 - test/unsupported/construct-python-float.data | 1 - test/unsupported/construct-python-int.code | 1 - test/unsupported/construct-python-int.data | 1 - .../construct-python-long-short-py2.code | 1 - .../construct-python-long-short-py2.data | 1 - .../construct-python-long-short-py3.code | 1 - .../construct-python-long-short-py3.data | 1 - .../construct-python-name-module.code | 1 - .../construct-python-name-module.data | 5 - test/unsupported/construct-python-none.code | 1 - test/unsupported/construct-python-none.data | 1 - test/unsupported/construct-python-object.code | 23 -- test/unsupported/construct-python-object.data | 21 - .../construct-python-str-ascii.code | 1 - .../construct-python-str-ascii.data | 1 - .../construct-python-str-utf8-py2.code | 1 - .../construct-python-str-utf8-py2.data | 1 - .../construct-python-str-utf8-py3.code | 1 - .../construct-python-str-utf8-py3.data | 1 - .../construct-python-tuple-list-dict.code | 6 - .../construct-python-tuple-list-dict.data | 8 - .../construct-python-unicode-ascii-py2.code | 1 - .../construct-python-unicode-ascii-py2.data | 1 - .../construct-python-unicode-ascii-py3.code | 1 - .../construct-python-unicode-ascii-py3.data | 1 - .../construct-python-unicode-utf8-py2.code | 1 - .../construct-python-unicode-utf8-py2.data | 1 - .../construct-python-unicode-utf8-py3.code | 1 - .../construct-python-unicode-utf8-py3.data | 1 - .../duplicate-anchor-1.loader-error | 3 - .../duplicate-anchor-2.loader-error | 1 - test/unsupported/duplicate-mapping-key.data | 6 - .../empty-python-module.loader-error | 1 - .../empty-python-name.loader-error | 1 - .../float-representer-2.3-bug.code | 7 - .../float-representer-2.3-bug.data | 5 - test/unsupported/float.detect | 1 - test/unsupported/function.detect | 1 - test/unsupported/int.detect | 1 - .../unsupported/invalid-anchor-1.loader-error | 1 - .../invalid-python-bytes-2-py3.loader-error | 2 - .../invalid-python-bytes-py3.loader-error | 2 - .../invalid-python-module-kind.loader-error | 1 - .../invalid-python-module-value.loader-error | 1 - .../invalid-python-module.loader-error | 1 - .../invalid-python-name-kind.loader-error | 1 - .../invalid-python-name-module-2.loader-error | 1 - .../invalid-python-name-module.loader-error | 1 - .../invalid-python-name-object.loader-error | 1 - .../invalid-python-name-value.loader-error | 1 - test/unsupported/invalid-tag-1.loader-error | 1 - .../invalid-tag-directive-prefix.loader-error | 2 - .../invalid-uri-escapes-2.loader-error | 1 - .../invalid-uri-escapes-3.loader-error | 1 - test/unsupported/merge.detect | 1 - test/unsupported/null.detect | 1 - test/unsupported/odd-utf16.stream-error | Bin 1311 -> 0 bytes test/unsupported/spec-02-01.structure | 1 - test/unsupported/spec-02-01.tokens | 1 - test/unsupported/spec-02-02.structure | 1 - test/unsupported/spec-02-02.tokens | 5 - test/unsupported/spec-02-03.structure | 1 - test/unsupported/spec-02-03.tokens | 4 - test/unsupported/spec-02-04.structure | 4 - test/unsupported/spec-02-04.tokens | 4 - test/unsupported/spec-02-05.structure | 5 - test/unsupported/spec-02-05.tokens | 5 - test/unsupported/spec-02-06.structure | 4 - test/unsupported/spec-02-06.tokens | 4 - test/unsupported/spec-02-07.structure | 4 - test/unsupported/spec-02-07.tokens | 12 - test/unsupported/spec-02-08.structure | 4 - test/unsupported/spec-02-08.tokens | 15 - test/unsupported/spec-02-09.structure | 1 - test/unsupported/spec-02-09.tokens | 5 - test/unsupported/spec-02-10.structure | 1 - test/unsupported/spec-02-10.tokens | 5 - test/unsupported/spec-02-11.structure | 4 - test/unsupported/spec-02-11.tokens | 6 - test/unsupported/spec-02-12.structure | 5 - test/unsupported/spec-02-12.tokens | 6 - test/unsupported/spec-02-13.structure | 1 - test/unsupported/spec-02-13.tokens | 1 - test/unsupported/spec-02-14.structure | 1 - test/unsupported/spec-02-14.tokens | 1 - test/unsupported/spec-02-15.structure | 1 - test/unsupported/spec-02-15.tokens | 1 - test/unsupported/spec-02-16.structure | 1 - test/unsupported/spec-02-16.tokens | 5 - test/unsupported/spec-02-17.structure | 1 - test/unsupported/spec-02-17.tokens | 8 - test/unsupported/spec-02-18.structure | 1 - test/unsupported/spec-02-18.tokens | 4 - test/unsupported/spec-02-19.structure | 1 - test/unsupported/spec-02-19.tokens | 7 - test/unsupported/spec-02-20.structure | 1 - test/unsupported/spec-02-20.tokens | 8 - test/unsupported/spec-02-21.structure | 1 - test/unsupported/spec-02-21.tokens | 6 - test/unsupported/spec-02-22.structure | 1 - test/unsupported/spec-02-22.tokens | 6 - test/unsupported/spec-02-23.structure | 1 - test/unsupported/spec-02-23.tokens | 6 - test/unsupported/spec-02-24.structure | 5 - test/unsupported/spec-02-24.tokens | 20 - test/unsupported/spec-02-25.structure | 1 - test/unsupported/spec-02-25.tokens | 6 - test/unsupported/spec-02-26.structure | 5 - test/unsupported/spec-02-26.tokens | 6 - test/unsupported/spec-02-27.structure | 17 - test/unsupported/spec-02-27.tokens | 20 - test/unsupported/spec-02-28.structure | 10 - test/unsupported/spec-02-28.tokens | 23 -- test/unsupported/spec-05-01-utf16be.data | Bin 34 -> 0 bytes test/unsupported/spec-05-01-utf16be.empty | 2 - test/unsupported/spec-05-01-utf16le.data | Bin 34 -> 0 bytes test/unsupported/spec-05-01-utf16le.empty | 2 - test/unsupported/spec-05-02-utf16be.data | Bin 90 -> 0 bytes test/unsupported/spec-05-02-utf16be.error | 3 - test/unsupported/spec-05-02-utf16le.data | Bin 90 -> 0 bytes test/unsupported/spec-05-02-utf16le.error | 3 - test/unsupported/str.detect | 1 - test/unsupported/timestamp.detect | 1 - .../undefined-constructor.loader-error | 1 - test/unsupported/utf16be.code | 1 - test/unsupported/utf16be.data | Bin 30 -> 0 bytes test/unsupported/utf16le.code | 1 - test/unsupported/utf16le.data | Bin 30 -> 0 bytes test/unsupported/value.data | 1 - test/unsupported/value.detect | 1 - test/unsupported/yaml.data | 3 - test/unsupported/yaml.detect | 1 - 429 files changed, 2998 deletions(-) delete mode 100644 test/unported/aliases-cdumper-bug.code delete mode 100644 test/unported/aliases.events delete mode 100644 test/unported/documents.events delete mode 100644 test/unported/emit-block-scalar-in-simple-key-context-bug.canonical delete mode 100644 test/unported/emit-block-scalar-in-simple-key-context-bug.data delete mode 100644 test/unported/emitting-unacceptable-unicode-character-bug.skip-ext delete mode 100644 test/unported/empty-anchor.emitter-error delete mode 100644 test/unported/empty-document-bug.canonical delete mode 100644 test/unported/empty-document-bug.data delete mode 100644 test/unported/empty-document-bug.empty delete mode 100644 test/unported/empty-tag-handle.emitter-error delete mode 100644 test/unported/empty-tag-prefix.emitter-error delete mode 100644 test/unported/empty-tag.emitter-error delete mode 100644 test/unported/expected-document-end.emitter-error delete mode 100644 test/unported/expected-document-start.emitter-error delete mode 100644 test/unported/expected-node-1.emitter-error delete mode 100644 test/unported/expected-node-2.emitter-error delete mode 100644 test/unported/expected-nothing.emitter-error delete mode 100644 test/unported/expected-stream-start.emitter-error delete mode 100644 test/unported/invalid-anchor.emitter-error delete mode 100644 test/unported/invalid-tag-handle-1.emitter-error delete mode 100644 test/unported/invalid-tag-handle-2.emitter-error delete mode 100644 test/unported/invalid-utf8-byte.loader-error delete mode 100644 test/unported/invalid-utf8-byte.stream-error delete mode 100644 test/unported/latin.unicode delete mode 100644 test/unported/mappings.events delete mode 100644 test/unported/no-alias-anchor.emitter-error delete mode 100644 test/unported/no-alias-anchor.skip-ext delete mode 100644 test/unported/no-tag.emitter-error delete mode 100644 test/unported/recursive-anchor.former-loader-error delete mode 100644 test/unported/recursive-dict.recursive delete mode 100644 test/unported/recursive-list.recursive delete mode 100644 test/unported/recursive-set.recursive delete mode 100644 test/unported/recursive-state.recursive delete mode 100644 test/unported/recursive-tuple.recursive delete mode 100644 test/unported/recursive.former-dumper-error delete mode 100644 test/unported/resolver.data delete mode 100644 test/unported/run-parser-crash-bug.data delete mode 100644 test/unported/scalars.events delete mode 100644 test/unported/scan-document-end-bug.canonical delete mode 100644 test/unported/scan-document-end-bug.data delete mode 100644 test/unported/scan-line-break-bug.canonical delete mode 100644 test/unported/scan-line-break-bug.data delete mode 100644 test/unported/sequences.events delete mode 100644 test/unported/serializer-is-already-opened.dumper-error delete mode 100644 test/unported/serializer-is-closed-1.dumper-error delete mode 100644 test/unported/serializer-is-closed-2.dumper-error delete mode 100644 test/unported/serializer-is-not-opened-1.dumper-error delete mode 100644 test/unported/serializer-is-not-opened-2.dumper-error delete mode 100644 test/unported/sloppy-indentation.canonical delete mode 100644 test/unported/sloppy-indentation.data delete mode 100644 test/unported/spec-02-01.data delete mode 100644 test/unported/spec-02-02.data delete mode 100644 test/unported/spec-02-03.data delete mode 100644 test/unported/spec-02-04.data delete mode 100644 test/unported/spec-02-05.data delete mode 100644 test/unported/spec-02-06.data delete mode 100644 test/unported/spec-02-07.data delete mode 100644 test/unported/spec-02-08.data delete mode 100644 test/unported/spec-02-09.data delete mode 100644 test/unported/spec-02-10.data delete mode 100644 test/unported/spec-02-11.data delete mode 100644 test/unported/spec-02-12.data delete mode 100644 test/unported/spec-02-13.data delete mode 100644 test/unported/spec-02-14.data delete mode 100644 test/unported/spec-02-15.data delete mode 100644 test/unported/spec-02-16.data delete mode 100644 test/unported/spec-02-17.data delete mode 100644 test/unported/spec-02-18.data delete mode 100644 test/unported/spec-02-19.data delete mode 100644 test/unported/spec-02-20.data delete mode 100644 test/unported/spec-02-21.data delete mode 100644 test/unported/spec-02-22.data delete mode 100644 test/unported/spec-02-23.data delete mode 100644 test/unported/spec-02-24.data delete mode 100644 test/unported/spec-02-25.data delete mode 100644 test/unported/spec-02-26.data delete mode 100644 test/unported/spec-02-27.data delete mode 100644 test/unported/spec-02-28.data delete mode 100644 test/unported/spec-05-01-utf8.data delete mode 100644 test/unported/spec-05-01-utf8.empty delete mode 100644 test/unported/spec-05-02-utf8.data delete mode 100644 test/unported/spec-05-02-utf8.error delete mode 100644 test/unported/spec-05-03.canonical delete mode 100644 test/unported/spec-05-03.data delete mode 100644 test/unported/spec-05-04.canonical delete mode 100644 test/unported/spec-05-04.data delete mode 100644 test/unported/spec-05-05.data delete mode 100644 test/unported/spec-05-05.empty delete mode 100644 test/unported/spec-05-06.canonical delete mode 100644 test/unported/spec-05-06.data delete mode 100644 test/unported/spec-05-07.canonical delete mode 100644 test/unported/spec-05-07.data delete mode 100644 test/unported/spec-05-08.canonical delete mode 100644 test/unported/spec-05-08.data delete mode 100644 test/unported/spec-05-09.canonical delete mode 100644 test/unported/spec-05-09.data delete mode 100644 test/unported/spec-05-10.data delete mode 100644 test/unported/spec-05-10.error delete mode 100644 test/unported/spec-05-11.canonical delete mode 100644 test/unported/spec-05-11.data delete mode 100644 test/unported/spec-05-12.data delete mode 100644 test/unported/spec-05-12.error delete mode 100644 test/unported/spec-05-13.canonical delete mode 100644 test/unported/spec-05-13.data delete mode 100644 test/unported/spec-05-14.canonical delete mode 100644 test/unported/spec-05-14.data delete mode 100644 test/unported/spec-05-15.data delete mode 100644 test/unported/spec-05-15.error delete mode 100644 test/unported/spec-06-01.canonical delete mode 100644 test/unported/spec-06-01.data delete mode 100644 test/unported/spec-06-02.data delete mode 100644 test/unported/spec-06-02.empty delete mode 100644 test/unported/spec-06-03.canonical delete mode 100644 test/unported/spec-06-03.data delete mode 100644 test/unported/spec-06-04.canonical delete mode 100644 test/unported/spec-06-04.data delete mode 100644 test/unported/spec-06-05.canonical delete mode 100644 test/unported/spec-06-05.data delete mode 100644 test/unported/spec-06-06.canonical delete mode 100644 test/unported/spec-06-06.data delete mode 100644 test/unported/spec-06-07.canonical delete mode 100644 test/unported/spec-06-07.data delete mode 100644 test/unported/spec-06-08.canonical delete mode 100644 test/unported/spec-06-08.data delete mode 100644 test/unported/spec-07-01.canonical delete mode 100644 test/unported/spec-07-01.data delete mode 100644 test/unported/spec-07-01.skip-ext delete mode 100644 test/unported/spec-07-02.canonical delete mode 100644 test/unported/spec-07-02.data delete mode 100644 test/unported/spec-07-02.skip-ext delete mode 100644 test/unported/spec-07-03.data delete mode 100644 test/unported/spec-07-03.error delete mode 100644 test/unported/spec-07-04.canonical delete mode 100644 test/unported/spec-07-04.data delete mode 100644 test/unported/spec-07-05.data delete mode 100644 test/unported/spec-07-05.error delete mode 100644 test/unported/spec-07-06.canonical delete mode 100644 test/unported/spec-07-06.data delete mode 100644 test/unported/spec-07-07a.canonical delete mode 100644 test/unported/spec-07-07a.data delete mode 100644 test/unported/spec-07-07b.canonical delete mode 100644 test/unported/spec-07-07b.data delete mode 100644 test/unported/spec-07-08.canonical delete mode 100644 test/unported/spec-07-08.data delete mode 100644 test/unported/spec-07-09.canonical delete mode 100644 test/unported/spec-07-09.data delete mode 100644 test/unported/spec-07-10.canonical delete mode 100644 test/unported/spec-07-10.data delete mode 100644 test/unported/spec-07-11.data delete mode 100644 test/unported/spec-07-11.empty delete mode 100644 test/unported/spec-07-12a.canonical delete mode 100644 test/unported/spec-07-12a.data delete mode 100644 test/unported/spec-07-12b.canonical delete mode 100644 test/unported/spec-07-12b.data delete mode 100644 test/unported/spec-07-13.canonical delete mode 100644 test/unported/spec-07-13.data delete mode 100644 test/unported/spec-08-01.canonical delete mode 100644 test/unported/spec-08-01.data delete mode 100644 test/unported/spec-08-02.canonical delete mode 100644 test/unported/spec-08-02.data delete mode 100644 test/unported/spec-08-03.canonical delete mode 100644 test/unported/spec-08-03.data delete mode 100644 test/unported/spec-08-04.data delete mode 100644 test/unported/spec-08-04.error delete mode 100644 test/unported/spec-08-05.canonical delete mode 100644 test/unported/spec-08-05.data delete mode 100644 test/unported/spec-08-06.data delete mode 100644 test/unported/spec-08-06.error delete mode 100644 test/unported/spec-08-07.canonical delete mode 100644 test/unported/spec-08-07.data delete mode 100644 test/unported/spec-08-08.canonical delete mode 100644 test/unported/spec-08-08.data delete mode 100644 test/unported/spec-08-09.canonical delete mode 100644 test/unported/spec-08-09.data delete mode 100644 test/unported/spec-08-10.canonical delete mode 100644 test/unported/spec-08-10.data delete mode 100644 test/unported/spec-08-11.canonical delete mode 100644 test/unported/spec-08-11.data delete mode 100644 test/unported/spec-08-12.canonical delete mode 100644 test/unported/spec-08-12.data delete mode 100644 test/unported/spec-08-13.canonical delete mode 100644 test/unported/spec-08-13.data delete mode 100644 test/unported/spec-08-13.skip-ext delete mode 100644 test/unported/spec-08-14.canonical delete mode 100644 test/unported/spec-08-14.data delete mode 100644 test/unported/spec-08-15.canonical delete mode 100644 test/unported/spec-08-15.data delete mode 100644 test/unported/spec-09-01.canonical delete mode 100644 test/unported/spec-09-01.data delete mode 100644 test/unported/spec-09-02.canonical delete mode 100644 test/unported/spec-09-02.data delete mode 100644 test/unported/spec-09-03.canonical delete mode 100644 test/unported/spec-09-03.data delete mode 100644 test/unported/spec-09-04.canonical delete mode 100644 test/unported/spec-09-04.data delete mode 100644 test/unported/spec-09-05.canonical delete mode 100644 test/unported/spec-09-05.data delete mode 100644 test/unported/spec-09-06.canonical delete mode 100644 test/unported/spec-09-06.data delete mode 100644 test/unported/spec-09-07.canonical delete mode 100644 test/unported/spec-09-07.data delete mode 100644 test/unported/spec-09-08.canonical delete mode 100644 test/unported/spec-09-08.data delete mode 100644 test/unported/spec-09-09.canonical delete mode 100644 test/unported/spec-09-09.data delete mode 100644 test/unported/spec-09-10.canonical delete mode 100644 test/unported/spec-09-10.data delete mode 100644 test/unported/spec-09-11.canonical delete mode 100644 test/unported/spec-09-11.data delete mode 100644 test/unported/spec-09-12.canonical delete mode 100644 test/unported/spec-09-12.data delete mode 100644 test/unported/spec-09-13.canonical delete mode 100644 test/unported/spec-09-13.data delete mode 100644 test/unported/spec-09-14.data delete mode 100644 test/unported/spec-09-14.error delete mode 100644 test/unported/spec-09-15.canonical delete mode 100644 test/unported/spec-09-15.data delete mode 100644 test/unported/spec-09-16.canonical delete mode 100644 test/unported/spec-09-16.data delete mode 100644 test/unported/spec-09-17.canonical delete mode 100644 test/unported/spec-09-17.data delete mode 100644 test/unported/spec-09-18.canonical delete mode 100644 test/unported/spec-09-18.data delete mode 100644 test/unported/spec-09-19.canonical delete mode 100644 test/unported/spec-09-19.data delete mode 100644 test/unported/spec-09-20.canonical delete mode 100644 test/unported/spec-09-20.data delete mode 100644 test/unported/spec-09-20.skip-ext delete mode 100644 test/unported/spec-09-21.data delete mode 100644 test/unported/spec-09-21.error delete mode 100644 test/unported/spec-09-22.canonical delete mode 100644 test/unported/spec-09-22.data delete mode 100644 test/unported/spec-09-23.canonical delete mode 100644 test/unported/spec-09-23.data delete mode 100644 test/unported/spec-09-24.canonical delete mode 100644 test/unported/spec-09-24.data delete mode 100644 test/unported/spec-09-25.canonical delete mode 100644 test/unported/spec-09-25.data delete mode 100644 test/unported/spec-09-26.canonical delete mode 100644 test/unported/spec-09-26.data delete mode 100644 test/unported/spec-09-27.canonical delete mode 100644 test/unported/spec-09-27.data delete mode 100644 test/unported/spec-09-28.canonical delete mode 100644 test/unported/spec-09-28.data delete mode 100644 test/unported/spec-09-29.canonical delete mode 100644 test/unported/spec-09-29.data delete mode 100644 test/unported/spec-09-30.canonical delete mode 100644 test/unported/spec-09-30.data delete mode 100644 test/unported/spec-09-31.canonical delete mode 100644 test/unported/spec-09-31.data delete mode 100644 test/unported/spec-09-32.canonical delete mode 100644 test/unported/spec-09-32.data delete mode 100644 test/unported/spec-09-33.canonical delete mode 100644 test/unported/spec-09-33.data delete mode 100644 test/unported/spec-10-01.canonical delete mode 100644 test/unported/spec-10-01.data delete mode 100644 test/unported/spec-10-02.canonical delete mode 100644 test/unported/spec-10-02.data delete mode 100644 test/unported/spec-10-03.canonical delete mode 100644 test/unported/spec-10-03.data delete mode 100644 test/unported/spec-10-04.canonical delete mode 100644 test/unported/spec-10-04.data delete mode 100644 test/unported/spec-10-05.canonical delete mode 100644 test/unported/spec-10-05.data delete mode 100644 test/unported/spec-10-06.canonical delete mode 100644 test/unported/spec-10-06.data delete mode 100644 test/unported/spec-10-07.canonical delete mode 100644 test/unported/spec-10-07.data delete mode 100644 test/unported/spec-10-08.data delete mode 100644 test/unported/spec-10-08.error delete mode 100644 test/unported/spec-10-09.canonical delete mode 100644 test/unported/spec-10-09.data delete mode 100644 test/unported/spec-10-10.canonical delete mode 100644 test/unported/spec-10-10.data delete mode 100644 test/unported/spec-10-11.canonical delete mode 100644 test/unported/spec-10-11.data delete mode 100644 test/unported/spec-10-12.canonical delete mode 100644 test/unported/spec-10-12.data delete mode 100644 test/unported/spec-10-13.canonical delete mode 100644 test/unported/spec-10-13.data delete mode 100644 test/unported/spec-10-14.canonical delete mode 100644 test/unported/spec-10-14.data delete mode 100644 test/unported/spec-10-15.canonical delete mode 100644 test/unported/spec-10-15.data delete mode 100644 test/unported/tags.events delete mode 100644 test/unported/unknown.dumper-error delete mode 100644 test/unported/unsupported-version.emitter-error delete mode 100644 test/unsupported/bool.detect delete mode 100644 test/unsupported/colon-in-flow-context.loader-error delete mode 100644 test/unsupported/construct-python-bool.code delete mode 100644 test/unsupported/construct-python-bool.data delete mode 100644 test/unsupported/construct-python-bytes-py3.code delete mode 100644 test/unsupported/construct-python-bytes-py3.data delete mode 100644 test/unsupported/construct-python-complex.code delete mode 100644 test/unsupported/construct-python-complex.data delete mode 100644 test/unsupported/construct-python-float.code delete mode 100644 test/unsupported/construct-python-float.data delete mode 100644 test/unsupported/construct-python-int.code delete mode 100644 test/unsupported/construct-python-int.data delete mode 100644 test/unsupported/construct-python-long-short-py2.code delete mode 100644 test/unsupported/construct-python-long-short-py2.data delete mode 100644 test/unsupported/construct-python-long-short-py3.code delete mode 100644 test/unsupported/construct-python-long-short-py3.data delete mode 100644 test/unsupported/construct-python-name-module.code delete mode 100644 test/unsupported/construct-python-name-module.data delete mode 100644 test/unsupported/construct-python-none.code delete mode 100644 test/unsupported/construct-python-none.data delete mode 100644 test/unsupported/construct-python-object.code delete mode 100644 test/unsupported/construct-python-object.data delete mode 100644 test/unsupported/construct-python-str-ascii.code delete mode 100644 test/unsupported/construct-python-str-ascii.data delete mode 100644 test/unsupported/construct-python-str-utf8-py2.code delete mode 100644 test/unsupported/construct-python-str-utf8-py2.data delete mode 100644 test/unsupported/construct-python-str-utf8-py3.code delete mode 100644 test/unsupported/construct-python-str-utf8-py3.data delete mode 100644 test/unsupported/construct-python-tuple-list-dict.code delete mode 100644 test/unsupported/construct-python-tuple-list-dict.data delete mode 100644 test/unsupported/construct-python-unicode-ascii-py2.code delete mode 100644 test/unsupported/construct-python-unicode-ascii-py2.data delete mode 100644 test/unsupported/construct-python-unicode-ascii-py3.code delete mode 100644 test/unsupported/construct-python-unicode-ascii-py3.data delete mode 100644 test/unsupported/construct-python-unicode-utf8-py2.code delete mode 100644 test/unsupported/construct-python-unicode-utf8-py2.data delete mode 100644 test/unsupported/construct-python-unicode-utf8-py3.code delete mode 100644 test/unsupported/construct-python-unicode-utf8-py3.data delete mode 100644 test/unsupported/duplicate-anchor-1.loader-error delete mode 100644 test/unsupported/duplicate-anchor-2.loader-error delete mode 100644 test/unsupported/duplicate-mapping-key.data delete mode 100644 test/unsupported/empty-python-module.loader-error delete mode 100644 test/unsupported/empty-python-name.loader-error delete mode 100644 test/unsupported/float-representer-2.3-bug.code delete mode 100644 test/unsupported/float-representer-2.3-bug.data delete mode 100644 test/unsupported/float.detect delete mode 100644 test/unsupported/function.detect delete mode 100644 test/unsupported/int.detect delete mode 100644 test/unsupported/invalid-anchor-1.loader-error delete mode 100644 test/unsupported/invalid-python-bytes-2-py3.loader-error delete mode 100644 test/unsupported/invalid-python-bytes-py3.loader-error delete mode 100644 test/unsupported/invalid-python-module-kind.loader-error delete mode 100644 test/unsupported/invalid-python-module-value.loader-error delete mode 100644 test/unsupported/invalid-python-module.loader-error delete mode 100644 test/unsupported/invalid-python-name-kind.loader-error delete mode 100644 test/unsupported/invalid-python-name-module-2.loader-error delete mode 100644 test/unsupported/invalid-python-name-module.loader-error delete mode 100644 test/unsupported/invalid-python-name-object.loader-error delete mode 100644 test/unsupported/invalid-python-name-value.loader-error delete mode 100644 test/unsupported/invalid-tag-1.loader-error delete mode 100644 test/unsupported/invalid-tag-directive-prefix.loader-error delete mode 100644 test/unsupported/invalid-uri-escapes-2.loader-error delete mode 100644 test/unsupported/invalid-uri-escapes-3.loader-error delete mode 100644 test/unsupported/merge.detect delete mode 100644 test/unsupported/null.detect delete mode 100644 test/unsupported/odd-utf16.stream-error delete mode 100644 test/unsupported/spec-02-01.structure delete mode 100644 test/unsupported/spec-02-01.tokens delete mode 100644 test/unsupported/spec-02-02.structure delete mode 100644 test/unsupported/spec-02-02.tokens delete mode 100644 test/unsupported/spec-02-03.structure delete mode 100644 test/unsupported/spec-02-03.tokens delete mode 100644 test/unsupported/spec-02-04.structure delete mode 100644 test/unsupported/spec-02-04.tokens delete mode 100644 test/unsupported/spec-02-05.structure delete mode 100644 test/unsupported/spec-02-05.tokens delete mode 100644 test/unsupported/spec-02-06.structure delete mode 100644 test/unsupported/spec-02-06.tokens delete mode 100644 test/unsupported/spec-02-07.structure delete mode 100644 test/unsupported/spec-02-07.tokens delete mode 100644 test/unsupported/spec-02-08.structure delete mode 100644 test/unsupported/spec-02-08.tokens delete mode 100644 test/unsupported/spec-02-09.structure delete mode 100644 test/unsupported/spec-02-09.tokens delete mode 100644 test/unsupported/spec-02-10.structure delete mode 100644 test/unsupported/spec-02-10.tokens delete mode 100644 test/unsupported/spec-02-11.structure delete mode 100644 test/unsupported/spec-02-11.tokens delete mode 100644 test/unsupported/spec-02-12.structure delete mode 100644 test/unsupported/spec-02-12.tokens delete mode 100644 test/unsupported/spec-02-13.structure delete mode 100644 test/unsupported/spec-02-13.tokens delete mode 100644 test/unsupported/spec-02-14.structure delete mode 100644 test/unsupported/spec-02-14.tokens delete mode 100644 test/unsupported/spec-02-15.structure delete mode 100644 test/unsupported/spec-02-15.tokens delete mode 100644 test/unsupported/spec-02-16.structure delete mode 100644 test/unsupported/spec-02-16.tokens delete mode 100644 test/unsupported/spec-02-17.structure delete mode 100644 test/unsupported/spec-02-17.tokens delete mode 100644 test/unsupported/spec-02-18.structure delete mode 100644 test/unsupported/spec-02-18.tokens delete mode 100644 test/unsupported/spec-02-19.structure delete mode 100644 test/unsupported/spec-02-19.tokens delete mode 100644 test/unsupported/spec-02-20.structure delete mode 100644 test/unsupported/spec-02-20.tokens delete mode 100644 test/unsupported/spec-02-21.structure delete mode 100644 test/unsupported/spec-02-21.tokens delete mode 100644 test/unsupported/spec-02-22.structure delete mode 100644 test/unsupported/spec-02-22.tokens delete mode 100644 test/unsupported/spec-02-23.structure delete mode 100644 test/unsupported/spec-02-23.tokens delete mode 100644 test/unsupported/spec-02-24.structure delete mode 100644 test/unsupported/spec-02-24.tokens delete mode 100644 test/unsupported/spec-02-25.structure delete mode 100644 test/unsupported/spec-02-25.tokens delete mode 100644 test/unsupported/spec-02-26.structure delete mode 100644 test/unsupported/spec-02-26.tokens delete mode 100644 test/unsupported/spec-02-27.structure delete mode 100644 test/unsupported/spec-02-27.tokens delete mode 100644 test/unsupported/spec-02-28.structure delete mode 100644 test/unsupported/spec-02-28.tokens delete mode 100644 test/unsupported/spec-05-01-utf16be.data delete mode 100644 test/unsupported/spec-05-01-utf16be.empty delete mode 100644 test/unsupported/spec-05-01-utf16le.data delete mode 100644 test/unsupported/spec-05-01-utf16le.empty delete mode 100644 test/unsupported/spec-05-02-utf16be.data delete mode 100644 test/unsupported/spec-05-02-utf16be.error delete mode 100644 test/unsupported/spec-05-02-utf16le.data delete mode 100644 test/unsupported/spec-05-02-utf16le.error delete mode 100644 test/unsupported/str.detect delete mode 100644 test/unsupported/timestamp.detect delete mode 100644 test/unsupported/undefined-constructor.loader-error delete mode 100644 test/unsupported/utf16be.code delete mode 100644 test/unsupported/utf16be.data delete mode 100644 test/unsupported/utf16le.code delete mode 100644 test/unsupported/utf16le.data delete mode 100644 test/unsupported/value.data delete mode 100644 test/unsupported/value.detect delete mode 100644 test/unsupported/yaml.data delete mode 100644 test/unsupported/yaml.detect diff --git a/test/unported/aliases-cdumper-bug.code b/test/unported/aliases-cdumper-bug.code deleted file mode 100644 index 01684417..00000000 --- a/test/unported/aliases-cdumper-bug.code +++ /dev/null @@ -1 +0,0 @@ -[ today, today ] diff --git a/test/unported/aliases.events b/test/unported/aliases.events deleted file mode 100644 index 9139b515..00000000 --- a/test/unported/aliases.events +++ /dev/null @@ -1,8 +0,0 @@ -- !StreamStart -- !DocumentStart -- !SequenceStart -- !Scalar { anchor: 'myanchor', tag: '!mytag', value: 'data' } -- !Alias { anchor: 'myanchor' } -- !SequenceEnd -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/documents.events b/test/unported/documents.events deleted file mode 100644 index 775a51a7..00000000 --- a/test/unported/documents.events +++ /dev/null @@ -1,11 +0,0 @@ -- !StreamStart -- !DocumentStart { explicit: false } -- !Scalar { implicit: [true,false], value: 'data' } -- !DocumentEnd -- !DocumentStart -- !Scalar { implicit: [true,false] } -- !DocumentEnd -- !DocumentStart { version: [1,1], tags: { '!': '!foo', '!yaml!': 'tag:yaml.org,2002:', '!ugly!': '!!!!!!!' } } -- !Scalar { implicit: [true,false] } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/emit-block-scalar-in-simple-key-context-bug.canonical b/test/unported/emit-block-scalar-in-simple-key-context-bug.canonical deleted file mode 100644 index 473bed5d..00000000 --- a/test/unported/emit-block-scalar-in-simple-key-context-bug.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- !!map -{ - ? !!str "foo" - : !!str "bar" -} diff --git a/test/unported/emit-block-scalar-in-simple-key-context-bug.data b/test/unported/emit-block-scalar-in-simple-key-context-bug.data deleted file mode 100644 index b6b42ba5..00000000 --- a/test/unported/emit-block-scalar-in-simple-key-context-bug.data +++ /dev/null @@ -1,4 +0,0 @@ -? |- - foo -: |- - bar diff --git a/test/unported/emitting-unacceptable-unicode-character-bug.skip-ext b/test/unported/emitting-unacceptable-unicode-character-bug.skip-ext deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unported/empty-anchor.emitter-error b/test/unported/empty-anchor.emitter-error deleted file mode 100644 index ce663b63..00000000 --- a/test/unported/empty-anchor.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart -- !Scalar { anchor: '', value: 'foo' } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/empty-document-bug.canonical b/test/unported/empty-document-bug.canonical deleted file mode 100644 index 28a6cf13..00000000 --- a/test/unported/empty-document-bug.canonical +++ /dev/null @@ -1 +0,0 @@ -# This YAML stream contains no YAML documents. diff --git a/test/unported/empty-document-bug.data b/test/unported/empty-document-bug.data deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unported/empty-document-bug.empty b/test/unported/empty-document-bug.empty deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unported/empty-tag-handle.emitter-error b/test/unported/empty-tag-handle.emitter-error deleted file mode 100644 index 235c8998..00000000 --- a/test/unported/empty-tag-handle.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart { tags: { '': 'bar' } } -- !Scalar { value: 'foo' } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/empty-tag-prefix.emitter-error b/test/unported/empty-tag-prefix.emitter-error deleted file mode 100644 index c6c0e955..00000000 --- a/test/unported/empty-tag-prefix.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart { tags: { '!': '' } } -- !Scalar { value: 'foo' } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/empty-tag.emitter-error b/test/unported/empty-tag.emitter-error deleted file mode 100644 index b7ca5931..00000000 --- a/test/unported/empty-tag.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart -- !Scalar { tag: '', value: 'key', implicit: [false,false] } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/expected-document-end.emitter-error b/test/unported/expected-document-end.emitter-error deleted file mode 100644 index 0cbab899..00000000 --- a/test/unported/expected-document-end.emitter-error +++ /dev/null @@ -1,6 +0,0 @@ -- !StreamStart -- !DocumentStart -- !Scalar { value: 'data 1' } -- !Scalar { value: 'data 2' } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/expected-document-start.emitter-error b/test/unported/expected-document-start.emitter-error deleted file mode 100644 index 8ce575ec..00000000 --- a/test/unported/expected-document-start.emitter-error +++ /dev/null @@ -1,4 +0,0 @@ -- !StreamStart -- !MappingStart -- !MappingEnd -- !StreamEnd diff --git a/test/unported/expected-node-1.emitter-error b/test/unported/expected-node-1.emitter-error deleted file mode 100644 index 36ceca3e..00000000 --- a/test/unported/expected-node-1.emitter-error +++ /dev/null @@ -1,4 +0,0 @@ -- !StreamStart -- !DocumentStart -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/expected-node-2.emitter-error b/test/unported/expected-node-2.emitter-error deleted file mode 100644 index 891ee370..00000000 --- a/test/unported/expected-node-2.emitter-error +++ /dev/null @@ -1,7 +0,0 @@ -- !StreamStart -- !DocumentStart -- !MappingStart -- !Scalar { value: 'key' } -- !MappingEnd -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/expected-nothing.emitter-error b/test/unported/expected-nothing.emitter-error deleted file mode 100644 index 62c54d3e..00000000 --- a/test/unported/expected-nothing.emitter-error +++ /dev/null @@ -1,4 +0,0 @@ -- !StreamStart -- !StreamEnd -- !StreamStart -- !StreamEnd diff --git a/test/unported/expected-stream-start.emitter-error b/test/unported/expected-stream-start.emitter-error deleted file mode 100644 index 480dc2eb..00000000 --- a/test/unported/expected-stream-start.emitter-error +++ /dev/null @@ -1,2 +0,0 @@ -- !DocumentStart -- !DocumentEnd diff --git a/test/unported/invalid-anchor.emitter-error b/test/unported/invalid-anchor.emitter-error deleted file mode 100644 index 3d2a8148..00000000 --- a/test/unported/invalid-anchor.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart -- !Scalar { anchor: '5*5=25', value: 'foo' } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/invalid-tag-handle-1.emitter-error b/test/unported/invalid-tag-handle-1.emitter-error deleted file mode 100644 index d5df9a26..00000000 --- a/test/unported/invalid-tag-handle-1.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart { tags: { '!foo': 'bar' } } -- !Scalar { value: 'foo' } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/invalid-tag-handle-2.emitter-error b/test/unported/invalid-tag-handle-2.emitter-error deleted file mode 100644 index d1831d55..00000000 --- a/test/unported/invalid-tag-handle-2.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart { tags: { '!!!': 'bar' } } -- !Scalar { value: 'foo' } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/invalid-utf8-byte.loader-error b/test/unported/invalid-utf8-byte.loader-error deleted file mode 100644 index 0a58c70f..00000000 --- a/test/unported/invalid-utf8-byte.loader-error +++ /dev/null @@ -1,66 +0,0 @@ -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -Invalid byte ('\xFF'): <-- -############################################################### diff --git a/test/unported/invalid-utf8-byte.stream-error b/test/unported/invalid-utf8-byte.stream-error deleted file mode 100644 index 0a58c70f..00000000 --- a/test/unported/invalid-utf8-byte.stream-error +++ /dev/null @@ -1,66 +0,0 @@ -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -############################################################### -Invalid byte ('\xFF'): <-- -############################################################### diff --git a/test/unported/latin.unicode b/test/unported/latin.unicode deleted file mode 100644 index 4fb799c2..00000000 --- a/test/unported/latin.unicode +++ /dev/null @@ -1,384 +0,0 @@ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ -ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊ -ËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ -ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐ -őŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƒ -ƓƔƕƖƗƘƙƚƛƜƝƞƟƠơƢƣƤƥƦƧƨƩƪƫƬƭƮƯưƱƲƳƴƵƶƷƸƹƺƼƽƾƿDŽdžLJljNJnjǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜ -ǝǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZdzǴǵǶǷǸǹǺǻǼǽǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚțȜȝȞȟ -ȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀɁɐɑɒɓɔɕɖɗɘəɚɛɜɝɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯ -ɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀʁʂʃʄʅʆʇʈʉʊʋʌʍʎʏʐʑʒʓʔʕʖʗʘʙʚʛʜʝʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯΆΈ -ΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύ -ώϐϑϒϓϔϕϖϗϘϙϚϛϜϝϞϟϠϡϢϣϤϥϦϧϨϩϪϫϬϭϮϯϰϱϲϳϴϵϷϸϹϺϻϼϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБ -ВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓ -єѕіїјљњћќѝўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀҁҊҋҌҍҎҏҐґҒғҔҕҖҗҘҙҚқҜҝ -ҞҟҠҡҢңҤҥҦҧҨҩҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽҾҿӀӁӂӃӄӅӆӇӈӉӊӋӌӍӎӐӑӒӓӔӕӖӗӘәӚӛӜӝӞӟӠ -ӡӢӣӤӥӦӧӨөӪӫӬӭӮӯӰӱӲӳӴӵӶӷӸӹԀԁԂԃԄԅԆԇԈԉԊԋԌԍԎԏԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉ -ՊՋՌՍՎՏՐՑՒՓՔՕՖաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆևႠႡႢႣႤႥႦႧႨႩႪႫႬႭ -ႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅᴀᴁᴂᴃᴄᴅᴆᴇᴈᴉᴊᴋᴌᴍᴎᴏᴐᴑᴒᴓᴔᴕᴖᴗᴘᴙᴚᴛᴜᴝᴞᴟᴠᴡᴢᴣᴤᴥᴦᴧᴨᴩ -ᴪᴫᵢᵣᵤᵥᵦᵧᵨᵩᵪᵫᵬᵭᵮᵯᵰᵱᵲᵳᵴᵵᵶᵷᵹᵺᵻᵼᵽᵾᵿᶀᶁᶂᶃᶄᶅᶆᶇᶈᶉᶊᶋᶌᶍᶎᶏᶐᶑᶒᶓᶔᶕᶖᶗᶘᶙᶚḀḁḂḃḄḅḆḇ -ḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉ -ṊṋṌṍṎṏṐṑṒṓṔṕṖṗṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋ -ẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐố -ỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹἀἁἂἃἄἅἆἇἈἉἊἋἌἍἎἏἐἑἒἓἔἕἘἙἚἛ -ἜἝἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀὁὂὃὄὅὈὉὊὋὌὍὐὑὒὓὔὕὖὗὙὛὝὟὠὡὢὣὤὥὦὧ -ὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώᾀᾁᾂᾃᾄᾅᾆᾇᾐᾑᾒᾓᾔᾕᾖᾗᾠᾡᾢᾣᾤᾥᾦᾧᾰᾱᾲᾳᾴᾶᾷᾸᾹᾺΆιῂῃῄῆῇῈΈῊ -ΉῐῑῒΐῖῗῘῙῚΊῠῡῢΰῤῥῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏⁱⁿℂℇℊℋℌℍℎℏℐℑℒℓℕℙℚℛℜℝℤΩℨKÅℬℭℯℰℱℳℴℹ diff --git a/test/unported/mappings.events b/test/unported/mappings.events deleted file mode 100644 index 3cb5579f..00000000 --- a/test/unported/mappings.events +++ /dev/null @@ -1,44 +0,0 @@ -- !StreamStart - -- !DocumentStart -- !MappingStart -- !Scalar { implicit: [true,true], value: 'key' } -- !Scalar { implicit: [true,true], value: 'value' } -- !Scalar { implicit: [true,true], value: 'empty mapping' } -- !MappingStart -- !MappingEnd -- !Scalar { implicit: [true,true], value: 'empty mapping with tag' } -- !MappingStart { tag: '!mytag', implicit: false } -- !MappingEnd -- !Scalar { implicit: [true,true], value: 'block mapping' } -- !MappingStart -- !MappingStart -- !Scalar { implicit: [true,true], value: 'complex' } -- !Scalar { implicit: [true,true], value: 'key' } -- !Scalar { implicit: [true,true], value: 'complex' } -- !Scalar { implicit: [true,true], value: 'key' } -- !MappingEnd -- !MappingStart -- !Scalar { implicit: [true,true], value: 'complex' } -- !Scalar { implicit: [true,true], value: 'key' } -- !MappingEnd -- !MappingEnd -- !Scalar { implicit: [true,true], value: 'flow mapping' } -- !MappingStart { flow_style: true } -- !Scalar { implicit: [true,true], value: 'key' } -- !Scalar { implicit: [true,true], value: 'value' } -- !MappingStart -- !Scalar { implicit: [true,true], value: 'complex' } -- !Scalar { implicit: [true,true], value: 'key' } -- !Scalar { implicit: [true,true], value: 'complex' } -- !Scalar { implicit: [true,true], value: 'key' } -- !MappingEnd -- !MappingStart -- !Scalar { implicit: [true,true], value: 'complex' } -- !Scalar { implicit: [true,true], value: 'key' } -- !MappingEnd -- !MappingEnd -- !MappingEnd -- !DocumentEnd - -- !StreamEnd diff --git a/test/unported/no-alias-anchor.emitter-error b/test/unported/no-alias-anchor.emitter-error deleted file mode 100644 index 5ff065c1..00000000 --- a/test/unported/no-alias-anchor.emitter-error +++ /dev/null @@ -1,8 +0,0 @@ -- !StreamStart -- !DocumentStart -- !SequenceStart -- !Scalar { anchor: A, value: data } -- !Alias { } -- !SequenceEnd -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/no-alias-anchor.skip-ext b/test/unported/no-alias-anchor.skip-ext deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unported/no-tag.emitter-error b/test/unported/no-tag.emitter-error deleted file mode 100644 index 384c62f0..00000000 --- a/test/unported/no-tag.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart -- !Scalar { value: 'foo', implicit: [false,false] } -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/recursive-anchor.former-loader-error b/test/unported/recursive-anchor.former-loader-error deleted file mode 100644 index 661166ce..00000000 --- a/test/unported/recursive-anchor.former-loader-error +++ /dev/null @@ -1,4 +0,0 @@ -- &foo [1 - 2, - 3, - *foo] diff --git a/test/unported/recursive-dict.recursive b/test/unported/recursive-dict.recursive deleted file mode 100644 index 8f326f5e..00000000 --- a/test/unported/recursive-dict.recursive +++ /dev/null @@ -1,3 +0,0 @@ -value = {} -instance = AnInstance(value, value) -value[instance] = instance diff --git a/test/unported/recursive-list.recursive b/test/unported/recursive-list.recursive deleted file mode 100644 index 27a4ae50..00000000 --- a/test/unported/recursive-list.recursive +++ /dev/null @@ -1,2 +0,0 @@ -value = [] -value.append(value) diff --git a/test/unported/recursive-set.recursive b/test/unported/recursive-set.recursive deleted file mode 100644 index 457c50de..00000000 --- a/test/unported/recursive-set.recursive +++ /dev/null @@ -1,7 +0,0 @@ -try: - set -except NameError: - from sets import Set as set -value = set() -value.add(AnInstance(foo=value, bar=value)) -value.add(AnInstance(foo=value, bar=value)) diff --git a/test/unported/recursive-state.recursive b/test/unported/recursive-state.recursive deleted file mode 100644 index bffe61ed..00000000 --- a/test/unported/recursive-state.recursive +++ /dev/null @@ -1,2 +0,0 @@ -value = [] -value.append(AnInstanceWithState(value, value)) diff --git a/test/unported/recursive-tuple.recursive b/test/unported/recursive-tuple.recursive deleted file mode 100644 index dc08d029..00000000 --- a/test/unported/recursive-tuple.recursive +++ /dev/null @@ -1,3 +0,0 @@ -value = ([], []) -value[0].append(value) -value[1].append(value[0]) diff --git a/test/unported/recursive.former-dumper-error b/test/unported/recursive.former-dumper-error deleted file mode 100644 index 3c7cc2f8..00000000 --- a/test/unported/recursive.former-dumper-error +++ /dev/null @@ -1,3 +0,0 @@ -data = [] -data.append(data) -dump(data) diff --git a/test/unported/resolver.data b/test/unported/resolver.data deleted file mode 100644 index a2964048..00000000 --- a/test/unported/resolver.data +++ /dev/null @@ -1,30 +0,0 @@ ---- -"this scalar should be selected" ---- -key11: !foo - key12: - is: [selected] - key22: - key13: [not, selected] - key23: [not, selected] - key32: - key31: [not, selected] - key32: [not, selected] - key33: {not: selected} -key21: !bar - - not selected - - selected - - not selected -key31: !baz - key12: - key13: - key14: {selected} - key23: - key14: [not, selected] - key33: - key14: {selected} - key24: {not: selected} - key22: - - key14: {selected} - key24: {not: selected} - - key14: {selected} diff --git a/test/unported/run-parser-crash-bug.data b/test/unported/run-parser-crash-bug.data deleted file mode 100644 index fe017342..00000000 --- a/test/unported/run-parser-crash-bug.data +++ /dev/null @@ -1,8 +0,0 @@ ---- -- Harry Potter and the Prisoner of Azkaban -- Harry Potter and the Goblet of Fire -- Harry Potter and the Order of the Phoenix ---- -- Memoirs Found in a Bathtub -- Snow Crash -- Ghost World diff --git a/test/unported/scalars.events b/test/unported/scalars.events deleted file mode 100644 index 32c40f46..00000000 --- a/test/unported/scalars.events +++ /dev/null @@ -1,28 +0,0 @@ -- !StreamStart - -- !DocumentStart -- !MappingStart -- !Scalar { implicit: [true,true], value: 'empty scalar' } -- !Scalar { implicit: [true,false], value: '' } -- !Scalar { implicit: [true,true], value: 'implicit scalar' } -- !Scalar { implicit: [true,true], value: 'data' } -- !Scalar { implicit: [true,true], value: 'quoted scalar' } -- !Scalar { value: 'data', style: '"' } -- !Scalar { implicit: [true,true], value: 'block scalar' } -- !Scalar { value: 'data', style: '|' } -- !Scalar { implicit: [true,true], value: 'empty scalar with tag' } -- !Scalar { implicit: [false,false], tag: '!mytag', value: '' } -- !Scalar { implicit: [true,true], value: 'implicit scalar with tag' } -- !Scalar { implicit: [false,false], tag: '!mytag', value: 'data' } -- !Scalar { implicit: [true,true], value: 'quoted scalar with tag' } -- !Scalar { value: 'data', style: '"', tag: '!mytag', implicit: [false,false] } -- !Scalar { implicit: [true,true], value: 'block scalar with tag' } -- !Scalar { value: 'data', style: '|', tag: '!mytag', implicit: [false,false] } -- !Scalar { implicit: [true,true], value: 'single character' } -- !Scalar { value: 'a', implicit: [true,true] } -- !Scalar { implicit: [true,true], value: 'single digit' } -- !Scalar { value: '1', implicit: [true,false] } -- !MappingEnd -- !DocumentEnd - -- !StreamEnd diff --git a/test/unported/scan-document-end-bug.canonical b/test/unported/scan-document-end-bug.canonical deleted file mode 100644 index 4a0e8a82..00000000 --- a/test/unported/scan-document-end-bug.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!null "" diff --git a/test/unported/scan-document-end-bug.data b/test/unported/scan-document-end-bug.data deleted file mode 100644 index 3c70543b..00000000 --- a/test/unported/scan-document-end-bug.data +++ /dev/null @@ -1,3 +0,0 @@ -# Ticket #4 ---- -... \ No newline at end of file diff --git a/test/unported/scan-line-break-bug.canonical b/test/unported/scan-line-break-bug.canonical deleted file mode 100644 index 79f08b74..00000000 --- a/test/unported/scan-line-break-bug.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!map { ? !!str "foo" : !!str "bar baz" } diff --git a/test/unported/scan-line-break-bug.data b/test/unported/scan-line-break-bug.data deleted file mode 100644 index c974fab0..00000000 --- a/test/unported/scan-line-break-bug.data +++ /dev/null @@ -1,3 +0,0 @@ -foo: - bar - baz diff --git a/test/unported/sequences.events b/test/unported/sequences.events deleted file mode 100644 index 692a3290..00000000 --- a/test/unported/sequences.events +++ /dev/null @@ -1,81 +0,0 @@ -- !StreamStart - -- !DocumentStart -- !SequenceStart -- !SequenceEnd -- !DocumentEnd - -- !DocumentStart -- !SequenceStart { tag: '!mytag', implicit: false } -- !SequenceEnd -- !DocumentEnd - -- !DocumentStart -- !SequenceStart -- !SequenceStart -- !SequenceEnd -- !SequenceStart { tag: '!mytag', implicit: false } -- !SequenceEnd -- !SequenceStart -- !Scalar -- !Scalar { value: 'data' } -- !Scalar { tag: '!mytag', implicit: [false,false], value: 'data' } -- !SequenceEnd -- !SequenceStart -- !SequenceStart -- !SequenceStart -- !Scalar -- !SequenceEnd -- !SequenceEnd -- !SequenceEnd -- !SequenceStart -- !SequenceStart { tag: '!mytag', implicit: false } -- !SequenceStart -- !Scalar { value: 'data' } -- !SequenceEnd -- !SequenceEnd -- !SequenceEnd -- !SequenceEnd -- !DocumentEnd - -- !DocumentStart -- !SequenceStart -- !MappingStart -- !Scalar { value: 'key1' } -- !SequenceStart -- !Scalar { value: 'data1' } -- !Scalar { value: 'data2' } -- !SequenceEnd -- !Scalar { value: 'key2' } -- !SequenceStart { tag: '!mytag1', implicit: false } -- !Scalar { value: 'data3' } -- !SequenceStart -- !Scalar { value: 'data4' } -- !Scalar { value: 'data5' } -- !SequenceEnd -- !SequenceStart { tag: '!mytag2', implicit: false } -- !Scalar { value: 'data6' } -- !Scalar { value: 'data7' } -- !SequenceEnd -- !SequenceEnd -- !MappingEnd -- !SequenceEnd -- !DocumentEnd - -- !DocumentStart -- !SequenceStart -- !SequenceStart { flow_style: true } -- !SequenceStart -- !SequenceEnd -- !Scalar -- !Scalar { value: 'data' } -- !Scalar { tag: '!mytag', implicit: [false,false], value: 'data' } -- !SequenceStart { tag: '!mytag', implicit: false } -- !Scalar { value: 'data' } -- !Scalar { value: 'data' } -- !SequenceEnd -- !SequenceEnd -- !SequenceEnd -- !DocumentEnd - -- !StreamEnd diff --git a/test/unported/serializer-is-already-opened.dumper-error b/test/unported/serializer-is-already-opened.dumper-error deleted file mode 100644 index 9a23525d..00000000 --- a/test/unported/serializer-is-already-opened.dumper-error +++ /dev/null @@ -1,3 +0,0 @@ -dumper = yaml.Dumper(StringIO()) -dumper.open() -dumper.open() diff --git a/test/unported/serializer-is-closed-1.dumper-error b/test/unported/serializer-is-closed-1.dumper-error deleted file mode 100644 index 8e7e6005..00000000 --- a/test/unported/serializer-is-closed-1.dumper-error +++ /dev/null @@ -1,4 +0,0 @@ -dumper = yaml.Dumper(StringIO()) -dumper.open() -dumper.close() -dumper.open() diff --git a/test/unported/serializer-is-closed-2.dumper-error b/test/unported/serializer-is-closed-2.dumper-error deleted file mode 100644 index 89aef7e9..00000000 --- a/test/unported/serializer-is-closed-2.dumper-error +++ /dev/null @@ -1,4 +0,0 @@ -dumper = yaml.Dumper(StringIO()) -dumper.open() -dumper.close() -dumper.serialize(yaml.ScalarNode(tag='!foo', value='bar')) diff --git a/test/unported/serializer-is-not-opened-1.dumper-error b/test/unported/serializer-is-not-opened-1.dumper-error deleted file mode 100644 index 8f22e73f..00000000 --- a/test/unported/serializer-is-not-opened-1.dumper-error +++ /dev/null @@ -1,2 +0,0 @@ -dumper = yaml.Dumper(StringIO()) -dumper.close() diff --git a/test/unported/serializer-is-not-opened-2.dumper-error b/test/unported/serializer-is-not-opened-2.dumper-error deleted file mode 100644 index ebd9df15..00000000 --- a/test/unported/serializer-is-not-opened-2.dumper-error +++ /dev/null @@ -1,2 +0,0 @@ -dumper = yaml.Dumper(StringIO()) -dumper.serialize(yaml.ScalarNode(tag='!foo', value='bar')) diff --git a/test/unported/sloppy-indentation.canonical b/test/unported/sloppy-indentation.canonical deleted file mode 100644 index 438bc04a..00000000 --- a/test/unported/sloppy-indentation.canonical +++ /dev/null @@ -1,18 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "in the block context" - : !!map { - ? !!str "indentation should be kept" - : !!map { - ? !!str "but in the flow context" - : !!seq [ !!str "it may be violated" ] - } - } -} ---- !!str -"the parser does not require scalars to be indented with at least one space" ---- !!str -"the parser does not require scalars to be indented with at least one space" ---- !!map -{ ? !!str "foo": { ? !!str "bar" : !!str "quoted scalars may not adhere indentation" } } diff --git a/test/unported/sloppy-indentation.data b/test/unported/sloppy-indentation.data deleted file mode 100644 index 2eb4f5a5..00000000 --- a/test/unported/sloppy-indentation.data +++ /dev/null @@ -1,17 +0,0 @@ ---- -in the block context: - indentation should be kept: { - but in the flow context: [ -it may be violated] -} ---- -the parser does not require scalars -to be indented with at least one space -... ---- -"the parser does not require scalars -to be indented with at least one space" ---- -foo: - bar: 'quoted scalars -may not adhere indentation' diff --git a/test/unported/spec-02-01.data b/test/unported/spec-02-01.data deleted file mode 100644 index d12e6711..00000000 --- a/test/unported/spec-02-01.data +++ /dev/null @@ -1,3 +0,0 @@ -- Mark McGwire -- Sammy Sosa -- Ken Griffey diff --git a/test/unported/spec-02-02.data b/test/unported/spec-02-02.data deleted file mode 100644 index 7b7ec948..00000000 --- a/test/unported/spec-02-02.data +++ /dev/null @@ -1,3 +0,0 @@ -hr: 65 # Home runs -avg: 0.278 # Batting average -rbi: 147 # Runs Batted In diff --git a/test/unported/spec-02-03.data b/test/unported/spec-02-03.data deleted file mode 100644 index 656d628e..00000000 --- a/test/unported/spec-02-03.data +++ /dev/null @@ -1,8 +0,0 @@ -american: - - Boston Red Sox - - Detroit Tigers - - New York Yankees -national: - - New York Mets - - Chicago Cubs - - Atlanta Braves diff --git a/test/unported/spec-02-04.data b/test/unported/spec-02-04.data deleted file mode 100644 index 430f6b3d..00000000 --- a/test/unported/spec-02-04.data +++ /dev/null @@ -1,8 +0,0 @@ -- - name: Mark McGwire - hr: 65 - avg: 0.278 -- - name: Sammy Sosa - hr: 63 - avg: 0.288 diff --git a/test/unported/spec-02-05.data b/test/unported/spec-02-05.data deleted file mode 100644 index cdd77706..00000000 --- a/test/unported/spec-02-05.data +++ /dev/null @@ -1,3 +0,0 @@ -- [name , hr, avg ] -- [Mark McGwire, 65, 0.278] -- [Sammy Sosa , 63, 0.288] diff --git a/test/unported/spec-02-06.data b/test/unported/spec-02-06.data deleted file mode 100644 index 7a957b23..00000000 --- a/test/unported/spec-02-06.data +++ /dev/null @@ -1,5 +0,0 @@ -Mark McGwire: {hr: 65, avg: 0.278} -Sammy Sosa: { - hr: 63, - avg: 0.288 - } diff --git a/test/unported/spec-02-07.data b/test/unported/spec-02-07.data deleted file mode 100644 index bc711d54..00000000 --- a/test/unported/spec-02-07.data +++ /dev/null @@ -1,10 +0,0 @@ -# Ranking of 1998 home runs ---- -- Mark McGwire -- Sammy Sosa -- Ken Griffey - -# Team ranking ---- -- Chicago Cubs -- St Louis Cardinals diff --git a/test/unported/spec-02-08.data b/test/unported/spec-02-08.data deleted file mode 100644 index 05e102d8..00000000 --- a/test/unported/spec-02-08.data +++ /dev/null @@ -1,10 +0,0 @@ ---- -time: 20:03:20 -player: Sammy Sosa -action: strike (miss) -... ---- -time: 20:03:47 -player: Sammy Sosa -action: grand slam -... diff --git a/test/unported/spec-02-09.data b/test/unported/spec-02-09.data deleted file mode 100644 index e2641805..00000000 --- a/test/unported/spec-02-09.data +++ /dev/null @@ -1,8 +0,0 @@ ---- -hr: # 1998 hr ranking - - Mark McGwire - - Sammy Sosa -rbi: - # 1998 rbi ranking - - Sammy Sosa - - Ken Griffey diff --git a/test/unported/spec-02-10.data b/test/unported/spec-02-10.data deleted file mode 100644 index 61808f67..00000000 --- a/test/unported/spec-02-10.data +++ /dev/null @@ -1,8 +0,0 @@ ---- -hr: - - Mark McGwire - # Following node labeled SS - - &SS Sammy Sosa -rbi: - - *SS # Subsequent occurrence - - Ken Griffey diff --git a/test/unported/spec-02-11.data b/test/unported/spec-02-11.data deleted file mode 100644 index 9123ce21..00000000 --- a/test/unported/spec-02-11.data +++ /dev/null @@ -1,9 +0,0 @@ -? - Detroit Tigers - - Chicago cubs -: - - 2001-07-23 - -? [ New York Yankees, - Atlanta Braves ] -: [ 2001-07-02, 2001-08-12, - 2001-08-14 ] diff --git a/test/unported/spec-02-12.data b/test/unported/spec-02-12.data deleted file mode 100644 index 1fc33f9d..00000000 --- a/test/unported/spec-02-12.data +++ /dev/null @@ -1,8 +0,0 @@ ---- -# products purchased -- item : Super Hoop - quantity: 1 -- item : Basketball - quantity: 4 -- item : Big Shoes - quantity: 1 diff --git a/test/unported/spec-02-13.data b/test/unported/spec-02-13.data deleted file mode 100644 index 13fb6560..00000000 --- a/test/unported/spec-02-13.data +++ /dev/null @@ -1,4 +0,0 @@ -# ASCII Art ---- | - \//||\/|| - // || ||__ diff --git a/test/unported/spec-02-14.data b/test/unported/spec-02-14.data deleted file mode 100644 index 59943def..00000000 --- a/test/unported/spec-02-14.data +++ /dev/null @@ -1,4 +0,0 @@ ---- - Mark McGwire's - year was crippled - by a knee injury. diff --git a/test/unported/spec-02-15.data b/test/unported/spec-02-15.data deleted file mode 100644 index 80b89a6d..00000000 --- a/test/unported/spec-02-15.data +++ /dev/null @@ -1,8 +0,0 @@ -> - Sammy Sosa completed another - fine season with great stats. - - 63 Home Runs - 0.288 Batting Average - - What a year! diff --git a/test/unported/spec-02-16.data b/test/unported/spec-02-16.data deleted file mode 100644 index 9f66d881..00000000 --- a/test/unported/spec-02-16.data +++ /dev/null @@ -1,7 +0,0 @@ -name: Mark McGwire -accomplishment: > - Mark set a major league - home run record in 1998. -stats: | - 65 Home Runs - 0.278 Batting Average diff --git a/test/unported/spec-02-17.data b/test/unported/spec-02-17.data deleted file mode 100644 index b2870c53..00000000 --- a/test/unported/spec-02-17.data +++ /dev/null @@ -1,7 +0,0 @@ -unicode: "Sosa did fine.\u263A" -control: "\b1998\t1999\t2000\n" -hexesc: "\x13\x10 is \r\n" - -single: '"Howdy!" he cried.' -quoted: ' # not a ''comment''.' -tie-fighter: '|\-*-/|' diff --git a/test/unported/spec-02-18.data b/test/unported/spec-02-18.data deleted file mode 100644 index e0a8bfa9..00000000 --- a/test/unported/spec-02-18.data +++ /dev/null @@ -1,6 +0,0 @@ -plain: - This unquoted scalar - spans many lines. - -quoted: "So does this - quoted scalar.\n" diff --git a/test/unported/spec-02-19.data b/test/unported/spec-02-19.data deleted file mode 100644 index bf69de69..00000000 --- a/test/unported/spec-02-19.data +++ /dev/null @@ -1,5 +0,0 @@ -canonical: 12345 -decimal: +12,345 -sexagesimal: 3:25:45 -octal: 014 -hexadecimal: 0xC diff --git a/test/unported/spec-02-20.data b/test/unported/spec-02-20.data deleted file mode 100644 index 1d4897ff..00000000 --- a/test/unported/spec-02-20.data +++ /dev/null @@ -1,6 +0,0 @@ -canonical: 1.23015e+3 -exponential: 12.3015e+02 -sexagesimal: 20:30.15 -fixed: 1,230.15 -negative infinity: -.inf -not a number: .NaN diff --git a/test/unported/spec-02-21.data b/test/unported/spec-02-21.data deleted file mode 100644 index dec6a56b..00000000 --- a/test/unported/spec-02-21.data +++ /dev/null @@ -1,4 +0,0 @@ -null: ~ -true: y -false: n -string: '12345' diff --git a/test/unported/spec-02-22.data b/test/unported/spec-02-22.data deleted file mode 100644 index aaac185a..00000000 --- a/test/unported/spec-02-22.data +++ /dev/null @@ -1,4 +0,0 @@ -canonical: 2001-12-15T02:59:43.1Z -iso8601: 2001-12-14t21:59:43.10-05:00 -spaced: 2001-12-14 21:59:43.10 -5 -date: 2002-12-14 diff --git a/test/unported/spec-02-23.data b/test/unported/spec-02-23.data deleted file mode 100644 index 5dbd992d..00000000 --- a/test/unported/spec-02-23.data +++ /dev/null @@ -1,13 +0,0 @@ ---- -not-date: !!str 2002-04-28 - -picture: !!binary | - R0lGODlhDAAMAIQAAP//9/X - 17unp5WZmZgAAAOfn515eXv - Pz7Y6OjuDg4J+fn5OTk6enp - 56enmleECcgggoBADs= - -application specific tag: !something | - The semantics of the tag - above may be different for - different documents. diff --git a/test/unported/spec-02-24.data b/test/unported/spec-02-24.data deleted file mode 100644 index 1180757d..00000000 --- a/test/unported/spec-02-24.data +++ /dev/null @@ -1,14 +0,0 @@ -%TAG ! tag:clarkevans.com,2002: ---- !shape - # Use the ! handle for presenting - # tag:clarkevans.com,2002:circle -- !circle - center: &ORIGIN {x: 73, y: 129} - radius: 7 -- !line - start: *ORIGIN - finish: { x: 89, y: 102 } -- !label - start: *ORIGIN - color: 0xFFEEBB - text: Pretty vector drawing. diff --git a/test/unported/spec-02-25.data b/test/unported/spec-02-25.data deleted file mode 100644 index 769ac319..00000000 --- a/test/unported/spec-02-25.data +++ /dev/null @@ -1,7 +0,0 @@ -# sets are represented as a -# mapping where each key is -# associated with the empty string ---- !!set -? Mark McGwire -? Sammy Sosa -? Ken Griff diff --git a/test/unported/spec-02-26.data b/test/unported/spec-02-26.data deleted file mode 100644 index 3143763d..00000000 --- a/test/unported/spec-02-26.data +++ /dev/null @@ -1,7 +0,0 @@ -# ordered maps are represented as -# a sequence of mappings, with -# each mapping having one key ---- !!omap -- Mark McGwire: 65 -- Sammy Sosa: 63 -- Ken Griffy: 58 diff --git a/test/unported/spec-02-27.data b/test/unported/spec-02-27.data deleted file mode 100644 index 4625739d..00000000 --- a/test/unported/spec-02-27.data +++ /dev/null @@ -1,29 +0,0 @@ ---- ! -invoice: 34843 -date : 2001-01-23 -bill-to: &id001 - given : Chris - family : Dumars - address: - lines: | - 458 Walkman Dr. - Suite #292 - city : Royal Oak - state : MI - postal : 48046 -ship-to: *id001 -product: - - sku : BL394D - quantity : 4 - description : Basketball - price : 450.00 - - sku : BL4438H - quantity : 1 - description : Super Hoop - price : 2392.00 -tax : 251.42 -total: 4443.52 -comments: - Late afternoon is best. - Backup contact is Nancy - Billsmer @ 338-4338. diff --git a/test/unported/spec-02-28.data b/test/unported/spec-02-28.data deleted file mode 100644 index a5c8dc85..00000000 --- a/test/unported/spec-02-28.data +++ /dev/null @@ -1,26 +0,0 @@ ---- -Time: 2001-11-23 15:01:42 -5 -User: ed -Warning: - This is an error message - for the log file ---- -Time: 2001-11-23 15:02:31 -5 -User: ed -Warning: - A slightly different error - message. ---- -Date: 2001-11-23 15:03:17 -5 -User: ed -Fatal: - Unknown variable "bar" -Stack: - - file: TopClass.py - line: 23 - code: | - x = MoreObject("345\n") - - file: MoreClass.py - line: 58 - code: |- - foo = bar diff --git a/test/unported/spec-05-01-utf8.data b/test/unported/spec-05-01-utf8.data deleted file mode 100644 index 780d25bf..00000000 --- a/test/unported/spec-05-01-utf8.data +++ /dev/null @@ -1 +0,0 @@ -# Comment only. diff --git a/test/unported/spec-05-01-utf8.empty b/test/unported/spec-05-01-utf8.empty deleted file mode 100644 index bfffa8b6..00000000 --- a/test/unported/spec-05-01-utf8.empty +++ /dev/null @@ -1,2 +0,0 @@ -# This stream contains no -# documents, only comments. diff --git a/test/unported/spec-05-02-utf8.data b/test/unported/spec-05-02-utf8.data deleted file mode 100644 index fb74866f..00000000 --- a/test/unported/spec-05-02-utf8.data +++ /dev/null @@ -1,3 +0,0 @@ -# Invalid use of BOM -# inside a -# document. diff --git a/test/unported/spec-05-02-utf8.error b/test/unported/spec-05-02-utf8.error deleted file mode 100644 index 1df36161..00000000 --- a/test/unported/spec-05-02-utf8.error +++ /dev/null @@ -1,3 +0,0 @@ -ERROR: - A BOM must not appear - inside a document. diff --git a/test/unported/spec-05-03.canonical b/test/unported/spec-05-03.canonical deleted file mode 100644 index a143a73f..00000000 --- a/test/unported/spec-05-03.canonical +++ /dev/null @@ -1,14 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "sequence" - : !!seq [ - !!str "one", !!str "two" - ], - ? !!str "mapping" - : !!map { - ? !!str "sky" : !!str "blue", -# ? !!str "sea" : !!str "green", - ? !!map { ? !!str "sea" : !!str "green" } : !!null "", - } -} diff --git a/test/unported/spec-05-03.data b/test/unported/spec-05-03.data deleted file mode 100644 index 4661f333..00000000 --- a/test/unported/spec-05-03.data +++ /dev/null @@ -1,7 +0,0 @@ -sequence: -- one -- two -mapping: - ? sky - : blue - ? sea : green diff --git a/test/unported/spec-05-04.canonical b/test/unported/spec-05-04.canonical deleted file mode 100644 index 00c97236..00000000 --- a/test/unported/spec-05-04.canonical +++ /dev/null @@ -1,13 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "sequence" - : !!seq [ - !!str "one", !!str "two" - ], - ? !!str "mapping" - : !!map { - ? !!str "sky" : !!str "blue", - ? !!str "sea" : !!str "green", - } -} diff --git a/test/unported/spec-05-04.data b/test/unported/spec-05-04.data deleted file mode 100644 index df338477..00000000 --- a/test/unported/spec-05-04.data +++ /dev/null @@ -1,2 +0,0 @@ -sequence: [ one, two, ] -mapping: { sky: blue, sea: green } diff --git a/test/unported/spec-05-05.data b/test/unported/spec-05-05.data deleted file mode 100644 index 62524c0d..00000000 --- a/test/unported/spec-05-05.data +++ /dev/null @@ -1 +0,0 @@ -# Comment only. diff --git a/test/unported/spec-05-05.empty b/test/unported/spec-05-05.empty deleted file mode 100644 index bfffa8b6..00000000 --- a/test/unported/spec-05-05.empty +++ /dev/null @@ -1,2 +0,0 @@ -# This stream contains no -# documents, only comments. diff --git a/test/unported/spec-05-06.canonical b/test/unported/spec-05-06.canonical deleted file mode 100644 index 4f30c111..00000000 --- a/test/unported/spec-05-06.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "anchored" - : &A1 !local "value", - ? !!str "alias" - : *A1, -} diff --git a/test/unported/spec-05-06.data b/test/unported/spec-05-06.data deleted file mode 100644 index 7a1f9b30..00000000 --- a/test/unported/spec-05-06.data +++ /dev/null @@ -1,2 +0,0 @@ -anchored: !local &anchor value -alias: *anchor diff --git a/test/unported/spec-05-07.canonical b/test/unported/spec-05-07.canonical deleted file mode 100644 index dc3732a5..00000000 --- a/test/unported/spec-05-07.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "literal" - : !!str "text\n", - ? !!str "folded" - : !!str "text\n", -} diff --git a/test/unported/spec-05-07.data b/test/unported/spec-05-07.data deleted file mode 100644 index 97eb3a34..00000000 --- a/test/unported/spec-05-07.data +++ /dev/null @@ -1,4 +0,0 @@ -literal: | - text -folded: > - text diff --git a/test/unported/spec-05-08.canonical b/test/unported/spec-05-08.canonical deleted file mode 100644 index 610bd687..00000000 --- a/test/unported/spec-05-08.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "single" - : !!str "text", - ? !!str "double" - : !!str "text", -} diff --git a/test/unported/spec-05-08.data b/test/unported/spec-05-08.data deleted file mode 100644 index 04ebf691..00000000 --- a/test/unported/spec-05-08.data +++ /dev/null @@ -1,2 +0,0 @@ -single: 'text' -double: "text" diff --git a/test/unported/spec-05-09.canonical b/test/unported/spec-05-09.canonical deleted file mode 100644 index 597e3dea..00000000 --- a/test/unported/spec-05-09.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!str "text" diff --git a/test/unported/spec-05-09.data b/test/unported/spec-05-09.data deleted file mode 100644 index a43431bd..00000000 --- a/test/unported/spec-05-09.data +++ /dev/null @@ -1,2 +0,0 @@ -%YAML 1.1 ---- text diff --git a/test/unported/spec-05-10.data b/test/unported/spec-05-10.data deleted file mode 100644 index a4caf911..00000000 --- a/test/unported/spec-05-10.data +++ /dev/null @@ -1,2 +0,0 @@ -commercial-at: @text -grave-accent: `text diff --git a/test/unported/spec-05-10.error b/test/unported/spec-05-10.error deleted file mode 100644 index 46f776e5..00000000 --- a/test/unported/spec-05-10.error +++ /dev/null @@ -1,3 +0,0 @@ -ERROR: - Reserved indicators can't - start a plain scalar. diff --git a/test/unported/spec-05-11.canonical b/test/unported/spec-05-11.canonical deleted file mode 100644 index fc25bef4..00000000 --- a/test/unported/spec-05-11.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- !!str -"Generic line break (no glyph)\n\ - Generic line break (glyphed)\n\ - Line separator\u2028\ - Paragraph separator\u2029" diff --git a/test/unported/spec-05-11.data b/test/unported/spec-05-11.data deleted file mode 100644 index b448b759..00000000 --- a/test/unported/spec-05-11.data +++ /dev/null @@ -1,3 +0,0 @@ -| - Generic line break (no glyph) - Generic line break (glyphed)… Line separator
 Paragraph separator
 \ No newline at end of file diff --git a/test/unported/spec-05-12.data b/test/unported/spec-05-12.data deleted file mode 100644 index 7c3ad7f3..00000000 --- a/test/unported/spec-05-12.data +++ /dev/null @@ -1,9 +0,0 @@ -# Tabs do's and don'ts: -# comment: -quoted: "Quoted " -block: | - void main() { - printf("Hello, world!\n"); - } -elsewhere: # separation - indentation, in plain scalar diff --git a/test/unported/spec-05-12.error b/test/unported/spec-05-12.error deleted file mode 100644 index 8aad4c8a..00000000 --- a/test/unported/spec-05-12.error +++ /dev/null @@ -1,8 +0,0 @@ -ERROR: - Tabs may appear inside - comments and quoted or - block scalar content. - Tabs must not appear - elsewhere, such as - in indentation and - separation spaces. diff --git a/test/unported/spec-05-13.canonical b/test/unported/spec-05-13.canonical deleted file mode 100644 index 90c1c5c3..00000000 --- a/test/unported/spec-05-13.canonical +++ /dev/null @@ -1,5 +0,0 @@ -%YAML 1.1 ---- !!str -"Text containing \ - both space and \ - tab characters" diff --git a/test/unported/spec-05-13.data b/test/unported/spec-05-13.data deleted file mode 100644 index fce7951c..00000000 --- a/test/unported/spec-05-13.data +++ /dev/null @@ -1,3 +0,0 @@ - "Text containing - both space and - tab characters" diff --git a/test/unported/spec-05-14.canonical b/test/unported/spec-05-14.canonical deleted file mode 100644 index 4bff01cb..00000000 --- a/test/unported/spec-05-14.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -"Fun with \x5C - \x22 \x07 \x08 \x1B \x0C - \x0A \x0D \x09 \x0B \x00 - \x20 \xA0 \x85 \u2028 \u2029 - A A A" diff --git a/test/unported/spec-05-14.data b/test/unported/spec-05-14.data deleted file mode 100644 index d6e8ce49..00000000 --- a/test/unported/spec-05-14.data +++ /dev/null @@ -1,2 +0,0 @@ -"Fun with \\ - \" \a \b \e \f \… \n \r \t \v \0 \
 \ \_ \N \L \P \
 \x41 \u0041 \U00000041" diff --git a/test/unported/spec-05-15.data b/test/unported/spec-05-15.data deleted file mode 100644 index 7bf12b6c..00000000 --- a/test/unported/spec-05-15.data +++ /dev/null @@ -1,3 +0,0 @@ -Bad escapes: - "\c - \xq-" diff --git a/test/unported/spec-05-15.error b/test/unported/spec-05-15.error deleted file mode 100644 index 71ffbd96..00000000 --- a/test/unported/spec-05-15.error +++ /dev/null @@ -1,3 +0,0 @@ -ERROR: -- c is an invalid escaped character. -- q and - are invalid hex digits. diff --git a/test/unported/spec-06-01.canonical b/test/unported/spec-06-01.canonical deleted file mode 100644 index f17ec922..00000000 --- a/test/unported/spec-06-01.canonical +++ /dev/null @@ -1,15 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "Not indented" - : !!map { - ? !!str "By one space" - : !!str "By four\n spaces\n", - ? !!str "Flow style" - : !!seq [ - !!str "By two", - !!str "Also by two", - !!str "Still by two", - ] - } -} diff --git a/test/unported/spec-06-01.data b/test/unported/spec-06-01.data deleted file mode 100644 index 6134ba12..00000000 --- a/test/unported/spec-06-01.data +++ /dev/null @@ -1,14 +0,0 @@ - # Leading comment line spaces are - # neither content nor indentation. - -Not indented: - By one space: | - By four - spaces - Flow style: [ # Leading spaces - By two, # in flow style - Also by two, # are neither -# Tabs are not allowed: -# Still by two # content nor - Still by two # content nor - ] # indentation. diff --git a/test/unported/spec-06-02.data b/test/unported/spec-06-02.data deleted file mode 100644 index ff741e5f..00000000 --- a/test/unported/spec-06-02.data +++ /dev/null @@ -1,3 +0,0 @@ - # Comment - - diff --git a/test/unported/spec-06-02.empty b/test/unported/spec-06-02.empty deleted file mode 100644 index bfffa8b6..00000000 --- a/test/unported/spec-06-02.empty +++ /dev/null @@ -1,2 +0,0 @@ -# This stream contains no -# documents, only comments. diff --git a/test/unported/spec-06-03.canonical b/test/unported/spec-06-03.canonical deleted file mode 100644 index ec269022..00000000 --- a/test/unported/spec-06-03.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "key" - : !!str "value" -} diff --git a/test/unported/spec-06-03.data b/test/unported/spec-06-03.data deleted file mode 100644 index 9db09129..00000000 --- a/test/unported/spec-06-03.data +++ /dev/null @@ -1,2 +0,0 @@ -key: # Comment - value diff --git a/test/unported/spec-06-04.canonical b/test/unported/spec-06-04.canonical deleted file mode 100644 index ec269022..00000000 --- a/test/unported/spec-06-04.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "key" - : !!str "value" -} diff --git a/test/unported/spec-06-04.data b/test/unported/spec-06-04.data deleted file mode 100644 index 86308dd3..00000000 --- a/test/unported/spec-06-04.data +++ /dev/null @@ -1,4 +0,0 @@ -key: # Comment - # lines - value - diff --git a/test/unported/spec-06-05.canonical b/test/unported/spec-06-05.canonical deleted file mode 100644 index 8da431d0..00000000 --- a/test/unported/spec-06-05.canonical +++ /dev/null @@ -1,16 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!map { - ? !!str "first" - : !!str "Sammy", - ? !!str "last" - : !!str "Sosa" - } - : !!map { - ? !!str "hr" - : !!int "65", - ? !!str "avg" - : !!float "0.278" - } -} diff --git a/test/unported/spec-06-05.data b/test/unported/spec-06-05.data deleted file mode 100644 index 37613f5b..00000000 --- a/test/unported/spec-06-05.data +++ /dev/null @@ -1,6 +0,0 @@ -{ first: Sammy, last: Sosa }: -# Statistics: - hr: # Home runs - 65 - avg: # Average - 0.278 diff --git a/test/unported/spec-06-06.canonical b/test/unported/spec-06-06.canonical deleted file mode 100644 index 513d07a1..00000000 --- a/test/unported/spec-06-06.canonical +++ /dev/null @@ -1,10 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "plain" - : !!str "text lines", - ? !!str "quoted" - : !!str "text lines", - ? !!str "block" - : !!str "text\n lines\n" -} diff --git a/test/unported/spec-06-06.data b/test/unported/spec-06-06.data deleted file mode 100644 index 2f62d082..00000000 --- a/test/unported/spec-06-06.data +++ /dev/null @@ -1,7 +0,0 @@ -plain: text - lines -quoted: "text - lines" -block: | - text - lines diff --git a/test/unported/spec-06-07.canonical b/test/unported/spec-06-07.canonical deleted file mode 100644 index 11357e45..00000000 --- a/test/unported/spec-06-07.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "foo\nbar", - !!str "foo\n\nbar" -] diff --git a/test/unported/spec-06-07.data b/test/unported/spec-06-07.data deleted file mode 100644 index 130cfa74..00000000 --- a/test/unported/spec-06-07.data +++ /dev/null @@ -1,8 +0,0 @@ -- foo - - bar -- |- - foo - - bar - diff --git a/test/unported/spec-06-08.canonical b/test/unported/spec-06-08.canonical deleted file mode 100644 index cc72bc84..00000000 --- a/test/unported/spec-06-08.canonical +++ /dev/null @@ -1,5 +0,0 @@ -%YAML 1.1 ---- !!str -"specific\L\ - trimmed\n\n\n\ - as space" diff --git a/test/unported/spec-06-08.data b/test/unported/spec-06-08.data deleted file mode 100644 index f2896edb..00000000 --- a/test/unported/spec-06-08.data +++ /dev/null @@ -1,2 +0,0 @@ ->- - specific
 trimmed… … …… as… space diff --git a/test/unported/spec-07-01.canonical b/test/unported/spec-07-01.canonical deleted file mode 100644 index 8c8c48db..00000000 --- a/test/unported/spec-07-01.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- !!str -"foo" diff --git a/test/unported/spec-07-01.data b/test/unported/spec-07-01.data deleted file mode 100644 index 2113eb61..00000000 --- a/test/unported/spec-07-01.data +++ /dev/null @@ -1,3 +0,0 @@ -%FOO bar baz # Should be ignored - # with a warning. ---- "foo" diff --git a/test/unported/spec-07-01.skip-ext b/test/unported/spec-07-01.skip-ext deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unported/spec-07-02.canonical b/test/unported/spec-07-02.canonical deleted file mode 100644 index cb7dd1c3..00000000 --- a/test/unported/spec-07-02.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!str "foo" diff --git a/test/unported/spec-07-02.data b/test/unported/spec-07-02.data deleted file mode 100644 index c8b73229..00000000 --- a/test/unported/spec-07-02.data +++ /dev/null @@ -1,4 +0,0 @@ -%YAML 1.2 # Attempt parsing - # with a warning ---- -"foo" diff --git a/test/unported/spec-07-02.skip-ext b/test/unported/spec-07-02.skip-ext deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unported/spec-07-03.data b/test/unported/spec-07-03.data deleted file mode 100644 index 4bfa07ac..00000000 --- a/test/unported/spec-07-03.data +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 -%YAML 1.1 -foo diff --git a/test/unported/spec-07-03.error b/test/unported/spec-07-03.error deleted file mode 100644 index b0ac446b..00000000 --- a/test/unported/spec-07-03.error +++ /dev/null @@ -1,3 +0,0 @@ -ERROR: -The YAML directive must only be -given at most once per document. diff --git a/test/unported/spec-07-04.canonical b/test/unported/spec-07-04.canonical deleted file mode 100644 index cb7dd1c3..00000000 --- a/test/unported/spec-07-04.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!str "foo" diff --git a/test/unported/spec-07-04.data b/test/unported/spec-07-04.data deleted file mode 100644 index 50f5ab93..00000000 --- a/test/unported/spec-07-04.data +++ /dev/null @@ -1,3 +0,0 @@ -%TAG !yaml! tag:yaml.org,2002: ---- -!yaml!str "foo" diff --git a/test/unported/spec-07-05.data b/test/unported/spec-07-05.data deleted file mode 100644 index 7276eae9..00000000 --- a/test/unported/spec-07-05.data +++ /dev/null @@ -1,3 +0,0 @@ -%TAG ! !foo -%TAG ! !foo -bar diff --git a/test/unported/spec-07-05.error b/test/unported/spec-07-05.error deleted file mode 100644 index 5601b194..00000000 --- a/test/unported/spec-07-05.error +++ /dev/null @@ -1,4 +0,0 @@ -ERROR: -The TAG directive must only -be given at most once per -handle in the same document. diff --git a/test/unported/spec-07-06.canonical b/test/unported/spec-07-06.canonical deleted file mode 100644 index bddf6168..00000000 --- a/test/unported/spec-07-06.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - ! "baz", - ! "string" -] diff --git a/test/unported/spec-07-06.data b/test/unported/spec-07-06.data deleted file mode 100644 index d9854cbd..00000000 --- a/test/unported/spec-07-06.data +++ /dev/null @@ -1,5 +0,0 @@ -%TAG ! !foo -%TAG !yaml! tag:yaml.org,2002: ---- -- !bar "baz" -- !yaml!str "string" diff --git a/test/unported/spec-07-07a.canonical b/test/unported/spec-07-07a.canonical deleted file mode 100644 index fa086df9..00000000 --- a/test/unported/spec-07-07a.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -! "bar" diff --git a/test/unported/spec-07-07a.data b/test/unported/spec-07-07a.data deleted file mode 100644 index 9d42ec3d..00000000 --- a/test/unported/spec-07-07a.data +++ /dev/null @@ -1,2 +0,0 @@ -# Private application: -!foo "bar" diff --git a/test/unported/spec-07-07b.canonical b/test/unported/spec-07-07b.canonical deleted file mode 100644 index fe917d84..00000000 --- a/test/unported/spec-07-07b.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -! "bar" diff --git a/test/unported/spec-07-07b.data b/test/unported/spec-07-07b.data deleted file mode 100644 index 2d36d0e0..00000000 --- a/test/unported/spec-07-07b.data +++ /dev/null @@ -1,4 +0,0 @@ -# Migrated to global: -%TAG ! tag:ben-kiki.org,2000:app/ ---- -!foo "bar" diff --git a/test/unported/spec-07-08.canonical b/test/unported/spec-07-08.canonical deleted file mode 100644 index 703aa7b4..00000000 --- a/test/unported/spec-07-08.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - ! "bar", - ! "string", - ! "baz" -] diff --git a/test/unported/spec-07-08.data b/test/unported/spec-07-08.data deleted file mode 100644 index e2c6d9e1..00000000 --- a/test/unported/spec-07-08.data +++ /dev/null @@ -1,9 +0,0 @@ -# Explicitly specify default settings: -%TAG ! ! -%TAG !! tag:yaml.org,2002: -# Named handles have no default: -%TAG !o! tag:ben-kiki.org,2000: ---- -- !foo "bar" -- !!str "string" -- !o!type "baz" diff --git a/test/unported/spec-07-09.canonical b/test/unported/spec-07-09.canonical deleted file mode 100644 index 32d9e943..00000000 --- a/test/unported/spec-07-09.canonical +++ /dev/null @@ -1,9 +0,0 @@ -%YAML 1.1 ---- -!!str "foo" -%YAML 1.1 ---- -!!str "bar" -%YAML 1.1 ---- -!!str "baz" diff --git a/test/unported/spec-07-09.data b/test/unported/spec-07-09.data deleted file mode 100644 index 1209d47b..00000000 --- a/test/unported/spec-07-09.data +++ /dev/null @@ -1,11 +0,0 @@ ---- -foo -... -# Repeated end marker. -... ---- -bar -# No end marker. ---- -baz -... diff --git a/test/unported/spec-07-10.canonical b/test/unported/spec-07-10.canonical deleted file mode 100644 index 1db650a8..00000000 --- a/test/unported/spec-07-10.canonical +++ /dev/null @@ -1,15 +0,0 @@ -%YAML 1.1 ---- -!!str "Root flow scalar" -%YAML 1.1 ---- -!!str "Root block scalar\n" -%YAML 1.1 ---- -!!map { - ? !!str "foo" - : !!str "bar" -} ---- -#!!str "" -!!null "" diff --git a/test/unported/spec-07-10.data b/test/unported/spec-07-10.data deleted file mode 100644 index 6939b392..00000000 --- a/test/unported/spec-07-10.data +++ /dev/null @@ -1,11 +0,0 @@ -"Root flow - scalar" ---- !!str > - Root block - scalar ---- -# Root collection: -foo : bar -... # Is optional. ---- -# Explicit document may be empty. diff --git a/test/unported/spec-07-11.data b/test/unported/spec-07-11.data deleted file mode 100644 index d11302da..00000000 --- a/test/unported/spec-07-11.data +++ /dev/null @@ -1,2 +0,0 @@ -# A stream may contain -# no documents. diff --git a/test/unported/spec-07-11.empty b/test/unported/spec-07-11.empty deleted file mode 100644 index bfffa8b6..00000000 --- a/test/unported/spec-07-11.empty +++ /dev/null @@ -1,2 +0,0 @@ -# This stream contains no -# documents, only comments. diff --git a/test/unported/spec-07-12a.canonical b/test/unported/spec-07-12a.canonical deleted file mode 100644 index efc116f1..00000000 --- a/test/unported/spec-07-12a.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "foo" - : !!str "bar" -} diff --git a/test/unported/spec-07-12a.data b/test/unported/spec-07-12a.data deleted file mode 100644 index 3807d57d..00000000 --- a/test/unported/spec-07-12a.data +++ /dev/null @@ -1,3 +0,0 @@ -# Implicit document. Root -# collection (mapping) node. -foo : bar diff --git a/test/unported/spec-07-12b.canonical b/test/unported/spec-07-12b.canonical deleted file mode 100644 index 04bcffc8..00000000 --- a/test/unported/spec-07-12b.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!str "Text content\n" diff --git a/test/unported/spec-07-12b.data b/test/unported/spec-07-12b.data deleted file mode 100644 index 43250db3..00000000 --- a/test/unported/spec-07-12b.data +++ /dev/null @@ -1,4 +0,0 @@ -# Explicit document. Root -# scalar (literal) node. ---- | - Text content diff --git a/test/unported/spec-07-13.canonical b/test/unported/spec-07-13.canonical deleted file mode 100644 index 5af71e91..00000000 --- a/test/unported/spec-07-13.canonical +++ /dev/null @@ -1,9 +0,0 @@ -%YAML 1.1 ---- -!!str "First document" ---- -! "No directives" ---- -! "With directives" ---- -! "Reset settings" diff --git a/test/unported/spec-07-13.data b/test/unported/spec-07-13.data deleted file mode 100644 index ba7ec63e..00000000 --- a/test/unported/spec-07-13.data +++ /dev/null @@ -1,9 +0,0 @@ -! "First document" ---- -!foo "No directives" -%TAG ! !foo ---- -!bar "With directives" -%YAML 1.1 ---- -!baz "Reset settings" diff --git a/test/unported/spec-08-01.canonical b/test/unported/spec-08-01.canonical deleted file mode 100644 index 69e4161b..00000000 --- a/test/unported/spec-08-01.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? &A1 !!str "foo" - : !!str "bar", - ? &A2 !!str "baz" - : *A1 -} diff --git a/test/unported/spec-08-01.data b/test/unported/spec-08-01.data deleted file mode 100644 index 48986ecb..00000000 --- a/test/unported/spec-08-01.data +++ /dev/null @@ -1,2 +0,0 @@ -!!str &a1 "foo" : !!str bar -&a2 baz : *a1 diff --git a/test/unported/spec-08-02.canonical b/test/unported/spec-08-02.canonical deleted file mode 100644 index dd6f76ec..00000000 --- a/test/unported/spec-08-02.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "First occurrence" - : &A !!str "Value", - ? !!str "Second occurrence" - : *A -} diff --git a/test/unported/spec-08-02.data b/test/unported/spec-08-02.data deleted file mode 100644 index 600d1792..00000000 --- a/test/unported/spec-08-02.data +++ /dev/null @@ -1,2 +0,0 @@ -First occurrence: &anchor Value -Second occurrence: *anchor diff --git a/test/unported/spec-08-03.canonical b/test/unported/spec-08-03.canonical deleted file mode 100644 index be7ea8f3..00000000 --- a/test/unported/spec-08-03.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? ! "foo" - : ! "baz" -} diff --git a/test/unported/spec-08-03.data b/test/unported/spec-08-03.data deleted file mode 100644 index 8e51f52a..00000000 --- a/test/unported/spec-08-03.data +++ /dev/null @@ -1,2 +0,0 @@ -! foo : - ! baz diff --git a/test/unported/spec-08-04.data b/test/unported/spec-08-04.data deleted file mode 100644 index f7d1b01e..00000000 --- a/test/unported/spec-08-04.data +++ /dev/null @@ -1,2 +0,0 @@ -- ! foo -- !<$:?> bar diff --git a/test/unported/spec-08-04.error b/test/unported/spec-08-04.error deleted file mode 100644 index 60663755..00000000 --- a/test/unported/spec-08-04.error +++ /dev/null @@ -1,6 +0,0 @@ -ERROR: -- Verbatim tags aren't resolved, - so ! is invalid. -- The $:? tag is neither a global - URI tag nor a local tag starting - with “!”. diff --git a/test/unported/spec-08-05.canonical b/test/unported/spec-08-05.canonical deleted file mode 100644 index a5c710ae..00000000 --- a/test/unported/spec-08-05.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - ! "foo", - ! "bar", - ! "baz", -] diff --git a/test/unported/spec-08-05.data b/test/unported/spec-08-05.data deleted file mode 100644 index 93576ed7..00000000 --- a/test/unported/spec-08-05.data +++ /dev/null @@ -1,5 +0,0 @@ -%TAG !o! tag:ben-kiki.org,2000: ---- -- !local foo -- !!str bar -- !o!type baz diff --git a/test/unported/spec-08-06.data b/test/unported/spec-08-06.data deleted file mode 100644 index 85800105..00000000 --- a/test/unported/spec-08-06.data +++ /dev/null @@ -1,5 +0,0 @@ -%TAG !o! tag:ben-kiki.org,2000: ---- -- !$a!b foo -- !o! bar -- !h!type baz diff --git a/test/unported/spec-08-06.error b/test/unported/spec-08-06.error deleted file mode 100644 index fb76f426..00000000 --- a/test/unported/spec-08-06.error +++ /dev/null @@ -1,4 +0,0 @@ -ERROR: -- The !$a! looks like a handle. -- The !o! handle has no suffix. -- The !h! handle wasn't declared. diff --git a/test/unported/spec-08-07.canonical b/test/unported/spec-08-07.canonical deleted file mode 100644 index e2f43d97..00000000 --- a/test/unported/spec-08-07.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - ! "12", - ! "12", -# ! "12", - ! "12", -] diff --git a/test/unported/spec-08-07.data b/test/unported/spec-08-07.data deleted file mode 100644 index 98aa565e..00000000 --- a/test/unported/spec-08-07.data +++ /dev/null @@ -1,4 +0,0 @@ -# Assuming conventional resolution: -- "12" -- 12 -- ! 12 diff --git a/test/unported/spec-08-08.canonical b/test/unported/spec-08-08.canonical deleted file mode 100644 index d3f8b1a7..00000000 --- a/test/unported/spec-08-08.canonical +++ /dev/null @@ -1,15 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "foo" - : !!str "bar baz" -} -%YAML 1.1 ---- -!!str "foo bar" -%YAML 1.1 ---- -!!str "foo bar" -%YAML 1.1 ---- -!!str "foo\n" diff --git a/test/unported/spec-08-08.data b/test/unported/spec-08-08.data deleted file mode 100644 index 757a93dd..00000000 --- a/test/unported/spec-08-08.data +++ /dev/null @@ -1,13 +0,0 @@ ---- -foo: - "bar - baz" ---- -"foo - bar" ---- -foo - bar ---- | - foo -... diff --git a/test/unported/spec-08-09.canonical b/test/unported/spec-08-09.canonical deleted file mode 100644 index 3805daf0..00000000 --- a/test/unported/spec-08-09.canonical +++ /dev/null @@ -1,21 +0,0 @@ -%YAML 1.1 ---- !!map { - ? !!str "scalars" : !!map { - ? !!str "plain" - : !!str "some text", - ? !!str "quoted" - : !!map { - ? !!str "single" - : !!str "some text", - ? !!str "double" - : !!str "some text" - } }, - ? !!str "collections" : !!map { - ? !!str "sequence" : !!seq [ - !!str "entry", - !!map { - ? !!str "key" : !!str "value" - } ], - ? !!str "mapping" : !!map { - ? !!str "key" : !!str "value" -} } } diff --git a/test/unported/spec-08-09.data b/test/unported/spec-08-09.data deleted file mode 100644 index 69da0422..00000000 --- a/test/unported/spec-08-09.data +++ /dev/null @@ -1,11 +0,0 @@ ---- -scalars: - plain: !!str some text - quoted: - single: 'some text' - double: "some text" -collections: - sequence: !!seq [ !!str entry, - # Mapping entry: - key: value ] - mapping: { key: value } diff --git a/test/unported/spec-08-10.canonical b/test/unported/spec-08-10.canonical deleted file mode 100644 index 8281c5ef..00000000 --- a/test/unported/spec-08-10.canonical +++ /dev/null @@ -1,23 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "block styles" : !!map { - ? !!str "scalars" : !!map { - ? !!str "literal" - : !!str "#!/usr/bin/perl\n\ - print \"Hello, - world!\\n\";\n", - ? !!str "folded" - : !!str "This sentence - is false.\n" - }, - ? !!str "collections" : !!map { - ? !!str "sequence" : !!seq [ - !!str "entry", - !!map { - ? !!str "key" : !!str "value" - } - ], - ? !!str "mapping" : !!map { - ? !!str "key" : !!str "value" -} } } } diff --git a/test/unported/spec-08-10.data b/test/unported/spec-08-10.data deleted file mode 100644 index 72acc56b..00000000 --- a/test/unported/spec-08-10.data +++ /dev/null @@ -1,15 +0,0 @@ -block styles: - scalars: - literal: !!str | - #!/usr/bin/perl - print "Hello, world!\n"; - folded: > - This sentence - is false. - collections: !!map - sequence: !!seq # Entry: - - entry # Plain - # Mapping entry: - - key: value - mapping: - key: value diff --git a/test/unported/spec-08-11.canonical b/test/unported/spec-08-11.canonical deleted file mode 100644 index dd6f76ec..00000000 --- a/test/unported/spec-08-11.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "First occurrence" - : &A !!str "Value", - ? !!str "Second occurrence" - : *A -} diff --git a/test/unported/spec-08-11.data b/test/unported/spec-08-11.data deleted file mode 100644 index 600d1792..00000000 --- a/test/unported/spec-08-11.data +++ /dev/null @@ -1,2 +0,0 @@ -First occurrence: &anchor Value -Second occurrence: *anchor diff --git a/test/unported/spec-08-12.canonical b/test/unported/spec-08-12.canonical deleted file mode 100644 index 93899f4e..00000000 --- a/test/unported/spec-08-12.canonical +++ /dev/null @@ -1,10 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "Without properties", - &A !!str "Anchored", - !!str "Tagged", - *A, - !!str "", - !!str "", -] diff --git a/test/unported/spec-08-12.data b/test/unported/spec-08-12.data deleted file mode 100644 index 3d4c6b7c..00000000 --- a/test/unported/spec-08-12.data +++ /dev/null @@ -1,8 +0,0 @@ -[ - Without properties, - &anchor "Anchored", - !!str 'Tagged', - *anchor, # Alias node - !!str , # Empty plain scalar - '', # Empty plain scalar -] diff --git a/test/unported/spec-08-13.canonical b/test/unported/spec-08-13.canonical deleted file mode 100644 index 618bb7bd..00000000 --- a/test/unported/spec-08-13.canonical +++ /dev/null @@ -1,10 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "foo" -# : !!str "", -# ? !!str "" - : !!null "", - ? !!null "" - : !!str "bar", -} diff --git a/test/unported/spec-08-13.data b/test/unported/spec-08-13.data deleted file mode 100644 index ebe663ac..00000000 --- a/test/unported/spec-08-13.data +++ /dev/null @@ -1,4 +0,0 @@ -{ - ? foo :, - ? : bar, -} diff --git a/test/unported/spec-08-13.skip-ext b/test/unported/spec-08-13.skip-ext deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unported/spec-08-14.canonical b/test/unported/spec-08-14.canonical deleted file mode 100644 index 11db439f..00000000 --- a/test/unported/spec-08-14.canonical +++ /dev/null @@ -1,10 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "flow in block", - !!str "Block scalar\n", - !!map { - ? !!str "foo" - : !!str "bar" - } -] diff --git a/test/unported/spec-08-14.data b/test/unported/spec-08-14.data deleted file mode 100644 index 2fbb1f70..00000000 --- a/test/unported/spec-08-14.data +++ /dev/null @@ -1,5 +0,0 @@ -- "flow in block" -- > - Block scalar -- !!map # Block collection - foo : bar diff --git a/test/unported/spec-08-15.canonical b/test/unported/spec-08-15.canonical deleted file mode 100644 index 76f028e6..00000000 --- a/test/unported/spec-08-15.canonical +++ /dev/null @@ -1,11 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!null "", - !!map { - ? !!str "foo" - : !!null "", - ? !!null "" - : !!str "bar", - } -] diff --git a/test/unported/spec-08-15.data b/test/unported/spec-08-15.data deleted file mode 100644 index 7c86bcf3..00000000 --- a/test/unported/spec-08-15.data +++ /dev/null @@ -1,5 +0,0 @@ -- # Empty plain scalar -- ? foo - : - ? - : bar diff --git a/test/unported/spec-09-01.canonical b/test/unported/spec-09-01.canonical deleted file mode 100644 index e71a5484..00000000 --- a/test/unported/spec-09-01.canonical +++ /dev/null @@ -1,11 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "simple key" - : !!map { - ? !!str "also simple" - : !!str "value", - ? !!str "not a simple key" - : !!str "any value" - } -} diff --git a/test/unported/spec-09-01.data b/test/unported/spec-09-01.data deleted file mode 100644 index 9e83eaff..00000000 --- a/test/unported/spec-09-01.data +++ /dev/null @@ -1,6 +0,0 @@ -"simple key" : { - "also simple" : value, - ? "not a - simple key" : "any - value" -} diff --git a/test/unported/spec-09-02.canonical b/test/unported/spec-09-02.canonical deleted file mode 100644 index 6f8f41ad..00000000 --- a/test/unported/spec-09-02.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!str "as space \ - trimmed\n\ - specific\L\n\ - escaped\t\n\ - none" diff --git a/test/unported/spec-09-02.data b/test/unported/spec-09-02.data deleted file mode 100644 index d84883dc..00000000 --- a/test/unported/spec-09-02.data +++ /dev/null @@ -1,6 +0,0 @@ - "as space - trimmed - - specific
 - escaped \
 - none" diff --git a/test/unported/spec-09-03.canonical b/test/unported/spec-09-03.canonical deleted file mode 100644 index 658c6df8..00000000 --- a/test/unported/spec-09-03.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str " last", - !!str " last", - !!str " \tfirst last", -] diff --git a/test/unported/spec-09-03.data b/test/unported/spec-09-03.data deleted file mode 100644 index e0b914d7..00000000 --- a/test/unported/spec-09-03.data +++ /dev/null @@ -1,6 +0,0 @@ -- " - last" -- " - last" -- " first - last" diff --git a/test/unported/spec-09-04.canonical b/test/unported/spec-09-04.canonical deleted file mode 100644 index fa466324..00000000 --- a/test/unported/spec-09-04.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!str "first \ - inner 1 \ - inner 2 \ - last" diff --git a/test/unported/spec-09-04.data b/test/unported/spec-09-04.data deleted file mode 100644 index 313a91b4..00000000 --- a/test/unported/spec-09-04.data +++ /dev/null @@ -1,4 +0,0 @@ - "first - inner 1 - \ inner 2 \ - last" diff --git a/test/unported/spec-09-05.canonical b/test/unported/spec-09-05.canonical deleted file mode 100644 index 24d10528..00000000 --- a/test/unported/spec-09-05.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "first ", - !!str "first\nlast", - !!str "first inner \tlast", -] diff --git a/test/unported/spec-09-05.data b/test/unported/spec-09-05.data deleted file mode 100644 index 624c30ea..00000000 --- a/test/unported/spec-09-05.data +++ /dev/null @@ -1,8 +0,0 @@ -- "first - " -- "first - - last" -- "first - inner - \ last" diff --git a/test/unported/spec-09-06.canonical b/test/unported/spec-09-06.canonical deleted file mode 100644 index 50287722..00000000 --- a/test/unported/spec-09-06.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!str "here's to \"quotes\"" diff --git a/test/unported/spec-09-06.data b/test/unported/spec-09-06.data deleted file mode 100644 index b038078e..00000000 --- a/test/unported/spec-09-06.data +++ /dev/null @@ -1 +0,0 @@ - 'here''s to "quotes"' diff --git a/test/unported/spec-09-07.canonical b/test/unported/spec-09-07.canonical deleted file mode 100644 index e71a5484..00000000 --- a/test/unported/spec-09-07.canonical +++ /dev/null @@ -1,11 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "simple key" - : !!map { - ? !!str "also simple" - : !!str "value", - ? !!str "not a simple key" - : !!str "any value" - } -} diff --git a/test/unported/spec-09-07.data b/test/unported/spec-09-07.data deleted file mode 100644 index 755b54a0..00000000 --- a/test/unported/spec-09-07.data +++ /dev/null @@ -1,6 +0,0 @@ -'simple key' : { - 'also simple' : value, - ? 'not a - simple key' : 'any - value' -} diff --git a/test/unported/spec-09-08.canonical b/test/unported/spec-09-08.canonical deleted file mode 100644 index 06abdb5f..00000000 --- a/test/unported/spec-09-08.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!str "as space \ - trimmed\n\ - specific\L\n\ - none" diff --git a/test/unported/spec-09-08.data b/test/unported/spec-09-08.data deleted file mode 100644 index aa4d4589..00000000 --- a/test/unported/spec-09-08.data +++ /dev/null @@ -1 +0,0 @@ - 'as space … trimmed …… specific
… none' diff --git a/test/unported/spec-09-09.canonical b/test/unported/spec-09-09.canonical deleted file mode 100644 index 658c6df8..00000000 --- a/test/unported/spec-09-09.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str " last", - !!str " last", - !!str " \tfirst last", -] diff --git a/test/unported/spec-09-09.data b/test/unported/spec-09-09.data deleted file mode 100644 index 52171df3..00000000 --- a/test/unported/spec-09-09.data +++ /dev/null @@ -1,6 +0,0 @@ -- ' - last' -- ' - last' -- ' first - last' diff --git a/test/unported/spec-09-10.canonical b/test/unported/spec-09-10.canonical deleted file mode 100644 index 2028d044..00000000 --- a/test/unported/spec-09-10.canonical +++ /dev/null @@ -1,5 +0,0 @@ -%YAML 1.1 ---- -!!str "first \ - inner \ - last" diff --git a/test/unported/spec-09-10.data b/test/unported/spec-09-10.data deleted file mode 100644 index 0e414495..00000000 --- a/test/unported/spec-09-10.data +++ /dev/null @@ -1,3 +0,0 @@ - 'first - inner - last' diff --git a/test/unported/spec-09-11.canonical b/test/unported/spec-09-11.canonical deleted file mode 100644 index 4eb222c9..00000000 --- a/test/unported/spec-09-11.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "first ", - !!str "first\nlast", -] diff --git a/test/unported/spec-09-11.data b/test/unported/spec-09-11.data deleted file mode 100644 index 5efa873b..00000000 --- a/test/unported/spec-09-11.data +++ /dev/null @@ -1,5 +0,0 @@ -- 'first - ' -- 'first - - last' diff --git a/test/unported/spec-09-12.canonical b/test/unported/spec-09-12.canonical deleted file mode 100644 index d8e6dce7..00000000 --- a/test/unported/spec-09-12.canonical +++ /dev/null @@ -1,12 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "::std::vector", - !!str "Up, up, and away!", - !!int "-123", - !!seq [ - !!str "::std::vector", - !!str "Up, up, and away!", - !!int "-123", - ] -] diff --git a/test/unported/spec-09-12.data b/test/unported/spec-09-12.data deleted file mode 100644 index b9a3ac53..00000000 --- a/test/unported/spec-09-12.data +++ /dev/null @@ -1,8 +0,0 @@ -# Outside flow collection: -- ::std::vector -- Up, up, and away! -- -123 -# Inside flow collection: -- [ '::std::vector', - "Up, up, and away!", - -123 ] diff --git a/test/unported/spec-09-13.canonical b/test/unported/spec-09-13.canonical deleted file mode 100644 index e71a5484..00000000 --- a/test/unported/spec-09-13.canonical +++ /dev/null @@ -1,11 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "simple key" - : !!map { - ? !!str "also simple" - : !!str "value", - ? !!str "not a simple key" - : !!str "any value" - } -} diff --git a/test/unported/spec-09-13.data b/test/unported/spec-09-13.data deleted file mode 100644 index b156386a..00000000 --- a/test/unported/spec-09-13.data +++ /dev/null @@ -1,6 +0,0 @@ -simple key : { - also simple : value, - ? not a - simple key : any - value -} diff --git a/test/unported/spec-09-14.data b/test/unported/spec-09-14.data deleted file mode 100644 index 97f23162..00000000 --- a/test/unported/spec-09-14.data +++ /dev/null @@ -1,14 +0,0 @@ ---- ---- ||| : foo -... >>>: bar ---- -[ ---- -, -... , -{ ---- : -... # Nested -} -] -... diff --git a/test/unported/spec-09-14.error b/test/unported/spec-09-14.error deleted file mode 100644 index 9f3db7b0..00000000 --- a/test/unported/spec-09-14.error +++ /dev/null @@ -1,6 +0,0 @@ -ERROR: - The --- and ... document - start and end markers must - not be specified as the - first content line of a - non-indented plain scalar. diff --git a/test/unported/spec-09-15.canonical b/test/unported/spec-09-15.canonical deleted file mode 100644 index df020407..00000000 --- a/test/unported/spec-09-15.canonical +++ /dev/null @@ -1,18 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "---" - : !!str "foo", - ? !!str "..." - : !!str "bar" -} -%YAML 1.1 ---- -!!seq [ - !!str "---", - !!str "...", - !!map { - ? !!str "---" - : !!str "..." - } -] diff --git a/test/unported/spec-09-15.data b/test/unported/spec-09-15.data deleted file mode 100644 index e6863b04..00000000 --- a/test/unported/spec-09-15.data +++ /dev/null @@ -1,13 +0,0 @@ ---- -"---" : foo -...: bar ---- -[ ----, -..., -{ -? --- -: ... -} -] -... diff --git a/test/unported/spec-09-16.canonical b/test/unported/spec-09-16.canonical deleted file mode 100644 index 06abdb5f..00000000 --- a/test/unported/spec-09-16.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!str "as space \ - trimmed\n\ - specific\L\n\ - none" diff --git a/test/unported/spec-09-16.data b/test/unported/spec-09-16.data deleted file mode 100644 index 473beb9a..00000000 --- a/test/unported/spec-09-16.data +++ /dev/null @@ -1,3 +0,0 @@ -# Tabs are confusing: -# as space/trimmed/specific/none - as space … trimmed …… specific
… none diff --git a/test/unported/spec-09-17.canonical b/test/unported/spec-09-17.canonical deleted file mode 100644 index 68cb70d1..00000000 --- a/test/unported/spec-09-17.canonical +++ /dev/null @@ -1,4 +0,0 @@ -%YAML 1.1 ---- -!!str "first line\n\ - more line" diff --git a/test/unported/spec-09-17.data b/test/unported/spec-09-17.data deleted file mode 100644 index 97bc46c4..00000000 --- a/test/unported/spec-09-17.data +++ /dev/null @@ -1,3 +0,0 @@ - first line - - more line diff --git a/test/unported/spec-09-18.canonical b/test/unported/spec-09-18.canonical deleted file mode 100644 index f21428f6..00000000 --- a/test/unported/spec-09-18.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "literal\n", - !!str " folded\n", - !!str "keep\n\n", - !!str " strip", -] diff --git a/test/unported/spec-09-18.data b/test/unported/spec-09-18.data deleted file mode 100644 index 68c5d7cc..00000000 --- a/test/unported/spec-09-18.data +++ /dev/null @@ -1,9 +0,0 @@ -- | # Just the style - literal -- >1 # Indentation indicator - folded -- |+ # Chomping indicator - keep - -- >-1 # Both indicators - strip diff --git a/test/unported/spec-09-19.canonical b/test/unported/spec-09-19.canonical deleted file mode 100644 index 3e828d7d..00000000 --- a/test/unported/spec-09-19.canonical +++ /dev/null @@ -1,6 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "literal\n", - !!str "folded\n", -] diff --git a/test/unported/spec-09-19.data b/test/unported/spec-09-19.data deleted file mode 100644 index f0e589dc..00000000 --- a/test/unported/spec-09-19.data +++ /dev/null @@ -1,4 +0,0 @@ -- | - literal -- > - folded diff --git a/test/unported/spec-09-20.canonical b/test/unported/spec-09-20.canonical deleted file mode 100644 index d03bef51..00000000 --- a/test/unported/spec-09-20.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "detected\n", - !!str "\n\n# detected\n", - !!str " explicit\n", - !!str "\t\ndetected\n", -] diff --git a/test/unported/spec-09-20.data b/test/unported/spec-09-20.data deleted file mode 100644 index 39bee044..00000000 --- a/test/unported/spec-09-20.data +++ /dev/null @@ -1,11 +0,0 @@ -- | - detected -- > - - - # detected -- |1 - explicit -- > - - detected diff --git a/test/unported/spec-09-20.skip-ext b/test/unported/spec-09-20.skip-ext deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unported/spec-09-21.data b/test/unported/spec-09-21.data deleted file mode 100644 index 0fdd14f2..00000000 --- a/test/unported/spec-09-21.data +++ /dev/null @@ -1,8 +0,0 @@ -- | - - text -- > - text - text -- |1 - text diff --git a/test/unported/spec-09-21.error b/test/unported/spec-09-21.error deleted file mode 100644 index 1379ca50..00000000 --- a/test/unported/spec-09-21.error +++ /dev/null @@ -1,7 +0,0 @@ -ERROR: -- A leading all-space line must - not have too many spaces. -- A following text line must - not be less indented. -- The text is less indented - than the indicated level. diff --git a/test/unported/spec-09-22.canonical b/test/unported/spec-09-22.canonical deleted file mode 100644 index c1bbcd22..00000000 --- a/test/unported/spec-09-22.canonical +++ /dev/null @@ -1,10 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "strip" - : !!str "text", - ? !!str "clip" - : !!str "text\n", - ? !!str "keep" - : !!str "text\L", -} diff --git a/test/unported/spec-09-22.data b/test/unported/spec-09-22.data deleted file mode 100644 index 0dd51eb3..00000000 --- a/test/unported/spec-09-22.data +++ /dev/null @@ -1,4 +0,0 @@ -strip: |- - text
clip: | - text…keep: |+ - text
 \ No newline at end of file diff --git a/test/unported/spec-09-23.canonical b/test/unported/spec-09-23.canonical deleted file mode 100644 index c4444caa..00000000 --- a/test/unported/spec-09-23.canonical +++ /dev/null @@ -1,10 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "strip" - : !!str "# text", - ? !!str "clip" - : !!str "# text\n", - ? !!str "keep" - : !!str "# text\L\n", -} diff --git a/test/unported/spec-09-23.data b/test/unported/spec-09-23.data deleted file mode 100644 index 8972d2b6..00000000 --- a/test/unported/spec-09-23.data +++ /dev/null @@ -1,11 +0,0 @@ - # Strip - # Comments: -strip: |- - # text
 
 # Clip - # comments: -…clip: | - # text… 
 # Keep - # comments: -…keep: |+ - # text
… # Trail - # comments. diff --git a/test/unported/spec-09-24.canonical b/test/unported/spec-09-24.canonical deleted file mode 100644 index 45a99b01..00000000 --- a/test/unported/spec-09-24.canonical +++ /dev/null @@ -1,10 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "strip" - : !!str "", - ? !!str "clip" - : !!str "", - ? !!str "keep" - : !!str "\n", -} diff --git a/test/unported/spec-09-24.data b/test/unported/spec-09-24.data deleted file mode 100644 index de0b64bb..00000000 --- a/test/unported/spec-09-24.data +++ /dev/null @@ -1,6 +0,0 @@ -strip: >- - -clip: > - -keep: |+ - diff --git a/test/unported/spec-09-25.canonical b/test/unported/spec-09-25.canonical deleted file mode 100644 index 9d2327bb..00000000 --- a/test/unported/spec-09-25.canonical +++ /dev/null @@ -1,4 +0,0 @@ -%YAML 1.1 ---- -!!str "literal\n\ - \ttext\n" diff --git a/test/unported/spec-09-25.data b/test/unported/spec-09-25.data deleted file mode 100644 index f6303a14..00000000 --- a/test/unported/spec-09-25.data +++ /dev/null @@ -1,3 +0,0 @@ -| # Simple block scalar - literal - text diff --git a/test/unported/spec-09-26.canonical b/test/unported/spec-09-26.canonical deleted file mode 100644 index 3029a116..00000000 --- a/test/unported/spec-09-26.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!str "\n\nliteral\n\ntext\n" diff --git a/test/unported/spec-09-26.data b/test/unported/spec-09-26.data deleted file mode 100644 index f28555ab..00000000 --- a/test/unported/spec-09-26.data +++ /dev/null @@ -1,8 +0,0 @@ -| - - - literal - - text - - # Comment diff --git a/test/unported/spec-09-27.canonical b/test/unported/spec-09-27.canonical deleted file mode 100644 index 3029a116..00000000 --- a/test/unported/spec-09-27.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!str "\n\nliteral\n\ntext\n" diff --git a/test/unported/spec-09-27.data b/test/unported/spec-09-27.data deleted file mode 100644 index f28555ab..00000000 --- a/test/unported/spec-09-27.data +++ /dev/null @@ -1,8 +0,0 @@ -| - - - literal - - text - - # Comment diff --git a/test/unported/spec-09-28.canonical b/test/unported/spec-09-28.canonical deleted file mode 100644 index 3029a116..00000000 --- a/test/unported/spec-09-28.canonical +++ /dev/null @@ -1,3 +0,0 @@ -%YAML 1.1 ---- -!!str "\n\nliteral\n\ntext\n" diff --git a/test/unported/spec-09-28.data b/test/unported/spec-09-28.data deleted file mode 100644 index f28555ab..00000000 --- a/test/unported/spec-09-28.data +++ /dev/null @@ -1,8 +0,0 @@ -| - - - literal - - text - - # Comment diff --git a/test/unported/spec-09-29.canonical b/test/unported/spec-09-29.canonical deleted file mode 100644 index 0980789a..00000000 --- a/test/unported/spec-09-29.canonical +++ /dev/null @@ -1,4 +0,0 @@ -%YAML 1.1 ---- -!!str "folded text\n\ - \tlines\n" diff --git a/test/unported/spec-09-29.data b/test/unported/spec-09-29.data deleted file mode 100644 index 82e611fc..00000000 --- a/test/unported/spec-09-29.data +++ /dev/null @@ -1,4 +0,0 @@ -> # Simple folded scalar - folded - text - lines diff --git a/test/unported/spec-09-30.canonical b/test/unported/spec-09-30.canonical deleted file mode 100644 index fc37db1c..00000000 --- a/test/unported/spec-09-30.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!str "folded line\n\ - next line\n\n\ - \ * bullet\n\ - \ * list\n\n\ - last line\n" diff --git a/test/unported/spec-09-30.data b/test/unported/spec-09-30.data deleted file mode 100644 index a4d8c36a..00000000 --- a/test/unported/spec-09-30.data +++ /dev/null @@ -1,14 +0,0 @@ -> - folded - line - - next - line - - * bullet - * list - - last - line - -# Comment diff --git a/test/unported/spec-09-31.canonical b/test/unported/spec-09-31.canonical deleted file mode 100644 index fc37db1c..00000000 --- a/test/unported/spec-09-31.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!str "folded line\n\ - next line\n\n\ - \ * bullet\n\ - \ * list\n\n\ - last line\n" diff --git a/test/unported/spec-09-31.data b/test/unported/spec-09-31.data deleted file mode 100644 index a4d8c36a..00000000 --- a/test/unported/spec-09-31.data +++ /dev/null @@ -1,14 +0,0 @@ -> - folded - line - - next - line - - * bullet - * list - - last - line - -# Comment diff --git a/test/unported/spec-09-32.canonical b/test/unported/spec-09-32.canonical deleted file mode 100644 index fc37db1c..00000000 --- a/test/unported/spec-09-32.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!str "folded line\n\ - next line\n\n\ - \ * bullet\n\ - \ * list\n\n\ - last line\n" diff --git a/test/unported/spec-09-32.data b/test/unported/spec-09-32.data deleted file mode 100644 index a4d8c36a..00000000 --- a/test/unported/spec-09-32.data +++ /dev/null @@ -1,14 +0,0 @@ -> - folded - line - - next - line - - * bullet - * list - - last - line - -# Comment diff --git a/test/unported/spec-09-33.canonical b/test/unported/spec-09-33.canonical deleted file mode 100644 index fc37db1c..00000000 --- a/test/unported/spec-09-33.canonical +++ /dev/null @@ -1,7 +0,0 @@ -%YAML 1.1 ---- -!!str "folded line\n\ - next line\n\n\ - \ * bullet\n\ - \ * list\n\n\ - last line\n" diff --git a/test/unported/spec-09-33.data b/test/unported/spec-09-33.data deleted file mode 100644 index a4d8c36a..00000000 --- a/test/unported/spec-09-33.data +++ /dev/null @@ -1,14 +0,0 @@ -> - folded - line - - next - line - - * bullet - * list - - last - line - -# Comment diff --git a/test/unported/spec-10-01.canonical b/test/unported/spec-10-01.canonical deleted file mode 100644 index d08cdd40..00000000 --- a/test/unported/spec-10-01.canonical +++ /dev/null @@ -1,12 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!seq [ - !!str "inner", - !!str "inner", - ], - !!seq [ - !!str "inner", - !!str "last", - ], -] diff --git a/test/unported/spec-10-01.data b/test/unported/spec-10-01.data deleted file mode 100644 index e668d38d..00000000 --- a/test/unported/spec-10-01.data +++ /dev/null @@ -1,2 +0,0 @@ -- [ inner, inner, ] -- [inner,last] diff --git a/test/unported/spec-10-02.canonical b/test/unported/spec-10-02.canonical deleted file mode 100644 index 82fe0d94..00000000 --- a/test/unported/spec-10-02.canonical +++ /dev/null @@ -1,14 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!str "double quoted", - !!str "single quoted", - !!str "plain text", - !!seq [ - !!str "nested", - ], - !!map { - ? !!str "single" - : !!str "pair" - } -] diff --git a/test/unported/spec-10-02.data b/test/unported/spec-10-02.data deleted file mode 100644 index 3b233515..00000000 --- a/test/unported/spec-10-02.data +++ /dev/null @@ -1,8 +0,0 @@ -[ -"double - quoted", 'single - quoted', -plain - text, [ nested ], -single: pair , -] diff --git a/test/unported/spec-10-03.canonical b/test/unported/spec-10-03.canonical deleted file mode 100644 index 1443395b..00000000 --- a/test/unported/spec-10-03.canonical +++ /dev/null @@ -1,12 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "block" - : !!seq [ - !!str "one", - !!map { - ? !!str "two" - : !!str "three" - } - ] -} diff --git a/test/unported/spec-10-03.data b/test/unported/spec-10-03.data deleted file mode 100644 index 9e15f83b..00000000 --- a/test/unported/spec-10-03.data +++ /dev/null @@ -1,4 +0,0 @@ -block: # Block - # sequence -- one -- two : three diff --git a/test/unported/spec-10-04.canonical b/test/unported/spec-10-04.canonical deleted file mode 100644 index ae486a3c..00000000 --- a/test/unported/spec-10-04.canonical +++ /dev/null @@ -1,11 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "block" - : !!seq [ - !!str "one", - !!seq [ - !!str "two" - ] - ] -} diff --git a/test/unported/spec-10-04.data b/test/unported/spec-10-04.data deleted file mode 100644 index 2905b0d9..00000000 --- a/test/unported/spec-10-04.data +++ /dev/null @@ -1,4 +0,0 @@ -block: -- one -- - - two diff --git a/test/unported/spec-10-05.canonical b/test/unported/spec-10-05.canonical deleted file mode 100644 index 07cc0c98..00000000 --- a/test/unported/spec-10-05.canonical +++ /dev/null @@ -1,14 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!null "", - !!str "block node\n", - !!seq [ - !!str "one", - !!str "two", - ], - !!map { - ? !!str "one" - : !!str "two", - } -] diff --git a/test/unported/spec-10-05.data b/test/unported/spec-10-05.data deleted file mode 100644 index f19a99e3..00000000 --- a/test/unported/spec-10-05.data +++ /dev/null @@ -1,7 +0,0 @@ -- # Empty -- | - block node -- - one # in-line - - two # sequence -- one: two # in-line - # mapping diff --git a/test/unported/spec-10-06.canonical b/test/unported/spec-10-06.canonical deleted file mode 100644 index d9986c28..00000000 --- a/test/unported/spec-10-06.canonical +++ /dev/null @@ -1,16 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!map { - ? !!str "inner" - : !!str "entry", - ? !!str "also" - : !!str "inner" - }, - !!map { - ? !!str "inner" - : !!str "entry", - ? !!str "last" - : !!str "entry" - } -] diff --git a/test/unported/spec-10-06.data b/test/unported/spec-10-06.data deleted file mode 100644 index 860ba25b..00000000 --- a/test/unported/spec-10-06.data +++ /dev/null @@ -1,2 +0,0 @@ -- { inner : entry , also: inner , } -- {inner: entry,last : entry} diff --git a/test/unported/spec-10-07.canonical b/test/unported/spec-10-07.canonical deleted file mode 100644 index ec74230a..00000000 --- a/test/unported/spec-10-07.canonical +++ /dev/null @@ -1,16 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!null "" - : !!str "value", - ? !!str "explicit key" - : !!str "value", - ? !!str "simple key" - : !!str "value", - ? !!seq [ - !!str "collection", - !!str "simple", - !!str "key" - ] - : !!str "value" -} diff --git a/test/unported/spec-10-07.data b/test/unported/spec-10-07.data deleted file mode 100644 index ff943fbc..00000000 --- a/test/unported/spec-10-07.data +++ /dev/null @@ -1,7 +0,0 @@ -{ -? : value, # Empty key -? explicit - key: value, -simple key : value, -[ collection, simple, key ]: value -} diff --git a/test/unported/spec-10-08.data b/test/unported/spec-10-08.data deleted file mode 100644 index 55bd788a..00000000 --- a/test/unported/spec-10-08.data +++ /dev/null @@ -1,5 +0,0 @@ -{ -multi-line - simple key : value, -very long ...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................(>1KB)................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... key: value -} diff --git a/test/unported/spec-10-08.error b/test/unported/spec-10-08.error deleted file mode 100644 index 3979e1f7..00000000 --- a/test/unported/spec-10-08.error +++ /dev/null @@ -1,5 +0,0 @@ -ERROR: -- A simple key is restricted - to only one line. -- A simple key must not be - longer than 1024 characters. diff --git a/test/unported/spec-10-09.canonical b/test/unported/spec-10-09.canonical deleted file mode 100644 index 4d9827b1..00000000 --- a/test/unported/spec-10-09.canonical +++ /dev/null @@ -1,8 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "key" - : !!str "value", - ? !!str "empty" - : !!null "", -} diff --git a/test/unported/spec-10-09.data b/test/unported/spec-10-09.data deleted file mode 100644 index 4d55e21d..00000000 --- a/test/unported/spec-10-09.data +++ /dev/null @@ -1,4 +0,0 @@ -{ -key : value, -empty: # empty value↓ -} diff --git a/test/unported/spec-10-10.canonical b/test/unported/spec-10-10.canonical deleted file mode 100644 index 016fb640..00000000 --- a/test/unported/spec-10-10.canonical +++ /dev/null @@ -1,16 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "explicit key1" - : !!str "explicit value", - ? !!str "explicit key2" - : !!null "", - ? !!str "explicit key3" - : !!null "", - ? !!str "simple key1" - : !!str "explicit value", - ? !!str "simple key2" - : !!null "", - ? !!str "simple key3" - : !!null "", -} diff --git a/test/unported/spec-10-10.data b/test/unported/spec-10-10.data deleted file mode 100644 index 0888b054..00000000 --- a/test/unported/spec-10-10.data +++ /dev/null @@ -1,8 +0,0 @@ -{ -? explicit key1 : explicit value, -? explicit key2 : , # Explicit empty -? explicit key3, # Empty value -simple key1 : explicit value, -simple key2 : , # Explicit empty -simple key3, # Empty value -} diff --git a/test/unported/spec-10-11.canonical b/test/unported/spec-10-11.canonical deleted file mode 100644 index 7309544c..00000000 --- a/test/unported/spec-10-11.canonical +++ /dev/null @@ -1,24 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!map { - ? !!str "explicit key1" - : !!str "explicit value", - }, - !!map { - ? !!str "explicit key2" - : !!null "", - }, - !!map { - ? !!str "explicit key3" - : !!null "", - }, - !!map { - ? !!str "simple key1" - : !!str "explicit value", - }, - !!map { - ? !!str "simple key2" - : !!null "", - }, -] diff --git a/test/unported/spec-10-11.data b/test/unported/spec-10-11.data deleted file mode 100644 index 9f055684..00000000 --- a/test/unported/spec-10-11.data +++ /dev/null @@ -1,7 +0,0 @@ -[ -? explicit key1 : explicit value, -? explicit key2 : , # Explicit empty -? explicit key3, # Implicit empty -simple key1 : explicit value, -simple key2 : , # Explicit empty -] diff --git a/test/unported/spec-10-12.canonical b/test/unported/spec-10-12.canonical deleted file mode 100644 index a95dd40c..00000000 --- a/test/unported/spec-10-12.canonical +++ /dev/null @@ -1,9 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "block" - : !!map { - ? !!str "key" - : !!str "value" - } -} diff --git a/test/unported/spec-10-12.data b/test/unported/spec-10-12.data deleted file mode 100644 index 55214435..00000000 --- a/test/unported/spec-10-12.data +++ /dev/null @@ -1,3 +0,0 @@ -block: # Block - # mapping - key: value diff --git a/test/unported/spec-10-13.canonical b/test/unported/spec-10-13.canonical deleted file mode 100644 index e183c50f..00000000 --- a/test/unported/spec-10-13.canonical +++ /dev/null @@ -1,11 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "explicit key" - : !!null "", - ? !!str "block key\n" - : !!seq [ - !!str "one", - !!str "two", - ] -} diff --git a/test/unported/spec-10-13.data b/test/unported/spec-10-13.data deleted file mode 100644 index b5b97db1..00000000 --- a/test/unported/spec-10-13.data +++ /dev/null @@ -1,5 +0,0 @@ -? explicit key # implicit value -? | - block key -: - one # explicit in-line - - two # block value diff --git a/test/unported/spec-10-14.canonical b/test/unported/spec-10-14.canonical deleted file mode 100644 index e87c8805..00000000 --- a/test/unported/spec-10-14.canonical +++ /dev/null @@ -1,11 +0,0 @@ -%YAML 1.1 ---- -!!map { - ? !!str "plain key" - : !!null "", - ? !!str "quoted key" - : !!seq [ - !!str "one", - !!str "two", - ] -} diff --git a/test/unported/spec-10-14.data b/test/unported/spec-10-14.data deleted file mode 100644 index 7f5995ca..00000000 --- a/test/unported/spec-10-14.data +++ /dev/null @@ -1,4 +0,0 @@ -plain key: # empty value -"quoted key": -- one # explicit next-line -- two # block value diff --git a/test/unported/spec-10-15.canonical b/test/unported/spec-10-15.canonical deleted file mode 100644 index 85fbbd06..00000000 --- a/test/unported/spec-10-15.canonical +++ /dev/null @@ -1,18 +0,0 @@ -%YAML 1.1 ---- -!!seq [ - !!map { - ? !!str "sun" - : !!str "yellow" - }, - !!map { - ? !!map { - ? !!str "earth" - : !!str "blue" - } - : !!map { - ? !!str "moon" - : !!str "white" - } - } -] diff --git a/test/unported/spec-10-15.data b/test/unported/spec-10-15.data deleted file mode 100644 index d675cfd6..00000000 --- a/test/unported/spec-10-15.data +++ /dev/null @@ -1,3 +0,0 @@ -- sun: yellow -- ? earth: blue - : moon: white diff --git a/test/unported/tags.events b/test/unported/tags.events deleted file mode 100644 index bb93dce1..00000000 --- a/test/unported/tags.events +++ /dev/null @@ -1,12 +0,0 @@ -- !StreamStart -- !DocumentStart -- !SequenceStart -- !Scalar { value: 'data' } -#- !Scalar { tag: '!', value: 'data' } -- !Scalar { tag: 'tag:yaml.org,2002:str', value: 'data' } -- !Scalar { tag: '!myfunnytag', value: 'data' } -- !Scalar { tag: '!my!ugly!tag', value: 'data' } -- !Scalar { tag: 'tag:my.domain.org,2002:data!? #', value: 'data' } -- !SequenceEnd -- !DocumentEnd -- !StreamEnd diff --git a/test/unported/unknown.dumper-error b/test/unported/unknown.dumper-error deleted file mode 100644 index 83204d29..00000000 --- a/test/unported/unknown.dumper-error +++ /dev/null @@ -1 +0,0 @@ -yaml.safe_dump(object) diff --git a/test/unported/unsupported-version.emitter-error b/test/unported/unsupported-version.emitter-error deleted file mode 100644 index f9c61976..00000000 --- a/test/unported/unsupported-version.emitter-error +++ /dev/null @@ -1,5 +0,0 @@ -- !StreamStart -- !DocumentStart { version: [5,6] } -- !Scalar { value: foo } -- !DocumentEnd -- !StreamEnd diff --git a/test/unsupported/bool.detect b/test/unsupported/bool.detect deleted file mode 100644 index 947ebbb9..00000000 --- a/test/unsupported/bool.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:bool diff --git a/test/unsupported/colon-in-flow-context.loader-error b/test/unsupported/colon-in-flow-context.loader-error deleted file mode 100644 index 13d50875..00000000 --- a/test/unsupported/colon-in-flow-context.loader-error +++ /dev/null @@ -1 +0,0 @@ -{ foo:bar } diff --git a/test/unsupported/construct-python-bool.code b/test/unsupported/construct-python-bool.code deleted file mode 100644 index 170da013..00000000 --- a/test/unsupported/construct-python-bool.code +++ /dev/null @@ -1 +0,0 @@ -[ True, False ] diff --git a/test/unsupported/construct-python-bool.data b/test/unsupported/construct-python-bool.data deleted file mode 100644 index 00688696..00000000 --- a/test/unsupported/construct-python-bool.data +++ /dev/null @@ -1 +0,0 @@ -[ !!python/bool True, !!python/bool False ] diff --git a/test/unsupported/construct-python-bytes-py3.code b/test/unsupported/construct-python-bytes-py3.code deleted file mode 100644 index b9051d8d..00000000 --- a/test/unsupported/construct-python-bytes-py3.code +++ /dev/null @@ -1 +0,0 @@ -b'some binary data' diff --git a/test/unsupported/construct-python-bytes-py3.data b/test/unsupported/construct-python-bytes-py3.data deleted file mode 100644 index 95287259..00000000 --- a/test/unsupported/construct-python-bytes-py3.data +++ /dev/null @@ -1 +0,0 @@ ---- !!python/bytes 'c29tZSBiaW5hcnkgZGF0YQ==' diff --git a/test/unsupported/construct-python-complex.code b/test/unsupported/construct-python-complex.code deleted file mode 100644 index e582dff2..00000000 --- a/test/unsupported/construct-python-complex.code +++ /dev/null @@ -1 +0,0 @@ -[0.5+0j, 0.5+0.5j, 0.5j, -0.5+0.5j, -0.5+0j, -0.5-0.5j, -0.5j, 0.5-0.5j] diff --git a/test/unsupported/construct-python-complex.data b/test/unsupported/construct-python-complex.data deleted file mode 100644 index 17ebad46..00000000 --- a/test/unsupported/construct-python-complex.data +++ /dev/null @@ -1,8 +0,0 @@ -- !!python/complex 0.5+0j -- !!python/complex 0.5+0.5j -- !!python/complex 0.5j -- !!python/complex -0.5+0.5j -- !!python/complex -0.5+0j -- !!python/complex -0.5-0.5j -- !!python/complex -0.5j -- !!python/complex 0.5-0.5j diff --git a/test/unsupported/construct-python-float.code b/test/unsupported/construct-python-float.code deleted file mode 100644 index d5910a0a..00000000 --- a/test/unsupported/construct-python-float.code +++ /dev/null @@ -1 +0,0 @@ -123.456 diff --git a/test/unsupported/construct-python-float.data b/test/unsupported/construct-python-float.data deleted file mode 100644 index b460eb88..00000000 --- a/test/unsupported/construct-python-float.data +++ /dev/null @@ -1 +0,0 @@ -!!python/float 123.456 diff --git a/test/unsupported/construct-python-int.code b/test/unsupported/construct-python-int.code deleted file mode 100644 index 190a1803..00000000 --- a/test/unsupported/construct-python-int.code +++ /dev/null @@ -1 +0,0 @@ -123 diff --git a/test/unsupported/construct-python-int.data b/test/unsupported/construct-python-int.data deleted file mode 100644 index 741d6698..00000000 --- a/test/unsupported/construct-python-int.data +++ /dev/null @@ -1 +0,0 @@ -!!python/int 123 diff --git a/test/unsupported/construct-python-long-short-py2.code b/test/unsupported/construct-python-long-short-py2.code deleted file mode 100644 index fafc3f15..00000000 --- a/test/unsupported/construct-python-long-short-py2.code +++ /dev/null @@ -1 +0,0 @@ -123L diff --git a/test/unsupported/construct-python-long-short-py2.data b/test/unsupported/construct-python-long-short-py2.data deleted file mode 100644 index 4bd5dc2b..00000000 --- a/test/unsupported/construct-python-long-short-py2.data +++ /dev/null @@ -1 +0,0 @@ -!!python/long 123 diff --git a/test/unsupported/construct-python-long-short-py3.code b/test/unsupported/construct-python-long-short-py3.code deleted file mode 100644 index 190a1803..00000000 --- a/test/unsupported/construct-python-long-short-py3.code +++ /dev/null @@ -1 +0,0 @@ -123 diff --git a/test/unsupported/construct-python-long-short-py3.data b/test/unsupported/construct-python-long-short-py3.data deleted file mode 100644 index 4bd5dc2b..00000000 --- a/test/unsupported/construct-python-long-short-py3.data +++ /dev/null @@ -1 +0,0 @@ -!!python/long 123 diff --git a/test/unsupported/construct-python-name-module.code b/test/unsupported/construct-python-name-module.code deleted file mode 100644 index 6f391488..00000000 --- a/test/unsupported/construct-python-name-module.code +++ /dev/null @@ -1 +0,0 @@ -[str, yaml.Loader, yaml.dump, abs, yaml.tokens] diff --git a/test/unsupported/construct-python-name-module.data b/test/unsupported/construct-python-name-module.data deleted file mode 100644 index f0c9712b..00000000 --- a/test/unsupported/construct-python-name-module.data +++ /dev/null @@ -1,5 +0,0 @@ -- !!python/name:str -- !!python/name:yaml.Loader -- !!python/name:yaml.dump -- !!python/name:abs -- !!python/module:yaml.tokens diff --git a/test/unsupported/construct-python-none.code b/test/unsupported/construct-python-none.code deleted file mode 100644 index b0047fa4..00000000 --- a/test/unsupported/construct-python-none.code +++ /dev/null @@ -1 +0,0 @@ -None diff --git a/test/unsupported/construct-python-none.data b/test/unsupported/construct-python-none.data deleted file mode 100644 index 7907ec3e..00000000 --- a/test/unsupported/construct-python-none.data +++ /dev/null @@ -1 +0,0 @@ -!!python/none diff --git a/test/unsupported/construct-python-object.code b/test/unsupported/construct-python-object.code deleted file mode 100644 index 7f1edf12..00000000 --- a/test/unsupported/construct-python-object.code +++ /dev/null @@ -1,23 +0,0 @@ -[ -AnObject(1, 'two', [3,3,3]), -AnInstance(1, 'two', [3,3,3]), - -AnObject(1, 'two', [3,3,3]), -AnInstance(1, 'two', [3,3,3]), - -AState(1, 'two', [3,3,3]), -ACustomState(1, 'two', [3,3,3]), - -InitArgs(1, 'two', [3,3,3]), -InitArgsWithState(1, 'two', [3,3,3]), - -NewArgs(1, 'two', [3,3,3]), -NewArgsWithState(1, 'two', [3,3,3]), - -Reduce(1, 'two', [3,3,3]), -ReduceWithState(1, 'two', [3,3,3]), - -MyInt(3), -MyList(3), -MyDict(3), -] diff --git a/test/unsupported/construct-python-object.data b/test/unsupported/construct-python-object.data deleted file mode 100644 index bce8b2ed..00000000 --- a/test/unsupported/construct-python-object.data +++ /dev/null @@ -1,21 +0,0 @@ -- !!python/object:test_constructor.AnObject { foo: 1, bar: two, baz: [3,3,3] } -- !!python/object:test_constructor.AnInstance { foo: 1, bar: two, baz: [3,3,3] } - -- !!python/object/new:test_constructor.AnObject { args: [1, two], kwds: {baz: [3,3,3]} } -- !!python/object/apply:test_constructor.AnInstance { args: [1, two], kwds: {baz: [3,3,3]} } - -- !!python/object:test_constructor.AState { _foo: 1, _bar: two, _baz: [3,3,3] } -- !!python/object/new:test_constructor.ACustomState { state: !!python/tuple [1, two, [3,3,3]] } - -- !!python/object/new:test_constructor.InitArgs [1, two, [3,3,3]] -- !!python/object/new:test_constructor.InitArgsWithState { args: [1, two], state: [3,3,3] } - -- !!python/object/new:test_constructor.NewArgs [1, two, [3,3,3]] -- !!python/object/new:test_constructor.NewArgsWithState { args: [1, two], state: [3,3,3] } - -- !!python/object/apply:test_constructor.Reduce [1, two, [3,3,3]] -- !!python/object/apply:test_constructor.ReduceWithState { args: [1, two], state: [3,3,3] } - -- !!python/object/new:test_constructor.MyInt [3] -- !!python/object/new:test_constructor.MyList { listitems: [~, ~, ~] } -- !!python/object/new:test_constructor.MyDict { dictitems: {0, 1, 2} } diff --git a/test/unsupported/construct-python-str-ascii.code b/test/unsupported/construct-python-str-ascii.code deleted file mode 100644 index d9d62f63..00000000 --- a/test/unsupported/construct-python-str-ascii.code +++ /dev/null @@ -1 +0,0 @@ -"ascii string" diff --git a/test/unsupported/construct-python-str-ascii.data b/test/unsupported/construct-python-str-ascii.data deleted file mode 100644 index a83349e2..00000000 --- a/test/unsupported/construct-python-str-ascii.data +++ /dev/null @@ -1 +0,0 @@ ---- !!python/str "ascii string" diff --git a/test/unsupported/construct-python-str-utf8-py2.code b/test/unsupported/construct-python-str-utf8-py2.code deleted file mode 100644 index 47b28ab2..00000000 --- a/test/unsupported/construct-python-str-utf8-py2.code +++ /dev/null @@ -1 +0,0 @@ -u'\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430'.encode('utf-8') diff --git a/test/unsupported/construct-python-str-utf8-py2.data b/test/unsupported/construct-python-str-utf8-py2.data deleted file mode 100644 index 9ef2c72e..00000000 --- a/test/unsupported/construct-python-str-utf8-py2.data +++ /dev/null @@ -1 +0,0 @@ ---- !!python/str "Это уникодная строка" diff --git a/test/unsupported/construct-python-str-utf8-py3.code b/test/unsupported/construct-python-str-utf8-py3.code deleted file mode 100644 index 9f66032c..00000000 --- a/test/unsupported/construct-python-str-utf8-py3.code +++ /dev/null @@ -1 +0,0 @@ -'\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430' diff --git a/test/unsupported/construct-python-str-utf8-py3.data b/test/unsupported/construct-python-str-utf8-py3.data deleted file mode 100644 index 9ef2c72e..00000000 --- a/test/unsupported/construct-python-str-utf8-py3.data +++ /dev/null @@ -1 +0,0 @@ ---- !!python/str "Это уникодная строка" diff --git a/test/unsupported/construct-python-tuple-list-dict.code b/test/unsupported/construct-python-tuple-list-dict.code deleted file mode 100644 index 20ced988..00000000 --- a/test/unsupported/construct-python-tuple-list-dict.code +++ /dev/null @@ -1,6 +0,0 @@ -[ - [1, 2, 3, 4], - (1, 2, 3, 4), - {1: 2, 3: 4}, - {(0,0): 0, (0,1): 1, (1,0): 1, (1,1): 0}, -] diff --git a/test/unsupported/construct-python-tuple-list-dict.data b/test/unsupported/construct-python-tuple-list-dict.data deleted file mode 100644 index c56159b5..00000000 --- a/test/unsupported/construct-python-tuple-list-dict.data +++ /dev/null @@ -1,8 +0,0 @@ -- !!python/list [1, 2, 3, 4] -- !!python/tuple [1, 2, 3, 4] -- !!python/dict {1: 2, 3: 4} -- !!python/dict - !!python/tuple [0,0]: 0 - !!python/tuple [0,1]: 1 - !!python/tuple [1,0]: 1 - !!python/tuple [1,1]: 0 diff --git a/test/unsupported/construct-python-unicode-ascii-py2.code b/test/unsupported/construct-python-unicode-ascii-py2.code deleted file mode 100644 index d4cd82c6..00000000 --- a/test/unsupported/construct-python-unicode-ascii-py2.code +++ /dev/null @@ -1 +0,0 @@ -u"ascii string" diff --git a/test/unsupported/construct-python-unicode-ascii-py2.data b/test/unsupported/construct-python-unicode-ascii-py2.data deleted file mode 100644 index 3a0647b3..00000000 --- a/test/unsupported/construct-python-unicode-ascii-py2.data +++ /dev/null @@ -1 +0,0 @@ ---- !!python/unicode "ascii string" diff --git a/test/unsupported/construct-python-unicode-ascii-py3.code b/test/unsupported/construct-python-unicode-ascii-py3.code deleted file mode 100644 index d9d62f63..00000000 --- a/test/unsupported/construct-python-unicode-ascii-py3.code +++ /dev/null @@ -1 +0,0 @@ -"ascii string" diff --git a/test/unsupported/construct-python-unicode-ascii-py3.data b/test/unsupported/construct-python-unicode-ascii-py3.data deleted file mode 100644 index 3a0647b3..00000000 --- a/test/unsupported/construct-python-unicode-ascii-py3.data +++ /dev/null @@ -1 +0,0 @@ ---- !!python/unicode "ascii string" diff --git a/test/unsupported/construct-python-unicode-utf8-py2.code b/test/unsupported/construct-python-unicode-utf8-py2.code deleted file mode 100644 index 2793ac7f..00000000 --- a/test/unsupported/construct-python-unicode-utf8-py2.code +++ /dev/null @@ -1 +0,0 @@ -u'\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430' diff --git a/test/unsupported/construct-python-unicode-utf8-py2.data b/test/unsupported/construct-python-unicode-utf8-py2.data deleted file mode 100644 index 5a980ea0..00000000 --- a/test/unsupported/construct-python-unicode-utf8-py2.data +++ /dev/null @@ -1 +0,0 @@ ---- !!python/unicode "Это уникодная строка" diff --git a/test/unsupported/construct-python-unicode-utf8-py3.code b/test/unsupported/construct-python-unicode-utf8-py3.code deleted file mode 100644 index 9f66032c..00000000 --- a/test/unsupported/construct-python-unicode-utf8-py3.code +++ /dev/null @@ -1 +0,0 @@ -'\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430' diff --git a/test/unsupported/construct-python-unicode-utf8-py3.data b/test/unsupported/construct-python-unicode-utf8-py3.data deleted file mode 100644 index 5a980ea0..00000000 --- a/test/unsupported/construct-python-unicode-utf8-py3.data +++ /dev/null @@ -1 +0,0 @@ ---- !!python/unicode "Это уникодная строка" diff --git a/test/unsupported/duplicate-anchor-1.loader-error b/test/unsupported/duplicate-anchor-1.loader-error deleted file mode 100644 index 906cf29d..00000000 --- a/test/unsupported/duplicate-anchor-1.loader-error +++ /dev/null @@ -1,3 +0,0 @@ -- &foo bar -- &bar bar -- &foo bar diff --git a/test/unsupported/duplicate-anchor-2.loader-error b/test/unsupported/duplicate-anchor-2.loader-error deleted file mode 100644 index 62b43897..00000000 --- a/test/unsupported/duplicate-anchor-2.loader-error +++ /dev/null @@ -1 +0,0 @@ -&foo [1, 2, 3, &foo 4] diff --git a/test/unsupported/duplicate-mapping-key.data b/test/unsupported/duplicate-mapping-key.data deleted file mode 100644 index 7e7b4d13..00000000 --- a/test/unsupported/duplicate-mapping-key.data +++ /dev/null @@ -1,6 +0,0 @@ ---- -&anchor foo: - foo: bar - *anchor: duplicate key - baz: bat - *anchor: duplicate key diff --git a/test/unsupported/empty-python-module.loader-error b/test/unsupported/empty-python-module.loader-error deleted file mode 100644 index 83d3232b..00000000 --- a/test/unsupported/empty-python-module.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python:module: diff --git a/test/unsupported/empty-python-name.loader-error b/test/unsupported/empty-python-name.loader-error deleted file mode 100644 index 61629572..00000000 --- a/test/unsupported/empty-python-name.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/name: empty diff --git a/test/unsupported/float-representer-2.3-bug.code b/test/unsupported/float-representer-2.3-bug.code deleted file mode 100644 index d8db834b..00000000 --- a/test/unsupported/float-representer-2.3-bug.code +++ /dev/null @@ -1,7 +0,0 @@ -{ -# 0.0: 0, - 1.0: 1, - 1e300000: +10, - -1e300000: -10, - 1e300000/1e300000: 100, -} diff --git a/test/unsupported/float-representer-2.3-bug.data b/test/unsupported/float-representer-2.3-bug.data deleted file mode 100644 index efd17163..00000000 --- a/test/unsupported/float-representer-2.3-bug.data +++ /dev/null @@ -1,5 +0,0 @@ -#0.0: # hash(0) == hash(nan) and 0 == nan in Python 2.3 -1.0: 1 -+.inf: 10 --.inf: -10 -.nan: 100 diff --git a/test/unsupported/float.detect b/test/unsupported/float.detect deleted file mode 100644 index 1e12343b..00000000 --- a/test/unsupported/float.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:float diff --git a/test/unsupported/function.detect b/test/unsupported/function.detect deleted file mode 100644 index 54e7fda6..00000000 --- a/test/unsupported/function.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:js/function diff --git a/test/unsupported/int.detect b/test/unsupported/int.detect deleted file mode 100644 index 575c9eb4..00000000 --- a/test/unsupported/int.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:int diff --git a/test/unsupported/invalid-anchor-1.loader-error b/test/unsupported/invalid-anchor-1.loader-error deleted file mode 100644 index fcf7d0f6..00000000 --- a/test/unsupported/invalid-anchor-1.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- &? foo # we allow only ascii and numeric characters in anchor names. diff --git a/test/unsupported/invalid-python-bytes-2-py3.loader-error b/test/unsupported/invalid-python-bytes-2-py3.loader-error deleted file mode 100644 index f43af59e..00000000 --- a/test/unsupported/invalid-python-bytes-2-py3.loader-error +++ /dev/null @@ -1,2 +0,0 @@ ---- !!python/bytes - двоичные данные в base64 diff --git a/test/unsupported/invalid-python-bytes-py3.loader-error b/test/unsupported/invalid-python-bytes-py3.loader-error deleted file mode 100644 index a19dfd0d..00000000 --- a/test/unsupported/invalid-python-bytes-py3.loader-error +++ /dev/null @@ -1,2 +0,0 @@ ---- !!python/bytes - binary data encoded in base64 should be here. diff --git a/test/unsupported/invalid-python-module-kind.loader-error b/test/unsupported/invalid-python-module-kind.loader-error deleted file mode 100644 index 4f71cb55..00000000 --- a/test/unsupported/invalid-python-module-kind.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/module:sys { must, be, scalar } diff --git a/test/unsupported/invalid-python-module-value.loader-error b/test/unsupported/invalid-python-module-value.loader-error deleted file mode 100644 index f6797fc3..00000000 --- a/test/unsupported/invalid-python-module-value.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/module:sys "non-empty value" diff --git a/test/unsupported/invalid-python-module.loader-error b/test/unsupported/invalid-python-module.loader-error deleted file mode 100644 index 4e240728..00000000 --- a/test/unsupported/invalid-python-module.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/module:no.such.module diff --git a/test/unsupported/invalid-python-name-kind.loader-error b/test/unsupported/invalid-python-name-kind.loader-error deleted file mode 100644 index 6ff8eb6b..00000000 --- a/test/unsupported/invalid-python-name-kind.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/name:sys.modules {} diff --git a/test/unsupported/invalid-python-name-module-2.loader-error b/test/unsupported/invalid-python-name-module-2.loader-error deleted file mode 100644 index debc3139..00000000 --- a/test/unsupported/invalid-python-name-module-2.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/name:xml.parsers diff --git a/test/unsupported/invalid-python-name-module.loader-error b/test/unsupported/invalid-python-name-module.loader-error deleted file mode 100644 index 1966f6a2..00000000 --- a/test/unsupported/invalid-python-name-module.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/name:sys.modules.keys diff --git a/test/unsupported/invalid-python-name-object.loader-error b/test/unsupported/invalid-python-name-object.loader-error deleted file mode 100644 index 50f386f2..00000000 --- a/test/unsupported/invalid-python-name-object.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/name:os.path.rm_rf diff --git a/test/unsupported/invalid-python-name-value.loader-error b/test/unsupported/invalid-python-name-value.loader-error deleted file mode 100644 index 7be1401e..00000000 --- a/test/unsupported/invalid-python-name-value.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !!python/name:sys.modules 5 diff --git a/test/unsupported/invalid-tag-1.loader-error b/test/unsupported/invalid-tag-1.loader-error deleted file mode 100644 index a68cd384..00000000 --- a/test/unsupported/invalid-tag-1.loader-error +++ /dev/null @@ -1 +0,0 @@ -- ! baz diff --git a/test/unsupported/invalid-tag-directive-prefix.loader-error b/test/unsupported/invalid-tag-directive-prefix.loader-error deleted file mode 100644 index 0cb482c9..00000000 --- a/test/unsupported/invalid-tag-directive-prefix.loader-error +++ /dev/null @@ -1,2 +0,0 @@ -%TAG ! tag:zz.com/foo#bar # '#' is not allowed in URLs ---- diff --git a/test/unsupported/invalid-uri-escapes-2.loader-error b/test/unsupported/invalid-uri-escapes-2.loader-error deleted file mode 100644 index b89e8f6a..00000000 --- a/test/unsupported/invalid-uri-escapes-2.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !<%FF> foo diff --git a/test/unsupported/invalid-uri-escapes-3.loader-error b/test/unsupported/invalid-uri-escapes-3.loader-error deleted file mode 100644 index f2e4cb82..00000000 --- a/test/unsupported/invalid-uri-escapes-3.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- ! baz diff --git a/test/unsupported/merge.detect b/test/unsupported/merge.detect deleted file mode 100644 index 1672d0d9..00000000 --- a/test/unsupported/merge.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:merge diff --git a/test/unsupported/null.detect b/test/unsupported/null.detect deleted file mode 100644 index 19110c7c..00000000 --- a/test/unsupported/null.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:null diff --git a/test/unsupported/odd-utf16.stream-error b/test/unsupported/odd-utf16.stream-error deleted file mode 100644 index b59e43449b1c25d5728f38bf124a59e2b882ada1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1311 zcmeH`OA5k35JcbFQ#53&f*X(E3E}}_j3~qzNTT57)t6jiHld-XtEQ?O=JWkg6^%{N z=@skz_5MqqK>7DqbLYWGaC7bHtXeXOiAE+Zdzq^dq8Cptss>Tk6QYmWPTf{C%7(tl k+}a@-c|o%)WP-Q3S2K4!Q*&a+fum?tIjC!#vM>HS|1HgG(*OVf diff --git a/test/unsupported/spec-02-01.structure b/test/unsupported/spec-02-01.structure deleted file mode 100644 index 601ef4cf..00000000 --- a/test/unsupported/spec-02-01.structure +++ /dev/null @@ -1 +0,0 @@ -[true, true, true] diff --git a/test/unsupported/spec-02-01.tokens b/test/unsupported/spec-02-01.tokens deleted file mode 100644 index ce44caca..00000000 --- a/test/unsupported/spec-02-01.tokens +++ /dev/null @@ -1 +0,0 @@ -[[ , _ , _ , _ ]} diff --git a/test/unsupported/spec-02-02.structure b/test/unsupported/spec-02-02.structure deleted file mode 100644 index 50892071..00000000 --- a/test/unsupported/spec-02-02.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true], [true, true]] diff --git a/test/unsupported/spec-02-02.tokens b/test/unsupported/spec-02-02.tokens deleted file mode 100644 index e4e381b4..00000000 --- a/test/unsupported/spec-02-02.tokens +++ /dev/null @@ -1,5 +0,0 @@ -{{ -? _ : _ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-03.structure b/test/unsupported/spec-02-03.structure deleted file mode 100644 index 13d1d2d6..00000000 --- a/test/unsupported/spec-02-03.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, [true, true, true]], [true, [true, true, true]]] diff --git a/test/unsupported/spec-02-03.tokens b/test/unsupported/spec-02-03.tokens deleted file mode 100644 index 89815f29..00000000 --- a/test/unsupported/spec-02-03.tokens +++ /dev/null @@ -1,4 +0,0 @@ -{{ -? _ : [[ , _ , _ , _ ]} -? _ : [[ , _ , _ , _ ]} -]} diff --git a/test/unsupported/spec-02-04.structure b/test/unsupported/spec-02-04.structure deleted file mode 100644 index f1870b3d..00000000 --- a/test/unsupported/spec-02-04.structure +++ /dev/null @@ -1,4 +0,0 @@ -[ - [[true, true], [true, true], [true, true]], - [[true, true], [true, true], [true, true]] -] diff --git a/test/unsupported/spec-02-04.tokens b/test/unsupported/spec-02-04.tokens deleted file mode 100644 index 9cb98156..00000000 --- a/test/unsupported/spec-02-04.tokens +++ /dev/null @@ -1,4 +0,0 @@ -[[ -, {{ ? _ : _ ? _ : _ ? _ : _ ]} -, {{ ? _ : _ ? _ : _ ? _ : _ ]} -]} diff --git a/test/unsupported/spec-02-05.structure b/test/unsupported/spec-02-05.structure deleted file mode 100644 index fe1e058a..00000000 --- a/test/unsupported/spec-02-05.structure +++ /dev/null @@ -1,5 +0,0 @@ -[ - [true, true, true], - [true, true, true], - [true, true, true] -] diff --git a/test/unsupported/spec-02-05.tokens b/test/unsupported/spec-02-05.tokens deleted file mode 100644 index 3f6f1ab5..00000000 --- a/test/unsupported/spec-02-05.tokens +++ /dev/null @@ -1,5 +0,0 @@ -[[ -, [ _ , _ , _ ] -, [ _ , _ , _ ] -, [ _ , _ , _ ] -]} diff --git a/test/unsupported/spec-02-06.structure b/test/unsupported/spec-02-06.structure deleted file mode 100644 index 7d107115..00000000 --- a/test/unsupported/spec-02-06.structure +++ /dev/null @@ -1,4 +0,0 @@ -[ - [true, [[true, true], [true, true]]], - [true, [[true, true], [true, true]]] -] diff --git a/test/unsupported/spec-02-06.tokens b/test/unsupported/spec-02-06.tokens deleted file mode 100644 index a1a5eef2..00000000 --- a/test/unsupported/spec-02-06.tokens +++ /dev/null @@ -1,4 +0,0 @@ -{{ -? _ : { ? _ : _ , ? _ : _ } -? _ : { ? _ : _ , ? _ : _ } -]} diff --git a/test/unsupported/spec-02-07.structure b/test/unsupported/spec-02-07.structure deleted file mode 100644 index 73457a81..00000000 --- a/test/unsupported/spec-02-07.structure +++ /dev/null @@ -1,4 +0,0 @@ -[ -[true, true, true], -[true, true] -] diff --git a/test/unsupported/spec-02-07.tokens b/test/unsupported/spec-02-07.tokens deleted file mode 100644 index ed48883c..00000000 --- a/test/unsupported/spec-02-07.tokens +++ /dev/null @@ -1,12 +0,0 @@ ---- -[[ -, _ -, _ -, _ -]} - ---- -[[ -, _ -, _ -]} diff --git a/test/unsupported/spec-02-08.structure b/test/unsupported/spec-02-08.structure deleted file mode 100644 index cb95786a..00000000 --- a/test/unsupported/spec-02-08.structure +++ /dev/null @@ -1,4 +0,0 @@ -[ -[[true, true], [true, true], [true, true]], -[[true, true], [true, true], [true, true]] -] diff --git a/test/unsupported/spec-02-08.tokens b/test/unsupported/spec-02-08.tokens deleted file mode 100644 index 7d2c03df..00000000 --- a/test/unsupported/spec-02-08.tokens +++ /dev/null @@ -1,15 +0,0 @@ ---- -{{ -? _ : _ -? _ : _ -? _ : _ -]} -... - ---- -{{ -? _ : _ -? _ : _ -? _ : _ -]} -... diff --git a/test/unsupported/spec-02-09.structure b/test/unsupported/spec-02-09.structure deleted file mode 100644 index 231fd207..00000000 --- a/test/unsupported/spec-02-09.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, [true, true]], [true, [true, true]]] diff --git a/test/unsupported/spec-02-09.tokens b/test/unsupported/spec-02-09.tokens deleted file mode 100644 index b2ec10ea..00000000 --- a/test/unsupported/spec-02-09.tokens +++ /dev/null @@ -1,5 +0,0 @@ ---- -{{ -? _ : [[ , _ , _ ]} -? _ : [[ , _ , _ ]} -]} diff --git a/test/unsupported/spec-02-10.structure b/test/unsupported/spec-02-10.structure deleted file mode 100644 index d09f5bbf..00000000 --- a/test/unsupported/spec-02-10.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, [true, true]], [true, ["*", true]]] diff --git a/test/unsupported/spec-02-10.tokens b/test/unsupported/spec-02-10.tokens deleted file mode 100644 index 26caa2b1..00000000 --- a/test/unsupported/spec-02-10.tokens +++ /dev/null @@ -1,5 +0,0 @@ ---- -{{ -? _ : [[ , _ , & _ ]} -? _ : [[ , * , _ ]} -]} diff --git a/test/unsupported/spec-02-11.structure b/test/unsupported/spec-02-11.structure deleted file mode 100644 index 9b473993..00000000 --- a/test/unsupported/spec-02-11.structure +++ /dev/null @@ -1,4 +0,0 @@ -[ -[[true, true], [true]], -[[true, true], [true, true, true]] -] diff --git a/test/unsupported/spec-02-11.tokens b/test/unsupported/spec-02-11.tokens deleted file mode 100644 index fe242033..00000000 --- a/test/unsupported/spec-02-11.tokens +++ /dev/null @@ -1,6 +0,0 @@ -{{ -? [[ , _ , _ ]} -: [[ , _ ]} -? [ _ , _ ] -: [ _ , _ , _ ] -]} diff --git a/test/unsupported/spec-02-12.structure b/test/unsupported/spec-02-12.structure deleted file mode 100644 index 402284a7..00000000 --- a/test/unsupported/spec-02-12.structure +++ /dev/null @@ -1,5 +0,0 @@ -[ -[[true, true], [true, true]], -[[true, true], [true, true]], -[[true, true], [true, true]] -] diff --git a/test/unsupported/spec-02-12.tokens b/test/unsupported/spec-02-12.tokens deleted file mode 100644 index ea21e506..00000000 --- a/test/unsupported/spec-02-12.tokens +++ /dev/null @@ -1,6 +0,0 @@ ---- -[[ -, {{ ? _ : _ ? _ : _ ]} -, {{ ? _ : _ ? _ : _ ]} -, {{ ? _ : _ ? _ : _ ]} -]} diff --git a/test/unsupported/spec-02-13.structure b/test/unsupported/spec-02-13.structure deleted file mode 100644 index 27ba77dd..00000000 --- a/test/unsupported/spec-02-13.structure +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/test/unsupported/spec-02-13.tokens b/test/unsupported/spec-02-13.tokens deleted file mode 100644 index 7456c055..00000000 --- a/test/unsupported/spec-02-13.tokens +++ /dev/null @@ -1 +0,0 @@ ---- _ diff --git a/test/unsupported/spec-02-14.structure b/test/unsupported/spec-02-14.structure deleted file mode 100644 index 27ba77dd..00000000 --- a/test/unsupported/spec-02-14.structure +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/test/unsupported/spec-02-14.tokens b/test/unsupported/spec-02-14.tokens deleted file mode 100644 index 7456c055..00000000 --- a/test/unsupported/spec-02-14.tokens +++ /dev/null @@ -1 +0,0 @@ ---- _ diff --git a/test/unsupported/spec-02-15.structure b/test/unsupported/spec-02-15.structure deleted file mode 100644 index 27ba77dd..00000000 --- a/test/unsupported/spec-02-15.structure +++ /dev/null @@ -1 +0,0 @@ -true diff --git a/test/unsupported/spec-02-15.tokens b/test/unsupported/spec-02-15.tokens deleted file mode 100644 index 31354ec1..00000000 --- a/test/unsupported/spec-02-15.tokens +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/test/unsupported/spec-02-16.structure b/test/unsupported/spec-02-16.structure deleted file mode 100644 index 50892071..00000000 --- a/test/unsupported/spec-02-16.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true], [true, true]] diff --git a/test/unsupported/spec-02-16.tokens b/test/unsupported/spec-02-16.tokens deleted file mode 100644 index e4e381b4..00000000 --- a/test/unsupported/spec-02-16.tokens +++ /dev/null @@ -1,5 +0,0 @@ -{{ -? _ : _ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-17.structure b/test/unsupported/spec-02-17.structure deleted file mode 100644 index 951f95bb..00000000 --- a/test/unsupported/spec-02-17.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true], [true, true], [true, true], [true, true], [true, true]] diff --git a/test/unsupported/spec-02-17.tokens b/test/unsupported/spec-02-17.tokens deleted file mode 100644 index db655402..00000000 --- a/test/unsupported/spec-02-17.tokens +++ /dev/null @@ -1,8 +0,0 @@ -{{ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-18.structure b/test/unsupported/spec-02-18.structure deleted file mode 100644 index e328e442..00000000 --- a/test/unsupported/spec-02-18.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true]] diff --git a/test/unsupported/spec-02-18.tokens b/test/unsupported/spec-02-18.tokens deleted file mode 100644 index 83b31dc0..00000000 --- a/test/unsupported/spec-02-18.tokens +++ /dev/null @@ -1,4 +0,0 @@ -{{ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-19.structure b/test/unsupported/spec-02-19.structure deleted file mode 100644 index 1de65f81..00000000 --- a/test/unsupported/spec-02-19.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true], [true, true], [true, true], [true, true]] diff --git a/test/unsupported/spec-02-19.tokens b/test/unsupported/spec-02-19.tokens deleted file mode 100644 index 5bda68f4..00000000 --- a/test/unsupported/spec-02-19.tokens +++ /dev/null @@ -1,7 +0,0 @@ -{{ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-20.structure b/test/unsupported/spec-02-20.structure deleted file mode 100644 index 951f95bb..00000000 --- a/test/unsupported/spec-02-20.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true], [true, true], [true, true], [true, true], [true, true]] diff --git a/test/unsupported/spec-02-20.tokens b/test/unsupported/spec-02-20.tokens deleted file mode 100644 index db655402..00000000 --- a/test/unsupported/spec-02-20.tokens +++ /dev/null @@ -1,8 +0,0 @@ -{{ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-21.structure b/test/unsupported/spec-02-21.structure deleted file mode 100644 index 218b72e2..00000000 --- a/test/unsupported/spec-02-21.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true], [true, true], [true, true]] diff --git a/test/unsupported/spec-02-21.tokens b/test/unsupported/spec-02-21.tokens deleted file mode 100644 index aeccbaf6..00000000 --- a/test/unsupported/spec-02-21.tokens +++ /dev/null @@ -1,6 +0,0 @@ -{{ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-22.structure b/test/unsupported/spec-02-22.structure deleted file mode 100644 index 218b72e2..00000000 --- a/test/unsupported/spec-02-22.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true], [true, true], [true, true]] diff --git a/test/unsupported/spec-02-22.tokens b/test/unsupported/spec-02-22.tokens deleted file mode 100644 index aeccbaf6..00000000 --- a/test/unsupported/spec-02-22.tokens +++ /dev/null @@ -1,6 +0,0 @@ -{{ -? _ : _ -? _ : _ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-23.structure b/test/unsupported/spec-02-23.structure deleted file mode 100644 index 50892071..00000000 --- a/test/unsupported/spec-02-23.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, true], [true, true], [true, true]] diff --git a/test/unsupported/spec-02-23.tokens b/test/unsupported/spec-02-23.tokens deleted file mode 100644 index 9ac54aad..00000000 --- a/test/unsupported/spec-02-23.tokens +++ /dev/null @@ -1,6 +0,0 @@ ---- -{{ -? _ : ! _ -? _ : ! _ -? _ : ! _ -]} diff --git a/test/unsupported/spec-02-24.structure b/test/unsupported/spec-02-24.structure deleted file mode 100644 index 9bb935dd..00000000 --- a/test/unsupported/spec-02-24.structure +++ /dev/null @@ -1,5 +0,0 @@ -[ -[[true, [[true, true], [true, true]]], [true, true]], -[[true, "*"], [true, [[true, true], [true, true]]]], -[[true, "*"], [true, true], [true, true]] -] diff --git a/test/unsupported/spec-02-24.tokens b/test/unsupported/spec-02-24.tokens deleted file mode 100644 index 039c3857..00000000 --- a/test/unsupported/spec-02-24.tokens +++ /dev/null @@ -1,20 +0,0 @@ -% ---- ! -[[ -, ! - {{ - ? _ : & { ? _ : _ , ? _ : _ } - ? _ : _ - ]} -, ! - {{ - ? _ : * - ? _ : { ? _ : _ , ? _ : _ } - ]} -, ! - {{ - ? _ : * - ? _ : _ - ? _ : _ - ]} -]} diff --git a/test/unsupported/spec-02-25.structure b/test/unsupported/spec-02-25.structure deleted file mode 100644 index a8054a69..00000000 --- a/test/unsupported/spec-02-25.structure +++ /dev/null @@ -1 +0,0 @@ -[[true, false], [true, false], [true, false]] diff --git a/test/unsupported/spec-02-25.tokens b/test/unsupported/spec-02-25.tokens deleted file mode 100644 index b7002368..00000000 --- a/test/unsupported/spec-02-25.tokens +++ /dev/null @@ -1,6 +0,0 @@ ---- ! -{{ -? _ -? _ -? _ -]} diff --git a/test/unsupported/spec-02-26.structure b/test/unsupported/spec-02-26.structure deleted file mode 100644 index 98bb243f..00000000 --- a/test/unsupported/spec-02-26.structure +++ /dev/null @@ -1,5 +0,0 @@ -[ -[[true, true]], -[[true, true]], -[[true, true]] -] diff --git a/test/unsupported/spec-02-26.tokens b/test/unsupported/spec-02-26.tokens deleted file mode 100644 index 7bee4920..00000000 --- a/test/unsupported/spec-02-26.tokens +++ /dev/null @@ -1,6 +0,0 @@ ---- ! -[[ -, {{ ? _ : _ ]} -, {{ ? _ : _ ]} -, {{ ? _ : _ ]} -]} diff --git a/test/unsupported/spec-02-27.structure b/test/unsupported/spec-02-27.structure deleted file mode 100644 index 805f140a..00000000 --- a/test/unsupported/spec-02-27.structure +++ /dev/null @@ -1,17 +0,0 @@ -[ -[true, true], -[true, true], -[true, [ - [true, true], - [true, true], - [true, [[true, true], [true, true], [true, true], [true, true]]] - ]], -[true, "*"], -[true, [ - [[true, true], [true, true], [true, true], [true, true]], - [[true, true], [true, true], [true, true], [true, true]] - ]], -[true, true], -[true, true], -[true, true] -] diff --git a/test/unsupported/spec-02-27.tokens b/test/unsupported/spec-02-27.tokens deleted file mode 100644 index 2dc1c25d..00000000 --- a/test/unsupported/spec-02-27.tokens +++ /dev/null @@ -1,20 +0,0 @@ ---- ! -{{ -? _ : _ -? _ : _ -? _ : & - {{ - ? _ : _ - ? _ : _ - ? _ : {{ ? _ : _ ? _ : _ ? _ : _ ? _ : _ ]} - ]} -? _ : * -? _ : - [[ - , {{ ? _ : _ ? _ : _ ? _ : _ ? _ : _ ]} - , {{ ? _ : _ ? _ : _ ? _ : _ ? _ : _ ]} - ]} -? _ : _ -? _ : _ -? _ : _ -]} diff --git a/test/unsupported/spec-02-28.structure b/test/unsupported/spec-02-28.structure deleted file mode 100644 index 21a1b7c8..00000000 --- a/test/unsupported/spec-02-28.structure +++ /dev/null @@ -1,10 +0,0 @@ -[ -[[true, true], [true, true], [true, true]], -[[true, true], [true, true], [true, true]], -[[true, true], [true, true], [true, true], -[true, [ - [[true, true], [true, true], [true, true]], - [[true, true], [true, true], [true, true]] - ]] -] -] diff --git a/test/unsupported/spec-02-28.tokens b/test/unsupported/spec-02-28.tokens deleted file mode 100644 index 8d5e1bc5..00000000 --- a/test/unsupported/spec-02-28.tokens +++ /dev/null @@ -1,23 +0,0 @@ ---- -{{ -? _ : _ -? _ : _ -? _ : _ -]} ---- -{{ -? _ : _ -? _ : _ -? _ : _ -]} ---- -{{ -? _ : _ -? _ : _ -? _ : _ -? _ : - [[ - , {{ ? _ : _ ? _ : _ ? _ : _ ]} - , {{ ? _ : _ ? _ : _ ? _ : _ ]} - ]} -]} diff --git a/test/unsupported/spec-05-01-utf16be.data b/test/unsupported/spec-05-01-utf16be.data deleted file mode 100644 index 35250629082adcbcf3224ca03148eec3f599f222..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34 lcmezOpFx>Hfx(#}pCK0rQyKCYN`U-)Af3Zd$)Lx;1pt))2QB~r diff --git a/test/unsupported/spec-05-01-utf16be.empty b/test/unsupported/spec-05-01-utf16be.empty deleted file mode 100644 index bfffa8b6..00000000 --- a/test/unsupported/spec-05-01-utf16be.empty +++ /dev/null @@ -1,2 +0,0 @@ -# This stream contains no -# documents, only comments. diff --git a/test/unsupported/spec-05-01-utf16le.data b/test/unsupported/spec-05-01-utf16le.data deleted file mode 100644 index 0823f7494bea13b6e939fd3ee694374f532828b8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 34 lcmezWPnki1!I>eSAr}Z!8S)rPfc$(Qox@PcpvS<)005dW2QB~r diff --git a/test/unsupported/spec-05-01-utf16le.empty b/test/unsupported/spec-05-01-utf16le.empty deleted file mode 100644 index bfffa8b6..00000000 --- a/test/unsupported/spec-05-01-utf16le.empty +++ /dev/null @@ -1,2 +0,0 @@ -# This stream contains no -# documents, only comments. diff --git a/test/unsupported/spec-05-02-utf16be.data b/test/unsupported/spec-05-02-utf16be.data deleted file mode 100644 index 5ebbb04e6552a9f86935d32920530fb5a1c0bd3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 90 zcmZQjW>8@8WXNMEV@PDkVaQ}i0rE>3iWyRYbUs5GkaS}3XYgg<`uCp!q&5?%wiv7q bq#}`l3oM!fRGSRcmkZRF$56tc$G`;u#5E6= diff --git a/test/unsupported/spec-05-02-utf16be.error b/test/unsupported/spec-05-02-utf16be.error deleted file mode 100644 index 1df36161..00000000 --- a/test/unsupported/spec-05-02-utf16be.error +++ /dev/null @@ -1,3 +0,0 @@ -ERROR: - A BOM must not appear - inside a document. diff --git a/test/unsupported/spec-05-02-utf16le.data b/test/unsupported/spec-05-02-utf16le.data deleted file mode 100644 index 0cd90a2bd15bbc378bc6e99d60621ac9d55cf7a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 90 zcmW-YF%Ezr00VFK6(;OHg3W>O1|pb{C=8&_SBp!VUap3jmBLNnAQQDO8cAK*l@^a< Z;(d%(mfL=B7(sl{D0kEE)UVK4#6Qu_50(G` diff --git a/test/unsupported/spec-05-02-utf16le.error b/test/unsupported/spec-05-02-utf16le.error deleted file mode 100644 index 1df36161..00000000 --- a/test/unsupported/spec-05-02-utf16le.error +++ /dev/null @@ -1,3 +0,0 @@ -ERROR: - A BOM must not appear - inside a document. diff --git a/test/unsupported/str.detect b/test/unsupported/str.detect deleted file mode 100644 index 7d5026f4..00000000 --- a/test/unsupported/str.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:str diff --git a/test/unsupported/timestamp.detect b/test/unsupported/timestamp.detect deleted file mode 100644 index 2013936a..00000000 --- a/test/unsupported/timestamp.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:timestamp diff --git a/test/unsupported/undefined-constructor.loader-error b/test/unsupported/undefined-constructor.loader-error deleted file mode 100644 index 9a37ccc9..00000000 --- a/test/unsupported/undefined-constructor.loader-error +++ /dev/null @@ -1 +0,0 @@ ---- !foo bar diff --git a/test/unsupported/utf16be.code b/test/unsupported/utf16be.code deleted file mode 100644 index c45b3719..00000000 --- a/test/unsupported/utf16be.code +++ /dev/null @@ -1 +0,0 @@ -"UTF-16-BE" diff --git a/test/unsupported/utf16be.data b/test/unsupported/utf16be.data deleted file mode 100644 index 50dcfaef829a24326c0bf0f94472a6bb54b2e16d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30 fcmezOpFtN46&OMpLKxhDY(oY!AnC;5%D@ExWH|)p diff --git a/test/unsupported/utf16le.code b/test/unsupported/utf16le.code deleted file mode 100644 index 400530a0..00000000 --- a/test/unsupported/utf16le.code +++ /dev/null @@ -1 +0,0 @@ -"UTF-16-LE" diff --git a/test/unsupported/utf16le.data b/test/unsupported/utf16le.data deleted file mode 100644 index 76f5e7345b75f6d1924902bcd46bbea271eb45db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30 gcmezWPnQ7%6&OMpLKxhDEJFq}AnC*4%D}|{0B2qV@Bjb+ diff --git a/test/unsupported/value.data b/test/unsupported/value.data deleted file mode 100644 index c5b7680c..00000000 --- a/test/unsupported/value.data +++ /dev/null @@ -1 +0,0 @@ -- = diff --git a/test/unsupported/value.detect b/test/unsupported/value.detect deleted file mode 100644 index 7c37d028..00000000 --- a/test/unsupported/value.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:value diff --git a/test/unsupported/yaml.data b/test/unsupported/yaml.data deleted file mode 100644 index a4bb3f8e..00000000 --- a/test/unsupported/yaml.data +++ /dev/null @@ -1,3 +0,0 @@ -- !!yaml '!' -- !!yaml '&' -- !!yaml '*' diff --git a/test/unsupported/yaml.detect b/test/unsupported/yaml.detect deleted file mode 100644 index e2cf1891..00000000 --- a/test/unsupported/yaml.detect +++ /dev/null @@ -1 +0,0 @@ -tag:yaml.org,2002:yaml From 8edbe2ceeeb24ca79c532ad1e3601cf2d386551b Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Thu, 28 May 2026 17:20:57 +0300 Subject: [PATCH 03/23] tests: reorganize to groups --- package.json | 5 +++-- test/{00-units.js => core/00-units.test.js} | 0 test/{10-loader.js => core/10-loader.test.js} | 2 +- .../11-load-errors.test.js} | 2 +- test/{20-dumper.js => core/20-dumper.test.js} | 2 +- .../25-dumper-fuzzy.test.js} | 2 +- test/{30-issues.js => core/30-issues.test.js} | 0 test/{ => core}/issues/0008.js | 2 +- test/{ => core}/issues/0017.js | 2 +- test/{ => core}/issues/0019.js | 2 +- test/{ => core}/issues/0026.js | 2 +- test/{ => core}/issues/0027.js | 2 +- test/{ => core}/issues/0033.js | 2 +- test/{ => core}/issues/0046.js | 2 +- test/{ => core}/issues/0054.js | 2 +- test/{ => core}/issues/0063.js | 2 +- test/{ => core}/issues/0064.js | 2 +- test/{ => core}/issues/0064.yml | 0 test/{ => core}/issues/0068.js | 2 +- test/{ => core}/issues/0080.js | 2 +- test/{ => core}/issues/0085.js | 2 +- test/{ => core}/issues/0092.js | 2 +- test/{ => core}/issues/0093.js | 2 +- test/{ => core}/issues/0095.js | 2 +- test/{ => core}/issues/0108.js | 2 +- test/{ => core}/issues/0110.js | 2 +- test/{ => core}/issues/0112.js | 2 +- test/{ => core}/issues/0117.js | 2 +- test/{ => core}/issues/0144.js | 2 +- test/{ => core}/issues/0154.js | 2 +- test/{ => core}/issues/0155.js | 2 +- test/{ => core}/issues/0156.js | 2 +- test/{ => core}/issues/0160.js | 2 +- test/{ => core}/issues/0164.js | 2 +- test/{ => core}/issues/0194.js | 2 +- test/{ => core}/issues/0203.js | 2 +- test/{ => core}/issues/0205.js | 2 +- test/{ => core}/issues/0220.js | 2 +- test/{ => core}/issues/0221.js | 2 +- test/{ => core}/issues/0235.js | 2 +- test/{ => core}/issues/0243-basic.yml | 0 test/{ => core}/issues/0243-nested.yml | 0 test/{ => core}/issues/0243.js | 2 +- test/{ => core}/issues/0248-listener.js | 2 +- test/{ => core}/issues/0258.js | 2 +- test/{ => core}/issues/0266.js | 2 +- test/{ => core}/issues/0301.js | 2 +- test/{ => core}/issues/0303.js | 2 +- test/{ => core}/issues/0321.js | 2 +- test/{ => core}/issues/0332.js | 2 +- test/{ => core}/issues/0333.js | 2 +- test/{ => core}/issues/0335.js | 2 +- test/{ => core}/issues/0342.js | 2 +- test/{ => core}/issues/0346.js | 2 +- test/{ => core}/issues/0350.js | 2 +- test/{ => core}/issues/0351.js | 2 +- test/{ => core}/issues/0385.js | 2 +- test/{ => core}/issues/0399.js | 2 +- test/{ => core}/issues/0403.js | 2 +- test/{ => core}/issues/0418.js | 2 +- test/{ => core}/issues/0432.js | 2 +- test/{ => core}/issues/0468.js | 2 +- test/{ => core}/issues/0470.js | 2 +- test/{ => core}/issues/0475-case1.yml | 0 test/{ => core}/issues/0475-case2.yml | 0 test/{ => core}/issues/0475.js | 2 +- test/{ => core}/issues/0519.js | 2 +- test/{ => core}/issues/0521.js | 2 +- test/{ => core}/issues/0525-1.js | 2 +- test/{ => core}/issues/0525-2.js | 2 +- test/{ => core}/issues/0529.js | 2 +- test/{ => core}/issues/0570.js | 2 +- test/{ => core}/issues/0571.js | 2 +- test/{ => core}/issues/0576.js | 2 +- test/{ => core}/issues/0586.js | 2 +- test/{ => core}/issues/0587.js | 2 +- test/{ => core}/issues/0614.js | 2 +- test/{ => core}/samples-common/construct-binary.js | 0 test/{ => core}/samples-common/construct-binary.yml | 0 test/{ => core}/samples-common/construct-bool.js | 0 test/{ => core}/samples-common/construct-bool.yml | 0 test/{ => core}/samples-common/construct-custom.js | 0 test/{ => core}/samples-common/construct-custom.yml | 0 test/{ => core}/samples-common/construct-float.js | 0 test/{ => core}/samples-common/construct-float.yml | 0 test/{ => core}/samples-common/construct-int.js | 0 test/{ => core}/samples-common/construct-int.yml | 0 test/{ => core}/samples-common/construct-map.js | 0 test/{ => core}/samples-common/construct-map.yml | 0 test/{ => core}/samples-common/construct-merge.js | 0 test/{ => core}/samples-common/construct-merge.yml | 0 test/{ => core}/samples-common/construct-null.js | 0 test/{ => core}/samples-common/construct-null.yml | 0 test/{ => core}/samples-common/construct-omap.js | 0 test/{ => core}/samples-common/construct-omap.yml | 0 test/{ => core}/samples-common/construct-pairs.js | 0 test/{ => core}/samples-common/construct-pairs.yml | 0 test/{ => core}/samples-common/construct-seq.js | 0 test/{ => core}/samples-common/construct-seq.yml | 0 test/{ => core}/samples-common/construct-set.js | 0 test/{ => core}/samples-common/construct-set.yml | 0 .../samples-common/construct-str-ascii.js | 0 .../samples-common/construct-str-ascii.yml | 0 .../{ => core}/samples-common/construct-str-utf8.js | 0 .../samples-common/construct-str-utf8.yml | 0 test/{ => core}/samples-common/construct-str.js | 0 test/{ => core}/samples-common/construct-str.yml | 0 .../samples-common/construct-string-types.js | 0 .../samples-common/construct-string-types.yml | 0 .../samples-common/construct-timestamp.js | 0 .../samples-common/construct-timestamp.yml | 0 test/{ => core}/samples-common/construct-value.js | 0 test/{ => core}/samples-common/construct-value.yml | 0 .../samples-common/dump-empty-collections.js | 0 .../samples-common/dump-empty-collections.yml | 0 .../samples-common/duplicate-mapping-key.js | 0 .../samples-common/duplicate-mapping-key.yml | 0 .../samples-common/duplicate-merge-key.js | 0 .../samples-common/duplicate-merge-key.yml | 0 .../emitting-unacceptable-unicode-character-bug.js | 0 .../emitting-unacceptable-unicode-character-bug.yml | 0 .../samples-common/invalid-single-quote-bug.js | 0 .../samples-common/invalid-single-quote-bug.yml | 0 test/{ => core}/samples-common/more-floats.js | 0 test/{ => core}/samples-common/more-floats.yml | 0 .../{ => core}/samples-common/negative-float-bug.js | 0 .../samples-common/negative-float-bug.yml | 0 .../samples-common/single-dot-is-not-float-bug.js | 0 .../samples-common/single-dot-is-not-float-bug.yml | 0 test/{ => core}/samples-common/timestamp-bugs.js | 0 test/{ => core}/samples-common/timestamp-bugs.yml | 0 test/{ => core}/samples-common/utf8-implicit.js | 0 test/{ => core}/samples-common/utf8-implicit.yml | 0 .../samples-load-errors/a-nasty-libyaml-bug.yml | 0 .../document-separator-in-quoted-scalar.yml | 0 .../{ => core}/samples-load-errors/duplicate-key.js | 0 .../samples-load-errors/duplicate-key.yml | 0 .../samples-load-errors/duplicate-tag-directive.yml | 0 .../samples-load-errors/duplicate-value-key.js | 0 .../samples-load-errors/duplicate-value-key.yml | 0 .../duplicate-yaml-directive.yml | 0 .../samples-load-errors/expected-mapping.yml | 0 .../samples-load-errors/expected-scalar.yml | 0 .../samples-load-errors/expected-sequence.yml | 0 .../samples-load-errors/fetch-complex-value-bug.yml | 0 .../samples-load-errors/forbidden-entry.yml | 0 .../samples-load-errors/forbidden-key.yml | 0 .../samples-load-errors/forbidden-value.yml | 0 .../samples-load-errors/invalid-anchor-2.yml | 0 .../samples-load-errors/invalid-base64-data-2.yml | 0 .../samples-load-errors/invalid-base64-data.yml | 0 .../invalid-block-scalar-indicator.yml | 0 .../samples-load-errors/invalid-character.yml | Bin .../samples-load-errors/invalid-directive-line.yml | 0 .../invalid-directive-name-1.yml | 0 .../invalid-directive-name-2.yml | 0 .../invalid-escape-character.yml | 0 .../samples-load-errors/invalid-escape-numbers.yml | 0 .../invalid-indentation-indicator-1.yml | 0 .../invalid-indentation-indicator-2.yml | 0 .../invalid-item-without-trailing-break.yml | 0 .../samples-load-errors/invalid-merge-1.yml | 0 .../samples-load-errors/invalid-merge-2.yml | 0 .../samples-load-errors/invalid-omap-1.yml | 0 .../samples-load-errors/invalid-omap-2.yml | 0 .../samples-load-errors/invalid-omap-3.yml | 0 .../samples-load-errors/invalid-pairs-1.yml | 0 .../samples-load-errors/invalid-pairs-2.yml | 0 .../samples-load-errors/invalid-pairs-3.yml | 0 .../samples-load-errors/invalid-simple-key.yml | 0 .../invalid-starting-character.yml | 0 .../samples-load-errors/invalid-tag-2.yml | 0 .../invalid-tag-directive-handle.yml | 0 .../samples-load-errors/invalid-tag-handle-1.yml | 0 .../samples-load-errors/invalid-tag-handle-2.yml | 0 .../samples-load-errors/invalid-uri-escapes-1.yml | 0 test/{ => core}/samples-load-errors/invalid-uri.yml | 0 .../invalid-yaml-directive-version-1.yml | 0 .../invalid-yaml-directive-version-2.yml | 0 .../invalid-yaml-directive-version-3.yml | 0 .../invalid-yaml-directive-version-4.yml | 0 .../invalid-yaml-directive-version-5.yml | 0 .../invalid-yaml-directive-version-6.yml | 0 .../samples-load-errors/invalid-yaml-version.yml | 0 .../samples-load-errors/no-block-collection-end.yml | 0 .../samples-load-errors/no-block-mapping-end-2.yml | 0 .../samples-load-errors/no-block-mapping-end.yml | 0 .../samples-load-errors/no-document-start.yml | 0 .../samples-load-errors/no-flow-mapping-end.yml | 0 .../samples-load-errors/no-flow-sequence-end.yml | 0 test/{ => core}/samples-load-errors/no-node-1.yml | 0 test/{ => core}/samples-load-errors/no-node-2.yml | 0 .../remove-possible-simple-key-bug.yml | 0 .../samples-load-errors/unclosed-bracket.yml | 0 .../samples-load-errors/unclosed-quoted-scalar.yml | 0 .../samples-load-errors/undefined-anchor.yml | 0 .../samples-load-errors/undefined-tag-handle.yml | 0 test/{ => core}/support/schema.js | 2 +- test/{ => core}/units/alias-nodes.js | 2 +- test/{ => core}/units/bom-strip.js | 2 +- test/{ => core}/units/character-set.js | 2 +- test/{ => core}/units/dump-scalar-styles.js | 2 +- test/{ => core}/units/empty-node-resolving.js | 2 +- test/{ => core}/units/is-negative-zero.js | 2 +- test/{ => core}/units/loader-parameters.js | 2 +- test/{ => core}/units/replacer.js | 2 +- test/{ => core}/units/single-document-error.js | 2 +- test/{ => core}/units/skip-invalid.js | 2 +- test/{ => core}/units/snippet.js | 2 +- test/{ => core}/units/snippet.txt | 0 test/{ => core}/units/sort-keys.js | 2 +- test/{ => core}/units/tagmultikind.js | 2 +- 212 files changed, 86 insertions(+), 85 deletions(-) rename test/{00-units.js => core/00-units.test.js} (100%) rename test/{10-loader.js => core/10-loader.test.js} (96%) rename test/{11-load-errors.js => core/11-load-errors.test.js} (96%) rename test/{20-dumper.js => core/20-dumper.test.js} (96%) rename test/{25-dumper-fuzzy.js => core/25-dumper-fuzzy.test.js} (98%) rename test/{30-issues.js => core/30-issues.test.js} (100%) rename test/{ => core}/issues/0008.js (86%) rename test/{ => core}/issues/0017.js (86%) rename test/{ => core}/issues/0019.js (90%) rename test/{ => core}/issues/0026.js (87%) rename test/{ => core}/issues/0027.js (98%) rename test/{ => core}/issues/0033.js (90%) rename test/{ => core}/issues/0046.js (96%) rename test/{ => core}/issues/0054.js (99%) rename test/{ => core}/issues/0063.js (96%) rename test/{ => core}/issues/0064.js (91%) rename test/{ => core}/issues/0064.yml (100%) rename test/{ => core}/issues/0068.js (91%) rename test/{ => core}/issues/0080.js (97%) rename test/{ => core}/issues/0085.js (94%) rename test/{ => core}/issues/0092.js (88%) rename test/{ => core}/issues/0093.js (93%) rename test/{ => core}/issues/0095.js (96%) rename test/{ => core}/issues/0108.js (91%) rename test/{ => core}/issues/0110.js (95%) rename test/{ => core}/issues/0112.js (94%) rename test/{ => core}/issues/0117.js (82%) rename test/{ => core}/issues/0144.js (86%) rename test/{ => core}/issues/0154.js (93%) rename test/{ => core}/issues/0155.js (84%) rename test/{ => core}/issues/0156.js (93%) rename test/{ => core}/issues/0160.js (84%) rename test/{ => core}/issues/0164.js (95%) rename test/{ => core}/issues/0194.js (92%) rename test/{ => core}/issues/0203.js (87%) rename test/{ => core}/issues/0205.js (95%) rename test/{ => core}/issues/0220.js (91%) rename test/{ => core}/issues/0221.js (89%) rename test/{ => core}/issues/0235.js (92%) rename test/{ => core}/issues/0243-basic.yml (100%) rename test/{ => core}/issues/0243-nested.yml (100%) rename test/{ => core}/issues/0243.js (97%) rename test/{ => core}/issues/0248-listener.js (98%) rename test/{ => core}/issues/0258.js (94%) rename test/{ => core}/issues/0266.js (94%) rename test/{ => core}/issues/0301.js (93%) rename test/{ => core}/issues/0303.js (90%) rename test/{ => core}/issues/0321.js (93%) rename test/{ => core}/issues/0332.js (96%) rename test/{ => core}/issues/0333.js (90%) rename test/{ => core}/issues/0335.js (92%) rename test/{ => core}/issues/0342.js (98%) rename test/{ => core}/issues/0346.js (96%) rename test/{ => core}/issues/0350.js (87%) rename test/{ => core}/issues/0351.js (92%) rename test/{ => core}/issues/0385.js (98%) rename test/{ => core}/issues/0399.js (94%) rename test/{ => core}/issues/0403.js (93%) rename test/{ => core}/issues/0418.js (90%) rename test/{ => core}/issues/0432.js (95%) rename test/{ => core}/issues/0468.js (94%) rename test/{ => core}/issues/0470.js (94%) rename test/{ => core}/issues/0475-case1.yml (100%) rename test/{ => core}/issues/0475-case2.yml (100%) rename test/{ => core}/issues/0475.js (96%) rename test/{ => core}/issues/0519.js (90%) rename test/{ => core}/issues/0521.js (97%) rename test/{ => core}/issues/0525-1.js (91%) rename test/{ => core}/issues/0525-2.js (91%) rename test/{ => core}/issues/0529.js (99%) rename test/{ => core}/issues/0570.js (93%) rename test/{ => core}/issues/0571.js (98%) rename test/{ => core}/issues/0576.js (97%) rename test/{ => core}/issues/0586.js (97%) rename test/{ => core}/issues/0587.js (83%) rename test/{ => core}/issues/0614.js (96%) rename test/{ => core}/samples-common/construct-binary.js (100%) rename test/{ => core}/samples-common/construct-binary.yml (100%) rename test/{ => core}/samples-common/construct-bool.js (100%) rename test/{ => core}/samples-common/construct-bool.yml (100%) rename test/{ => core}/samples-common/construct-custom.js (100%) rename test/{ => core}/samples-common/construct-custom.yml (100%) rename test/{ => core}/samples-common/construct-float.js (100%) rename test/{ => core}/samples-common/construct-float.yml (100%) rename test/{ => core}/samples-common/construct-int.js (100%) rename test/{ => core}/samples-common/construct-int.yml (100%) rename test/{ => core}/samples-common/construct-map.js (100%) rename test/{ => core}/samples-common/construct-map.yml (100%) rename test/{ => core}/samples-common/construct-merge.js (100%) rename test/{ => core}/samples-common/construct-merge.yml (100%) rename test/{ => core}/samples-common/construct-null.js (100%) rename test/{ => core}/samples-common/construct-null.yml (100%) rename test/{ => core}/samples-common/construct-omap.js (100%) rename test/{ => core}/samples-common/construct-omap.yml (100%) rename test/{ => core}/samples-common/construct-pairs.js (100%) rename test/{ => core}/samples-common/construct-pairs.yml (100%) rename test/{ => core}/samples-common/construct-seq.js (100%) rename test/{ => core}/samples-common/construct-seq.yml (100%) rename test/{ => core}/samples-common/construct-set.js (100%) rename test/{ => core}/samples-common/construct-set.yml (100%) rename test/{ => core}/samples-common/construct-str-ascii.js (100%) rename test/{ => core}/samples-common/construct-str-ascii.yml (100%) rename test/{ => core}/samples-common/construct-str-utf8.js (100%) rename test/{ => core}/samples-common/construct-str-utf8.yml (100%) rename test/{ => core}/samples-common/construct-str.js (100%) rename test/{ => core}/samples-common/construct-str.yml (100%) rename test/{ => core}/samples-common/construct-string-types.js (100%) rename test/{ => core}/samples-common/construct-string-types.yml (100%) rename test/{ => core}/samples-common/construct-timestamp.js (100%) rename test/{ => core}/samples-common/construct-timestamp.yml (100%) rename test/{ => core}/samples-common/construct-value.js (100%) rename test/{ => core}/samples-common/construct-value.yml (100%) rename test/{ => core}/samples-common/dump-empty-collections.js (100%) rename test/{ => core}/samples-common/dump-empty-collections.yml (100%) rename test/{ => core}/samples-common/duplicate-mapping-key.js (100%) rename test/{ => core}/samples-common/duplicate-mapping-key.yml (100%) rename test/{ => core}/samples-common/duplicate-merge-key.js (100%) rename test/{ => core}/samples-common/duplicate-merge-key.yml (100%) rename test/{ => core}/samples-common/emitting-unacceptable-unicode-character-bug.js (100%) rename test/{ => core}/samples-common/emitting-unacceptable-unicode-character-bug.yml (100%) rename test/{ => core}/samples-common/invalid-single-quote-bug.js (100%) rename test/{ => core}/samples-common/invalid-single-quote-bug.yml (100%) rename test/{ => core}/samples-common/more-floats.js (100%) rename test/{ => core}/samples-common/more-floats.yml (100%) rename test/{ => core}/samples-common/negative-float-bug.js (100%) rename test/{ => core}/samples-common/negative-float-bug.yml (100%) rename test/{ => core}/samples-common/single-dot-is-not-float-bug.js (100%) rename test/{ => core}/samples-common/single-dot-is-not-float-bug.yml (100%) rename test/{ => core}/samples-common/timestamp-bugs.js (100%) rename test/{ => core}/samples-common/timestamp-bugs.yml (100%) rename test/{ => core}/samples-common/utf8-implicit.js (100%) rename test/{ => core}/samples-common/utf8-implicit.yml (100%) rename test/{ => core}/samples-load-errors/a-nasty-libyaml-bug.yml (100%) rename test/{ => core}/samples-load-errors/document-separator-in-quoted-scalar.yml (100%) rename test/{ => core}/samples-load-errors/duplicate-key.js (100%) rename test/{ => core}/samples-load-errors/duplicate-key.yml (100%) rename test/{ => core}/samples-load-errors/duplicate-tag-directive.yml (100%) rename test/{ => core}/samples-load-errors/duplicate-value-key.js (100%) rename test/{ => core}/samples-load-errors/duplicate-value-key.yml (100%) rename test/{ => core}/samples-load-errors/duplicate-yaml-directive.yml (100%) rename test/{ => core}/samples-load-errors/expected-mapping.yml (100%) rename test/{ => core}/samples-load-errors/expected-scalar.yml (100%) rename test/{ => core}/samples-load-errors/expected-sequence.yml (100%) rename test/{ => core}/samples-load-errors/fetch-complex-value-bug.yml (100%) rename test/{ => core}/samples-load-errors/forbidden-entry.yml (100%) rename test/{ => core}/samples-load-errors/forbidden-key.yml (100%) rename test/{ => core}/samples-load-errors/forbidden-value.yml (100%) rename test/{ => core}/samples-load-errors/invalid-anchor-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-base64-data-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-base64-data.yml (100%) rename test/{ => core}/samples-load-errors/invalid-block-scalar-indicator.yml (100%) rename test/{ => core}/samples-load-errors/invalid-character.yml (100%) rename test/{ => core}/samples-load-errors/invalid-directive-line.yml (100%) rename test/{ => core}/samples-load-errors/invalid-directive-name-1.yml (100%) rename test/{ => core}/samples-load-errors/invalid-directive-name-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-escape-character.yml (100%) rename test/{ => core}/samples-load-errors/invalid-escape-numbers.yml (100%) rename test/{ => core}/samples-load-errors/invalid-indentation-indicator-1.yml (100%) rename test/{ => core}/samples-load-errors/invalid-indentation-indicator-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-item-without-trailing-break.yml (100%) rename test/{ => core}/samples-load-errors/invalid-merge-1.yml (100%) rename test/{ => core}/samples-load-errors/invalid-merge-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-omap-1.yml (100%) rename test/{ => core}/samples-load-errors/invalid-omap-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-omap-3.yml (100%) rename test/{ => core}/samples-load-errors/invalid-pairs-1.yml (100%) rename test/{ => core}/samples-load-errors/invalid-pairs-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-pairs-3.yml (100%) rename test/{ => core}/samples-load-errors/invalid-simple-key.yml (100%) rename test/{ => core}/samples-load-errors/invalid-starting-character.yml (100%) rename test/{ => core}/samples-load-errors/invalid-tag-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-tag-directive-handle.yml (100%) rename test/{ => core}/samples-load-errors/invalid-tag-handle-1.yml (100%) rename test/{ => core}/samples-load-errors/invalid-tag-handle-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-uri-escapes-1.yml (100%) rename test/{ => core}/samples-load-errors/invalid-uri.yml (100%) rename test/{ => core}/samples-load-errors/invalid-yaml-directive-version-1.yml (100%) rename test/{ => core}/samples-load-errors/invalid-yaml-directive-version-2.yml (100%) rename test/{ => core}/samples-load-errors/invalid-yaml-directive-version-3.yml (100%) rename test/{ => core}/samples-load-errors/invalid-yaml-directive-version-4.yml (100%) rename test/{ => core}/samples-load-errors/invalid-yaml-directive-version-5.yml (100%) rename test/{ => core}/samples-load-errors/invalid-yaml-directive-version-6.yml (100%) rename test/{ => core}/samples-load-errors/invalid-yaml-version.yml (100%) rename test/{ => core}/samples-load-errors/no-block-collection-end.yml (100%) rename test/{ => core}/samples-load-errors/no-block-mapping-end-2.yml (100%) rename test/{ => core}/samples-load-errors/no-block-mapping-end.yml (100%) rename test/{ => core}/samples-load-errors/no-document-start.yml (100%) rename test/{ => core}/samples-load-errors/no-flow-mapping-end.yml (100%) rename test/{ => core}/samples-load-errors/no-flow-sequence-end.yml (100%) rename test/{ => core}/samples-load-errors/no-node-1.yml (100%) rename test/{ => core}/samples-load-errors/no-node-2.yml (100%) rename test/{ => core}/samples-load-errors/remove-possible-simple-key-bug.yml (100%) rename test/{ => core}/samples-load-errors/unclosed-bracket.yml (100%) rename test/{ => core}/samples-load-errors/unclosed-quoted-scalar.yml (100%) rename test/{ => core}/samples-load-errors/undefined-anchor.yml (100%) rename test/{ => core}/samples-load-errors/undefined-tag-handle.yml (100%) rename test/{ => core}/support/schema.js (98%) rename test/{ => core}/units/alias-nodes.js (98%) rename test/{ => core}/units/bom-strip.js (87%) rename test/{ => core}/units/character-set.js (96%) rename test/{ => core}/units/dump-scalar-styles.js (99%) rename test/{ => core}/units/empty-node-resolving.js (97%) rename test/{ => core}/units/is-negative-zero.js (75%) rename test/{ => core}/units/loader-parameters.js (97%) rename test/{ => core}/units/replacer.js (99%) rename test/{ => core}/units/single-document-error.js (93%) rename test/{ => core}/units/skip-invalid.js (95%) rename test/{ => core}/units/snippet.js (95%) rename test/{ => core}/units/snippet.txt (100%) rename test/{ => core}/units/sort-keys.js (95%) rename test/{ => core}/units/tagmultikind.js (95%) diff --git a/package.json b/package.json index 7cfb4898..e6d2c4bd 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,9 @@ }, "scripts": { "lint": "eslint .", - "test": "npm run lint && mocha", - "coverage": "npm run lint && c8 -r html mocha", + "test": "npm run lint && npm run test:core", + "test:core": "mocha test/core/*.test.*", + "coverage": "npm run lint && c8 -r html mocha test/core/*.test.*", "demo": "npm run lint && node support/build_demo.js", "gh-demo": "npm run demo && gh-pages -d demo -f", "browserify": "rollup -c support/rollup.config.js", diff --git a/test/00-units.js b/test/core/00-units.test.js similarity index 100% rename from test/00-units.js rename to test/core/00-units.test.js diff --git a/test/10-loader.js b/test/core/10-loader.test.js similarity index 96% rename from test/10-loader.js rename to test/core/10-loader.test.js index 5482d0fb..36b30aae 100644 --- a/test/10-loader.js +++ b/test/core/10-loader.test.js @@ -4,7 +4,7 @@ var assert = require('assert'); var path = require('path'); var fs = require('fs'); -var yaml = require('../'); +var yaml = require('js-yaml'); var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA; diff --git a/test/11-load-errors.js b/test/core/11-load-errors.test.js similarity index 96% rename from test/11-load-errors.js rename to test/core/11-load-errors.test.js index e983473d..729a32cd 100644 --- a/test/11-load-errors.js +++ b/test/core/11-load-errors.test.js @@ -4,7 +4,7 @@ var assert = require('assert'); var path = require('path'); var fs = require('fs'); -var yaml = require('../'); +var yaml = require('js-yaml'); var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA; diff --git a/test/20-dumper.js b/test/core/20-dumper.test.js similarity index 96% rename from test/20-dumper.js rename to test/core/20-dumper.test.js index bca822d3..67ff31ee 100644 --- a/test/20-dumper.js +++ b/test/core/20-dumper.test.js @@ -4,7 +4,7 @@ var assert = require('assert'); var path = require('path'); var fs = require('fs'); -var yaml = require('../'); +var yaml = require('js-yaml'); var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA; diff --git a/test/25-dumper-fuzzy.js b/test/core/25-dumper-fuzzy.test.js similarity index 98% rename from test/25-dumper-fuzzy.js rename to test/core/25-dumper-fuzzy.test.js index 8bbf5e77..db8cba5a 100644 --- a/test/25-dumper-fuzzy.js +++ b/test/core/25-dumper-fuzzy.test.js @@ -2,7 +2,7 @@ var assert = require('assert'); var fc = require('fast-check'); -var yaml = require('../'); +var yaml = require('js-yaml'); // Generate valid YAML instances for yaml.safeDump var key = fc.string16bits(); diff --git a/test/30-issues.js b/test/core/30-issues.test.js similarity index 100% rename from test/30-issues.js rename to test/core/30-issues.test.js diff --git a/test/issues/0008.js b/test/core/issues/0008.js similarity index 86% rename from test/issues/0008.js rename to test/core/issues/0008.js index c96010aa..75e50e13 100644 --- a/test/issues/0008.js +++ b/test/core/issues/0008.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Parse failed when no document start present', function () { diff --git a/test/issues/0017.js b/test/core/issues/0017.js similarity index 86% rename from test/issues/0017.js rename to test/core/issues/0017.js index ed24601d..0d33ab2b 100644 --- a/test/issues/0017.js +++ b/test/core/issues/0017.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Non-specific "!" tags should resolve to !!str', function () { diff --git a/test/issues/0019.js b/test/core/issues/0019.js similarity index 90% rename from test/issues/0019.js rename to test/core/issues/0019.js index 1314a228..881d6d11 100644 --- a/test/issues/0019.js +++ b/test/core/issues/0019.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Timestamp parsing is one month off', function () { diff --git a/test/issues/0026.js b/test/core/issues/0026.js similarity index 87% rename from test/issues/0026.js rename to test/core/issues/0026.js index 3efbb847..f94b02c9 100644 --- a/test/issues/0026.js +++ b/test/core/issues/0026.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('should convert new line into white space', function () { diff --git a/test/issues/0027.js b/test/core/issues/0027.js similarity index 98% rename from test/issues/0027.js rename to test/core/issues/0027.js index acef8267..f68b07e1 100644 --- a/test/issues/0027.js +++ b/test/core/issues/0027.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); describe('Should load numbers in YAML 1.2 format', function () { diff --git a/test/issues/0033.js b/test/core/issues/0033.js similarity index 90% rename from test/issues/0033.js rename to test/core/issues/0033.js index bec7da74..6f3fc78e 100644 --- a/test/issues/0033.js +++ b/test/core/issues/0033.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('refactor compact variant of MarkedYAMLError.toString', function () { diff --git a/test/issues/0046.js b/test/core/issues/0046.js similarity index 96% rename from test/issues/0046.js rename to test/core/issues/0046.js index fe72ce13..4ef03242 100644 --- a/test/issues/0046.js +++ b/test/core/issues/0046.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Timestamps are incorrectly parsed in local time', function () { diff --git a/test/issues/0054.js b/test/core/issues/0054.js similarity index 99% rename from test/issues/0054.js rename to test/core/issues/0054.js index ac7c09af..87d97701 100644 --- a/test/issues/0054.js +++ b/test/core/issues/0054.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it("Incorrect utf-8 handling on require('file.yaml')", function () { diff --git a/test/issues/0063.js b/test/core/issues/0063.js similarity index 96% rename from test/issues/0063.js rename to test/core/issues/0063.js index 829e83bd..1cfd411c 100644 --- a/test/issues/0063.js +++ b/test/core/issues/0063.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Invalid errors/warnings of invalid indentation on flow scalars', function () { diff --git a/test/issues/0064.js b/test/core/issues/0064.js similarity index 91% rename from test/issues/0064.js rename to test/core/issues/0064.js index 42bec2e9..e056c3ee 100644 --- a/test/issues/0064.js +++ b/test/core/issues/0064.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var readFileSync = require('fs').readFileSync; diff --git a/test/issues/0064.yml b/test/core/issues/0064.yml similarity index 100% rename from test/issues/0064.yml rename to test/core/issues/0064.yml diff --git a/test/issues/0068.js b/test/core/issues/0068.js similarity index 91% rename from test/issues/0068.js rename to test/core/issues/0068.js index 32b7343f..520b0d8f 100644 --- a/test/issues/0068.js +++ b/test/core/issues/0068.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Prevent adding unnecessary space character to end of a line within block collections', function () { diff --git a/test/issues/0080.js b/test/core/issues/0080.js similarity index 97% rename from test/issues/0080.js rename to test/core/issues/0080.js index a0bf3361..a2c9d710 100644 --- a/test/issues/0080.js +++ b/test/core/issues/0080.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('should throw when tabs are used as indentation', function () { diff --git a/test/issues/0085.js b/test/core/issues/0085.js similarity index 94% rename from test/issues/0085.js rename to test/core/issues/0085.js index 0172b04c..f3627de5 100644 --- a/test/issues/0085.js +++ b/test/core/issues/0085.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var DEPRECATED_BOOLEANS_SYNTAX = [ diff --git a/test/issues/0092.js b/test/core/issues/0092.js similarity index 88% rename from test/issues/0092.js rename to test/core/issues/0092.js index 4de901f3..f93053c5 100644 --- a/test/issues/0092.js +++ b/test/core/issues/0092.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Invalid parse error on whitespace between quoted scalar keys and ":" symbol in mappings', function () { diff --git a/test/issues/0093.js b/test/core/issues/0093.js similarity index 93% rename from test/issues/0093.js rename to test/core/issues/0093.js index 05740842..267e06b4 100644 --- a/test/issues/0093.js +++ b/test/core/issues/0093.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Unwanted line breaks in folded scalars', function () { diff --git a/test/issues/0095.js b/test/core/issues/0095.js similarity index 96% rename from test/issues/0095.js rename to test/core/issues/0095.js index 35a48b74..cfbc4b8a 100644 --- a/test/issues/0095.js +++ b/test/core/issues/0095.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Empty block scalars loaded wrong', function () { diff --git a/test/issues/0108.js b/test/core/issues/0108.js similarity index 91% rename from test/issues/0108.js rename to test/core/issues/0108.js index 56e85260..cba67b57 100644 --- a/test/issues/0108.js +++ b/test/core/issues/0108.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Literal scalars have an unwanted leading line break', function () { diff --git a/test/issues/0110.js b/test/core/issues/0110.js similarity index 95% rename from test/issues/0110.js rename to test/core/issues/0110.js index 9710b4a9..87185366 100644 --- a/test/issues/0110.js +++ b/test/core/issues/0110.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Circular and cross references', function () { diff --git a/test/issues/0112.js b/test/core/issues/0112.js similarity index 94% rename from test/issues/0112.js rename to test/core/issues/0112.js index 1195e533..2b3e7b54 100644 --- a/test/issues/0112.js +++ b/test/core/issues/0112.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Plain scalar "constructor" parsed as `null`', function () { diff --git a/test/issues/0117.js b/test/core/issues/0117.js similarity index 82% rename from test/issues/0117.js rename to test/core/issues/0117.js index d3196ee8..43365bd9 100644 --- a/test/issues/0117.js +++ b/test/core/issues/0117.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Negative zero loses the sign after dump', function () { diff --git a/test/issues/0144.js b/test/core/issues/0144.js similarity index 86% rename from test/issues/0144.js rename to test/core/issues/0144.js index 4abfb6a9..2dbccd1d 100644 --- a/test/issues/0144.js +++ b/test/core/issues/0144.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Infinite loop when attempting to parse multi-line scalar document that is not indented', function () { diff --git a/test/issues/0154.js b/test/core/issues/0154.js similarity index 93% rename from test/issues/0154.js rename to test/core/issues/0154.js index 05115e9f..be288e31 100644 --- a/test/issues/0154.js +++ b/test/core/issues/0154.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Indentation warning on empty lines within quoted scalars and flow collections', function () { diff --git a/test/issues/0155.js b/test/core/issues/0155.js similarity index 84% rename from test/issues/0155.js rename to test/core/issues/0155.js index d6125d1d..9a7fa19b 100644 --- a/test/issues/0155.js +++ b/test/core/issues/0155.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Named null', function () { diff --git a/test/issues/0156.js b/test/core/issues/0156.js similarity index 93% rename from test/issues/0156.js rename to test/core/issues/0156.js index 0cf33dfa..8b81563f 100644 --- a/test/issues/0156.js +++ b/test/core/issues/0156.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); function SuccessSignal() {} diff --git a/test/issues/0160.js b/test/core/issues/0160.js similarity index 84% rename from test/issues/0160.js rename to test/core/issues/0160.js index 6e83c33c..2e279765 100644 --- a/test/issues/0160.js +++ b/test/core/issues/0160.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Correct encoding of UTF-16 surrogate pairs', function () { diff --git a/test/issues/0164.js b/test/core/issues/0164.js similarity index 95% rename from test/issues/0164.js rename to test/core/issues/0164.js index 8240318d..c5d18313 100644 --- a/test/issues/0164.js +++ b/test/core/issues/0164.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('should define __proto__ as a value (not invoke setter)', function () { diff --git a/test/issues/0194.js b/test/core/issues/0194.js similarity index 92% rename from test/issues/0194.js rename to test/core/issues/0194.js index 7c433b24..c7783bf9 100644 --- a/test/issues/0194.js +++ b/test/core/issues/0194.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Don\'t throw on warning', function () { diff --git a/test/issues/0203.js b/test/core/issues/0203.js similarity index 87% rename from test/issues/0203.js rename to test/core/issues/0203.js index e3a54c34..bb267607 100644 --- a/test/issues/0203.js +++ b/test/core/issues/0203.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Don\'t throw on warning', function () { diff --git a/test/issues/0205.js b/test/core/issues/0205.js similarity index 95% rename from test/issues/0205.js rename to test/core/issues/0205.js index 67f12e42..01cbeaeb 100644 --- a/test/issues/0205.js +++ b/test/core/issues/0205.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Duplicated objects within array', function () { diff --git a/test/issues/0220.js b/test/core/issues/0220.js similarity index 91% rename from test/issues/0220.js rename to test/core/issues/0220.js index edeec370..a72a78f6 100644 --- a/test/issues/0220.js +++ b/test/core/issues/0220.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Float type dumper should not miss dot', function () { diff --git a/test/issues/0221.js b/test/core/issues/0221.js similarity index 89% rename from test/issues/0221.js rename to test/core/issues/0221.js index 5cc81a12..17ef7513 100644 --- a/test/issues/0221.js +++ b/test/core/issues/0221.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it.skip('Block scalar chomping does not work on zero indent', function () { diff --git a/test/issues/0235.js b/test/core/issues/0235.js similarity index 92% rename from test/issues/0235.js rename to test/core/issues/0235.js index 6fc94de9..82ee5fbc 100644 --- a/test/issues/0235.js +++ b/test/core/issues/0235.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Flow style does not dump with block literals.', function () { assert.strictEqual(yaml.dump({ a: '\n' }, { flowLevel: 0 }), '{a: "\\n"}\n'); diff --git a/test/issues/0243-basic.yml b/test/core/issues/0243-basic.yml similarity index 100% rename from test/issues/0243-basic.yml rename to test/core/issues/0243-basic.yml diff --git a/test/issues/0243-nested.yml b/test/core/issues/0243-nested.yml similarity index 100% rename from test/issues/0243-nested.yml rename to test/core/issues/0243-nested.yml diff --git a/test/issues/0243.js b/test/core/issues/0243.js similarity index 97% rename from test/issues/0243.js rename to test/core/issues/0243.js index 5795a225..0989a012 100644 --- a/test/issues/0243.js +++ b/test/core/issues/0243.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var readFileSync = require('fs').readFileSync; diff --git a/test/issues/0248-listener.js b/test/core/issues/0248-listener.js similarity index 98% rename from test/issues/0248-listener.js rename to test/core/issues/0248-listener.js index 88756043..40646f3c 100644 --- a/test/issues/0248-listener.js +++ b/test/core/issues/0248-listener.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Listener informed on a very simple scalar.', function () { var history = []; diff --git a/test/issues/0258.js b/test/core/issues/0258.js similarity index 94% rename from test/issues/0258.js rename to test/core/issues/0258.js index ef89d880..2a1576ac 100644 --- a/test/issues/0258.js +++ b/test/core/issues/0258.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('should shorthand tags with !! whenever possible', function () { diff --git a/test/issues/0266.js b/test/core/issues/0266.js similarity index 94% rename from test/issues/0266.js rename to test/core/issues/0266.js index df565003..dcad8868 100644 --- a/test/issues/0266.js +++ b/test/core/issues/0266.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var DEPRECATED_BOOLEANS_SYNTAX = [ diff --git a/test/issues/0301.js b/test/core/issues/0301.js similarity index 93% rename from test/issues/0301.js rename to test/core/issues/0301.js index 25226d52..03998c45 100644 --- a/test/issues/0301.js +++ b/test/core/issues/0301.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('should assign anchor to an empty node', function () { diff --git a/test/issues/0303.js b/test/core/issues/0303.js similarity index 90% rename from test/issues/0303.js rename to test/core/issues/0303.js index ab78e433..dd45a1f4 100644 --- a/test/issues/0303.js +++ b/test/core/issues/0303.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Loader should not strip quotes before newlines', function () { var with_space = yaml.load("'''foo'' '"); diff --git a/test/issues/0321.js b/test/core/issues/0321.js similarity index 93% rename from test/issues/0321.js rename to test/core/issues/0321.js index 4f00e106..9ef40ce1 100644 --- a/test/issues/0321.js +++ b/test/core/issues/0321.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('Should throw exception on extra comma in flow mappings', function () { diff --git a/test/issues/0332.js b/test/core/issues/0332.js similarity index 96% rename from test/issues/0332.js rename to test/core/issues/0332.js index 14c32573..c33776cc 100644 --- a/test/issues/0332.js +++ b/test/core/issues/0332.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('Should format errors', function () { diff --git a/test/issues/0333.js b/test/core/issues/0333.js similarity index 90% rename from test/issues/0333.js rename to test/core/issues/0333.js index 1371dcfb..bc8fc761 100644 --- a/test/issues/0333.js +++ b/test/core/issues/0333.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('should allow cast integers as !!float', function () { diff --git a/test/issues/0335.js b/test/core/issues/0335.js similarity index 92% rename from test/issues/0335.js rename to test/core/issues/0335.js index b7fbd49f..a3431269 100644 --- a/test/issues/0335.js +++ b/test/core/issues/0335.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Don\'t throw on warning', function () { diff --git a/test/issues/0342.js b/test/core/issues/0342.js similarity index 98% rename from test/issues/0342.js rename to test/core/issues/0342.js index 0d00dce7..efa1295e 100644 --- a/test/issues/0342.js +++ b/test/core/issues/0342.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var simpleArray = [ 'a', 'b' ]; var arrayOfSimpleObj = [ { a: 1 }, { b: 2 } ]; var arrayOfObj = [ { a: 1, b: 'abc' }, { c: 'def', d: 2 } ]; diff --git a/test/issues/0346.js b/test/core/issues/0346.js similarity index 96% rename from test/issues/0346.js rename to test/core/issues/0346.js index 359b3fea..a40ef646 100644 --- a/test/issues/0346.js +++ b/test/core/issues/0346.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('should not emit spaces in arrays in flow mode between entries using condenseFlow: true', function () { diff --git a/test/issues/0350.js b/test/core/issues/0350.js similarity index 87% rename from test/issues/0350.js rename to test/core/issues/0350.js index 5860fcac..62ef389e 100644 --- a/test/issues/0350.js +++ b/test/core/issues/0350.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('should return parse docs from loadAll', function () { diff --git a/test/issues/0351.js b/test/core/issues/0351.js similarity index 92% rename from test/issues/0351.js rename to test/core/issues/0351.js index 4c5383f6..8790a417 100644 --- a/test/issues/0351.js +++ b/test/core/issues/0351.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../..'); +var yaml = require('js-yaml'); it('should include the error message in the error stack', function () { diff --git a/test/issues/0385.js b/test/core/issues/0385.js similarity index 98% rename from test/issues/0385.js rename to test/core/issues/0385.js index b7d39bf8..60945d25 100644 --- a/test/issues/0385.js +++ b/test/core/issues/0385.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); describe('Multi tag', function () { diff --git a/test/issues/0399.js b/test/core/issues/0399.js similarity index 94% rename from test/issues/0399.js rename to test/core/issues/0399.js index cd5d96f5..9298eee3 100644 --- a/test/issues/0399.js +++ b/test/core/issues/0399.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('should properly dump negative ints in different styles', function () { diff --git a/test/issues/0403.js b/test/core/issues/0403.js similarity index 93% rename from test/issues/0403.js rename to test/core/issues/0403.js index e63dad5a..0a816040 100644 --- a/test/issues/0403.js +++ b/test/core/issues/0403.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('should properly dump leading newlines and spaces', function () { diff --git a/test/issues/0418.js b/test/core/issues/0418.js similarity index 90% rename from test/issues/0418.js rename to test/core/issues/0418.js index 94754dcf..8aa8b8a3 100644 --- a/test/issues/0418.js +++ b/test/core/issues/0418.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('should error on invalid indentation in mappings', function () { diff --git a/test/issues/0432.js b/test/core/issues/0432.js similarity index 95% rename from test/issues/0432.js rename to test/core/issues/0432.js index 940c6b96..7c8381ee 100644 --- a/test/issues/0432.js +++ b/test/core/issues/0432.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('should indent arrays an extra level by default', function () { diff --git a/test/issues/0468.js b/test/core/issues/0468.js similarity index 94% rename from test/issues/0468.js rename to test/core/issues/0468.js index 1f033b7a..1ee04299 100644 --- a/test/issues/0468.js +++ b/test/core/issues/0468.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../..'); +var yaml = require('js-yaml'); it('should not indent arrays an extra level when disabled', function () { /* eslint-disable max-len */ diff --git a/test/issues/0470.js b/test/core/issues/0470.js similarity index 94% rename from test/issues/0470.js rename to test/core/issues/0470.js index 80045c8c..395d66d9 100644 --- a/test/issues/0470.js +++ b/test/core/issues/0470.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Don\'t quote strings with : without need', function () { diff --git a/test/issues/0475-case1.yml b/test/core/issues/0475-case1.yml similarity index 100% rename from test/issues/0475-case1.yml rename to test/core/issues/0475-case1.yml diff --git a/test/issues/0475-case2.yml b/test/core/issues/0475-case2.yml similarity index 100% rename from test/issues/0475-case2.yml rename to test/core/issues/0475-case2.yml diff --git a/test/issues/0475.js b/test/core/issues/0475.js similarity index 96% rename from test/issues/0475.js rename to test/core/issues/0475.js index ed144d04..dc8aa271 100644 --- a/test/issues/0475.js +++ b/test/core/issues/0475.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var readFileSync = require('fs').readFileSync; diff --git a/test/issues/0519.js b/test/core/issues/0519.js similarity index 90% rename from test/issues/0519.js rename to test/core/issues/0519.js index 38664018..d86858a8 100644 --- a/test/issues/0519.js +++ b/test/core/issues/0519.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Dumper should add quotes around equals sign', function () { // pyyaml fails with unquoted `=` diff --git a/test/issues/0521.js b/test/core/issues/0521.js similarity index 97% rename from test/issues/0521.js rename to test/core/issues/0521.js index 88647a20..d67022ff 100644 --- a/test/issues/0521.js +++ b/test/core/issues/0521.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Don\'t quote strings with # without need', function () { diff --git a/test/issues/0525-1.js b/test/core/issues/0525-1.js similarity index 91% rename from test/issues/0525-1.js rename to test/core/issues/0525-1.js index 05c1bca4..7fab76cc 100644 --- a/test/issues/0525-1.js +++ b/test/core/issues/0525-1.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Should throw if there is a null-byte in input', function () { diff --git a/test/issues/0525-2.js b/test/core/issues/0525-2.js similarity index 91% rename from test/issues/0525-2.js rename to test/core/issues/0525-2.js index 92885c4b..017b2ed9 100644 --- a/test/issues/0525-2.js +++ b/test/core/issues/0525-2.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Should check kind type when resolving ! tag', function () { diff --git a/test/issues/0529.js b/test/core/issues/0529.js similarity index 99% rename from test/issues/0529.js rename to test/core/issues/0529.js index 52e171cc..60a41a58 100644 --- a/test/issues/0529.js +++ b/test/core/issues/0529.js @@ -3,7 +3,7 @@ /* eslint-disable max-len */ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); const sample = { // normal key-value pair diff --git a/test/issues/0570.js b/test/core/issues/0570.js similarity index 93% rename from test/issues/0570.js rename to test/core/issues/0570.js index 86c45125..ef7ccad8 100644 --- a/test/issues/0570.js +++ b/test/core/issues/0570.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('should dump null in different styles', function () { diff --git a/test/issues/0571.js b/test/core/issues/0571.js similarity index 98% rename from test/issues/0571.js rename to test/core/issues/0571.js index 928d7eea..ec58c17e 100644 --- a/test/issues/0571.js +++ b/test/core/issues/0571.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); describe('Undefined', function () { diff --git a/test/issues/0576.js b/test/core/issues/0576.js similarity index 97% rename from test/issues/0576.js rename to test/core/issues/0576.js index b56ecd8a..767a958f 100644 --- a/test/issues/0576.js +++ b/test/core/issues/0576.js @@ -2,7 +2,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); describe('Custom tags', function () { diff --git a/test/issues/0586.js b/test/core/issues/0586.js similarity index 97% rename from test/issues/0586.js rename to test/core/issues/0586.js index 5160f53b..781857c5 100644 --- a/test/issues/0586.js +++ b/test/core/issues/0586.js @@ -4,7 +4,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('Should allow custom formatting through implicit custom tags', function () { diff --git a/test/issues/0587.js b/test/core/issues/0587.js similarity index 83% rename from test/issues/0587.js rename to test/core/issues/0587.js index 921e852a..09cbc081 100644 --- a/test/issues/0587.js +++ b/test/core/issues/0587.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Should not encode astral characters', function () { diff --git a/test/issues/0614.js b/test/core/issues/0614.js similarity index 96% rename from test/issues/0614.js rename to test/core/issues/0614.js index 18d9e119..698a7b5f 100644 --- a/test/issues/0614.js +++ b/test/core/issues/0614.js @@ -4,7 +4,7 @@ const assert = require('assert'); -const yaml = require('../../'); +const yaml = require('js-yaml'); it('Should allow int override', function () { diff --git a/test/samples-common/construct-binary.js b/test/core/samples-common/construct-binary.js similarity index 100% rename from test/samples-common/construct-binary.js rename to test/core/samples-common/construct-binary.js diff --git a/test/samples-common/construct-binary.yml b/test/core/samples-common/construct-binary.yml similarity index 100% rename from test/samples-common/construct-binary.yml rename to test/core/samples-common/construct-binary.yml diff --git a/test/samples-common/construct-bool.js b/test/core/samples-common/construct-bool.js similarity index 100% rename from test/samples-common/construct-bool.js rename to test/core/samples-common/construct-bool.js diff --git a/test/samples-common/construct-bool.yml b/test/core/samples-common/construct-bool.yml similarity index 100% rename from test/samples-common/construct-bool.yml rename to test/core/samples-common/construct-bool.yml diff --git a/test/samples-common/construct-custom.js b/test/core/samples-common/construct-custom.js similarity index 100% rename from test/samples-common/construct-custom.js rename to test/core/samples-common/construct-custom.js diff --git a/test/samples-common/construct-custom.yml b/test/core/samples-common/construct-custom.yml similarity index 100% rename from test/samples-common/construct-custom.yml rename to test/core/samples-common/construct-custom.yml diff --git a/test/samples-common/construct-float.js b/test/core/samples-common/construct-float.js similarity index 100% rename from test/samples-common/construct-float.js rename to test/core/samples-common/construct-float.js diff --git a/test/samples-common/construct-float.yml b/test/core/samples-common/construct-float.yml similarity index 100% rename from test/samples-common/construct-float.yml rename to test/core/samples-common/construct-float.yml diff --git a/test/samples-common/construct-int.js b/test/core/samples-common/construct-int.js similarity index 100% rename from test/samples-common/construct-int.js rename to test/core/samples-common/construct-int.js diff --git a/test/samples-common/construct-int.yml b/test/core/samples-common/construct-int.yml similarity index 100% rename from test/samples-common/construct-int.yml rename to test/core/samples-common/construct-int.yml diff --git a/test/samples-common/construct-map.js b/test/core/samples-common/construct-map.js similarity index 100% rename from test/samples-common/construct-map.js rename to test/core/samples-common/construct-map.js diff --git a/test/samples-common/construct-map.yml b/test/core/samples-common/construct-map.yml similarity index 100% rename from test/samples-common/construct-map.yml rename to test/core/samples-common/construct-map.yml diff --git a/test/samples-common/construct-merge.js b/test/core/samples-common/construct-merge.js similarity index 100% rename from test/samples-common/construct-merge.js rename to test/core/samples-common/construct-merge.js diff --git a/test/samples-common/construct-merge.yml b/test/core/samples-common/construct-merge.yml similarity index 100% rename from test/samples-common/construct-merge.yml rename to test/core/samples-common/construct-merge.yml diff --git a/test/samples-common/construct-null.js b/test/core/samples-common/construct-null.js similarity index 100% rename from test/samples-common/construct-null.js rename to test/core/samples-common/construct-null.js diff --git a/test/samples-common/construct-null.yml b/test/core/samples-common/construct-null.yml similarity index 100% rename from test/samples-common/construct-null.yml rename to test/core/samples-common/construct-null.yml diff --git a/test/samples-common/construct-omap.js b/test/core/samples-common/construct-omap.js similarity index 100% rename from test/samples-common/construct-omap.js rename to test/core/samples-common/construct-omap.js diff --git a/test/samples-common/construct-omap.yml b/test/core/samples-common/construct-omap.yml similarity index 100% rename from test/samples-common/construct-omap.yml rename to test/core/samples-common/construct-omap.yml diff --git a/test/samples-common/construct-pairs.js b/test/core/samples-common/construct-pairs.js similarity index 100% rename from test/samples-common/construct-pairs.js rename to test/core/samples-common/construct-pairs.js diff --git a/test/samples-common/construct-pairs.yml b/test/core/samples-common/construct-pairs.yml similarity index 100% rename from test/samples-common/construct-pairs.yml rename to test/core/samples-common/construct-pairs.yml diff --git a/test/samples-common/construct-seq.js b/test/core/samples-common/construct-seq.js similarity index 100% rename from test/samples-common/construct-seq.js rename to test/core/samples-common/construct-seq.js diff --git a/test/samples-common/construct-seq.yml b/test/core/samples-common/construct-seq.yml similarity index 100% rename from test/samples-common/construct-seq.yml rename to test/core/samples-common/construct-seq.yml diff --git a/test/samples-common/construct-set.js b/test/core/samples-common/construct-set.js similarity index 100% rename from test/samples-common/construct-set.js rename to test/core/samples-common/construct-set.js diff --git a/test/samples-common/construct-set.yml b/test/core/samples-common/construct-set.yml similarity index 100% rename from test/samples-common/construct-set.yml rename to test/core/samples-common/construct-set.yml diff --git a/test/samples-common/construct-str-ascii.js b/test/core/samples-common/construct-str-ascii.js similarity index 100% rename from test/samples-common/construct-str-ascii.js rename to test/core/samples-common/construct-str-ascii.js diff --git a/test/samples-common/construct-str-ascii.yml b/test/core/samples-common/construct-str-ascii.yml similarity index 100% rename from test/samples-common/construct-str-ascii.yml rename to test/core/samples-common/construct-str-ascii.yml diff --git a/test/samples-common/construct-str-utf8.js b/test/core/samples-common/construct-str-utf8.js similarity index 100% rename from test/samples-common/construct-str-utf8.js rename to test/core/samples-common/construct-str-utf8.js diff --git a/test/samples-common/construct-str-utf8.yml b/test/core/samples-common/construct-str-utf8.yml similarity index 100% rename from test/samples-common/construct-str-utf8.yml rename to test/core/samples-common/construct-str-utf8.yml diff --git a/test/samples-common/construct-str.js b/test/core/samples-common/construct-str.js similarity index 100% rename from test/samples-common/construct-str.js rename to test/core/samples-common/construct-str.js diff --git a/test/samples-common/construct-str.yml b/test/core/samples-common/construct-str.yml similarity index 100% rename from test/samples-common/construct-str.yml rename to test/core/samples-common/construct-str.yml diff --git a/test/samples-common/construct-string-types.js b/test/core/samples-common/construct-string-types.js similarity index 100% rename from test/samples-common/construct-string-types.js rename to test/core/samples-common/construct-string-types.js diff --git a/test/samples-common/construct-string-types.yml b/test/core/samples-common/construct-string-types.yml similarity index 100% rename from test/samples-common/construct-string-types.yml rename to test/core/samples-common/construct-string-types.yml diff --git a/test/samples-common/construct-timestamp.js b/test/core/samples-common/construct-timestamp.js similarity index 100% rename from test/samples-common/construct-timestamp.js rename to test/core/samples-common/construct-timestamp.js diff --git a/test/samples-common/construct-timestamp.yml b/test/core/samples-common/construct-timestamp.yml similarity index 100% rename from test/samples-common/construct-timestamp.yml rename to test/core/samples-common/construct-timestamp.yml diff --git a/test/samples-common/construct-value.js b/test/core/samples-common/construct-value.js similarity index 100% rename from test/samples-common/construct-value.js rename to test/core/samples-common/construct-value.js diff --git a/test/samples-common/construct-value.yml b/test/core/samples-common/construct-value.yml similarity index 100% rename from test/samples-common/construct-value.yml rename to test/core/samples-common/construct-value.yml diff --git a/test/samples-common/dump-empty-collections.js b/test/core/samples-common/dump-empty-collections.js similarity index 100% rename from test/samples-common/dump-empty-collections.js rename to test/core/samples-common/dump-empty-collections.js diff --git a/test/samples-common/dump-empty-collections.yml b/test/core/samples-common/dump-empty-collections.yml similarity index 100% rename from test/samples-common/dump-empty-collections.yml rename to test/core/samples-common/dump-empty-collections.yml diff --git a/test/samples-common/duplicate-mapping-key.js b/test/core/samples-common/duplicate-mapping-key.js similarity index 100% rename from test/samples-common/duplicate-mapping-key.js rename to test/core/samples-common/duplicate-mapping-key.js diff --git a/test/samples-common/duplicate-mapping-key.yml b/test/core/samples-common/duplicate-mapping-key.yml similarity index 100% rename from test/samples-common/duplicate-mapping-key.yml rename to test/core/samples-common/duplicate-mapping-key.yml diff --git a/test/samples-common/duplicate-merge-key.js b/test/core/samples-common/duplicate-merge-key.js similarity index 100% rename from test/samples-common/duplicate-merge-key.js rename to test/core/samples-common/duplicate-merge-key.js diff --git a/test/samples-common/duplicate-merge-key.yml b/test/core/samples-common/duplicate-merge-key.yml similarity index 100% rename from test/samples-common/duplicate-merge-key.yml rename to test/core/samples-common/duplicate-merge-key.yml diff --git a/test/samples-common/emitting-unacceptable-unicode-character-bug.js b/test/core/samples-common/emitting-unacceptable-unicode-character-bug.js similarity index 100% rename from test/samples-common/emitting-unacceptable-unicode-character-bug.js rename to test/core/samples-common/emitting-unacceptable-unicode-character-bug.js diff --git a/test/samples-common/emitting-unacceptable-unicode-character-bug.yml b/test/core/samples-common/emitting-unacceptable-unicode-character-bug.yml similarity index 100% rename from test/samples-common/emitting-unacceptable-unicode-character-bug.yml rename to test/core/samples-common/emitting-unacceptable-unicode-character-bug.yml diff --git a/test/samples-common/invalid-single-quote-bug.js b/test/core/samples-common/invalid-single-quote-bug.js similarity index 100% rename from test/samples-common/invalid-single-quote-bug.js rename to test/core/samples-common/invalid-single-quote-bug.js diff --git a/test/samples-common/invalid-single-quote-bug.yml b/test/core/samples-common/invalid-single-quote-bug.yml similarity index 100% rename from test/samples-common/invalid-single-quote-bug.yml rename to test/core/samples-common/invalid-single-quote-bug.yml diff --git a/test/samples-common/more-floats.js b/test/core/samples-common/more-floats.js similarity index 100% rename from test/samples-common/more-floats.js rename to test/core/samples-common/more-floats.js diff --git a/test/samples-common/more-floats.yml b/test/core/samples-common/more-floats.yml similarity index 100% rename from test/samples-common/more-floats.yml rename to test/core/samples-common/more-floats.yml diff --git a/test/samples-common/negative-float-bug.js b/test/core/samples-common/negative-float-bug.js similarity index 100% rename from test/samples-common/negative-float-bug.js rename to test/core/samples-common/negative-float-bug.js diff --git a/test/samples-common/negative-float-bug.yml b/test/core/samples-common/negative-float-bug.yml similarity index 100% rename from test/samples-common/negative-float-bug.yml rename to test/core/samples-common/negative-float-bug.yml diff --git a/test/samples-common/single-dot-is-not-float-bug.js b/test/core/samples-common/single-dot-is-not-float-bug.js similarity index 100% rename from test/samples-common/single-dot-is-not-float-bug.js rename to test/core/samples-common/single-dot-is-not-float-bug.js diff --git a/test/samples-common/single-dot-is-not-float-bug.yml b/test/core/samples-common/single-dot-is-not-float-bug.yml similarity index 100% rename from test/samples-common/single-dot-is-not-float-bug.yml rename to test/core/samples-common/single-dot-is-not-float-bug.yml diff --git a/test/samples-common/timestamp-bugs.js b/test/core/samples-common/timestamp-bugs.js similarity index 100% rename from test/samples-common/timestamp-bugs.js rename to test/core/samples-common/timestamp-bugs.js diff --git a/test/samples-common/timestamp-bugs.yml b/test/core/samples-common/timestamp-bugs.yml similarity index 100% rename from test/samples-common/timestamp-bugs.yml rename to test/core/samples-common/timestamp-bugs.yml diff --git a/test/samples-common/utf8-implicit.js b/test/core/samples-common/utf8-implicit.js similarity index 100% rename from test/samples-common/utf8-implicit.js rename to test/core/samples-common/utf8-implicit.js diff --git a/test/samples-common/utf8-implicit.yml b/test/core/samples-common/utf8-implicit.yml similarity index 100% rename from test/samples-common/utf8-implicit.yml rename to test/core/samples-common/utf8-implicit.yml diff --git a/test/samples-load-errors/a-nasty-libyaml-bug.yml b/test/core/samples-load-errors/a-nasty-libyaml-bug.yml similarity index 100% rename from test/samples-load-errors/a-nasty-libyaml-bug.yml rename to test/core/samples-load-errors/a-nasty-libyaml-bug.yml diff --git a/test/samples-load-errors/document-separator-in-quoted-scalar.yml b/test/core/samples-load-errors/document-separator-in-quoted-scalar.yml similarity index 100% rename from test/samples-load-errors/document-separator-in-quoted-scalar.yml rename to test/core/samples-load-errors/document-separator-in-quoted-scalar.yml diff --git a/test/samples-load-errors/duplicate-key.js b/test/core/samples-load-errors/duplicate-key.js similarity index 100% rename from test/samples-load-errors/duplicate-key.js rename to test/core/samples-load-errors/duplicate-key.js diff --git a/test/samples-load-errors/duplicate-key.yml b/test/core/samples-load-errors/duplicate-key.yml similarity index 100% rename from test/samples-load-errors/duplicate-key.yml rename to test/core/samples-load-errors/duplicate-key.yml diff --git a/test/samples-load-errors/duplicate-tag-directive.yml b/test/core/samples-load-errors/duplicate-tag-directive.yml similarity index 100% rename from test/samples-load-errors/duplicate-tag-directive.yml rename to test/core/samples-load-errors/duplicate-tag-directive.yml diff --git a/test/samples-load-errors/duplicate-value-key.js b/test/core/samples-load-errors/duplicate-value-key.js similarity index 100% rename from test/samples-load-errors/duplicate-value-key.js rename to test/core/samples-load-errors/duplicate-value-key.js diff --git a/test/samples-load-errors/duplicate-value-key.yml b/test/core/samples-load-errors/duplicate-value-key.yml similarity index 100% rename from test/samples-load-errors/duplicate-value-key.yml rename to test/core/samples-load-errors/duplicate-value-key.yml diff --git a/test/samples-load-errors/duplicate-yaml-directive.yml b/test/core/samples-load-errors/duplicate-yaml-directive.yml similarity index 100% rename from test/samples-load-errors/duplicate-yaml-directive.yml rename to test/core/samples-load-errors/duplicate-yaml-directive.yml diff --git a/test/samples-load-errors/expected-mapping.yml b/test/core/samples-load-errors/expected-mapping.yml similarity index 100% rename from test/samples-load-errors/expected-mapping.yml rename to test/core/samples-load-errors/expected-mapping.yml diff --git a/test/samples-load-errors/expected-scalar.yml b/test/core/samples-load-errors/expected-scalar.yml similarity index 100% rename from test/samples-load-errors/expected-scalar.yml rename to test/core/samples-load-errors/expected-scalar.yml diff --git a/test/samples-load-errors/expected-sequence.yml b/test/core/samples-load-errors/expected-sequence.yml similarity index 100% rename from test/samples-load-errors/expected-sequence.yml rename to test/core/samples-load-errors/expected-sequence.yml diff --git a/test/samples-load-errors/fetch-complex-value-bug.yml b/test/core/samples-load-errors/fetch-complex-value-bug.yml similarity index 100% rename from test/samples-load-errors/fetch-complex-value-bug.yml rename to test/core/samples-load-errors/fetch-complex-value-bug.yml diff --git a/test/samples-load-errors/forbidden-entry.yml b/test/core/samples-load-errors/forbidden-entry.yml similarity index 100% rename from test/samples-load-errors/forbidden-entry.yml rename to test/core/samples-load-errors/forbidden-entry.yml diff --git a/test/samples-load-errors/forbidden-key.yml b/test/core/samples-load-errors/forbidden-key.yml similarity index 100% rename from test/samples-load-errors/forbidden-key.yml rename to test/core/samples-load-errors/forbidden-key.yml diff --git a/test/samples-load-errors/forbidden-value.yml b/test/core/samples-load-errors/forbidden-value.yml similarity index 100% rename from test/samples-load-errors/forbidden-value.yml rename to test/core/samples-load-errors/forbidden-value.yml diff --git a/test/samples-load-errors/invalid-anchor-2.yml b/test/core/samples-load-errors/invalid-anchor-2.yml similarity index 100% rename from test/samples-load-errors/invalid-anchor-2.yml rename to test/core/samples-load-errors/invalid-anchor-2.yml diff --git a/test/samples-load-errors/invalid-base64-data-2.yml b/test/core/samples-load-errors/invalid-base64-data-2.yml similarity index 100% rename from test/samples-load-errors/invalid-base64-data-2.yml rename to test/core/samples-load-errors/invalid-base64-data-2.yml diff --git a/test/samples-load-errors/invalid-base64-data.yml b/test/core/samples-load-errors/invalid-base64-data.yml similarity index 100% rename from test/samples-load-errors/invalid-base64-data.yml rename to test/core/samples-load-errors/invalid-base64-data.yml diff --git a/test/samples-load-errors/invalid-block-scalar-indicator.yml b/test/core/samples-load-errors/invalid-block-scalar-indicator.yml similarity index 100% rename from test/samples-load-errors/invalid-block-scalar-indicator.yml rename to test/core/samples-load-errors/invalid-block-scalar-indicator.yml diff --git a/test/samples-load-errors/invalid-character.yml b/test/core/samples-load-errors/invalid-character.yml similarity index 100% rename from test/samples-load-errors/invalid-character.yml rename to test/core/samples-load-errors/invalid-character.yml diff --git a/test/samples-load-errors/invalid-directive-line.yml b/test/core/samples-load-errors/invalid-directive-line.yml similarity index 100% rename from test/samples-load-errors/invalid-directive-line.yml rename to test/core/samples-load-errors/invalid-directive-line.yml diff --git a/test/samples-load-errors/invalid-directive-name-1.yml b/test/core/samples-load-errors/invalid-directive-name-1.yml similarity index 100% rename from test/samples-load-errors/invalid-directive-name-1.yml rename to test/core/samples-load-errors/invalid-directive-name-1.yml diff --git a/test/samples-load-errors/invalid-directive-name-2.yml b/test/core/samples-load-errors/invalid-directive-name-2.yml similarity index 100% rename from test/samples-load-errors/invalid-directive-name-2.yml rename to test/core/samples-load-errors/invalid-directive-name-2.yml diff --git a/test/samples-load-errors/invalid-escape-character.yml b/test/core/samples-load-errors/invalid-escape-character.yml similarity index 100% rename from test/samples-load-errors/invalid-escape-character.yml rename to test/core/samples-load-errors/invalid-escape-character.yml diff --git a/test/samples-load-errors/invalid-escape-numbers.yml b/test/core/samples-load-errors/invalid-escape-numbers.yml similarity index 100% rename from test/samples-load-errors/invalid-escape-numbers.yml rename to test/core/samples-load-errors/invalid-escape-numbers.yml diff --git a/test/samples-load-errors/invalid-indentation-indicator-1.yml b/test/core/samples-load-errors/invalid-indentation-indicator-1.yml similarity index 100% rename from test/samples-load-errors/invalid-indentation-indicator-1.yml rename to test/core/samples-load-errors/invalid-indentation-indicator-1.yml diff --git a/test/samples-load-errors/invalid-indentation-indicator-2.yml b/test/core/samples-load-errors/invalid-indentation-indicator-2.yml similarity index 100% rename from test/samples-load-errors/invalid-indentation-indicator-2.yml rename to test/core/samples-load-errors/invalid-indentation-indicator-2.yml diff --git a/test/samples-load-errors/invalid-item-without-trailing-break.yml b/test/core/samples-load-errors/invalid-item-without-trailing-break.yml similarity index 100% rename from test/samples-load-errors/invalid-item-without-trailing-break.yml rename to test/core/samples-load-errors/invalid-item-without-trailing-break.yml diff --git a/test/samples-load-errors/invalid-merge-1.yml b/test/core/samples-load-errors/invalid-merge-1.yml similarity index 100% rename from test/samples-load-errors/invalid-merge-1.yml rename to test/core/samples-load-errors/invalid-merge-1.yml diff --git a/test/samples-load-errors/invalid-merge-2.yml b/test/core/samples-load-errors/invalid-merge-2.yml similarity index 100% rename from test/samples-load-errors/invalid-merge-2.yml rename to test/core/samples-load-errors/invalid-merge-2.yml diff --git a/test/samples-load-errors/invalid-omap-1.yml b/test/core/samples-load-errors/invalid-omap-1.yml similarity index 100% rename from test/samples-load-errors/invalid-omap-1.yml rename to test/core/samples-load-errors/invalid-omap-1.yml diff --git a/test/samples-load-errors/invalid-omap-2.yml b/test/core/samples-load-errors/invalid-omap-2.yml similarity index 100% rename from test/samples-load-errors/invalid-omap-2.yml rename to test/core/samples-load-errors/invalid-omap-2.yml diff --git a/test/samples-load-errors/invalid-omap-3.yml b/test/core/samples-load-errors/invalid-omap-3.yml similarity index 100% rename from test/samples-load-errors/invalid-omap-3.yml rename to test/core/samples-load-errors/invalid-omap-3.yml diff --git a/test/samples-load-errors/invalid-pairs-1.yml b/test/core/samples-load-errors/invalid-pairs-1.yml similarity index 100% rename from test/samples-load-errors/invalid-pairs-1.yml rename to test/core/samples-load-errors/invalid-pairs-1.yml diff --git a/test/samples-load-errors/invalid-pairs-2.yml b/test/core/samples-load-errors/invalid-pairs-2.yml similarity index 100% rename from test/samples-load-errors/invalid-pairs-2.yml rename to test/core/samples-load-errors/invalid-pairs-2.yml diff --git a/test/samples-load-errors/invalid-pairs-3.yml b/test/core/samples-load-errors/invalid-pairs-3.yml similarity index 100% rename from test/samples-load-errors/invalid-pairs-3.yml rename to test/core/samples-load-errors/invalid-pairs-3.yml diff --git a/test/samples-load-errors/invalid-simple-key.yml b/test/core/samples-load-errors/invalid-simple-key.yml similarity index 100% rename from test/samples-load-errors/invalid-simple-key.yml rename to test/core/samples-load-errors/invalid-simple-key.yml diff --git a/test/samples-load-errors/invalid-starting-character.yml b/test/core/samples-load-errors/invalid-starting-character.yml similarity index 100% rename from test/samples-load-errors/invalid-starting-character.yml rename to test/core/samples-load-errors/invalid-starting-character.yml diff --git a/test/samples-load-errors/invalid-tag-2.yml b/test/core/samples-load-errors/invalid-tag-2.yml similarity index 100% rename from test/samples-load-errors/invalid-tag-2.yml rename to test/core/samples-load-errors/invalid-tag-2.yml diff --git a/test/samples-load-errors/invalid-tag-directive-handle.yml b/test/core/samples-load-errors/invalid-tag-directive-handle.yml similarity index 100% rename from test/samples-load-errors/invalid-tag-directive-handle.yml rename to test/core/samples-load-errors/invalid-tag-directive-handle.yml diff --git a/test/samples-load-errors/invalid-tag-handle-1.yml b/test/core/samples-load-errors/invalid-tag-handle-1.yml similarity index 100% rename from test/samples-load-errors/invalid-tag-handle-1.yml rename to test/core/samples-load-errors/invalid-tag-handle-1.yml diff --git a/test/samples-load-errors/invalid-tag-handle-2.yml b/test/core/samples-load-errors/invalid-tag-handle-2.yml similarity index 100% rename from test/samples-load-errors/invalid-tag-handle-2.yml rename to test/core/samples-load-errors/invalid-tag-handle-2.yml diff --git a/test/samples-load-errors/invalid-uri-escapes-1.yml b/test/core/samples-load-errors/invalid-uri-escapes-1.yml similarity index 100% rename from test/samples-load-errors/invalid-uri-escapes-1.yml rename to test/core/samples-load-errors/invalid-uri-escapes-1.yml diff --git a/test/samples-load-errors/invalid-uri.yml b/test/core/samples-load-errors/invalid-uri.yml similarity index 100% rename from test/samples-load-errors/invalid-uri.yml rename to test/core/samples-load-errors/invalid-uri.yml diff --git a/test/samples-load-errors/invalid-yaml-directive-version-1.yml b/test/core/samples-load-errors/invalid-yaml-directive-version-1.yml similarity index 100% rename from test/samples-load-errors/invalid-yaml-directive-version-1.yml rename to test/core/samples-load-errors/invalid-yaml-directive-version-1.yml diff --git a/test/samples-load-errors/invalid-yaml-directive-version-2.yml b/test/core/samples-load-errors/invalid-yaml-directive-version-2.yml similarity index 100% rename from test/samples-load-errors/invalid-yaml-directive-version-2.yml rename to test/core/samples-load-errors/invalid-yaml-directive-version-2.yml diff --git a/test/samples-load-errors/invalid-yaml-directive-version-3.yml b/test/core/samples-load-errors/invalid-yaml-directive-version-3.yml similarity index 100% rename from test/samples-load-errors/invalid-yaml-directive-version-3.yml rename to test/core/samples-load-errors/invalid-yaml-directive-version-3.yml diff --git a/test/samples-load-errors/invalid-yaml-directive-version-4.yml b/test/core/samples-load-errors/invalid-yaml-directive-version-4.yml similarity index 100% rename from test/samples-load-errors/invalid-yaml-directive-version-4.yml rename to test/core/samples-load-errors/invalid-yaml-directive-version-4.yml diff --git a/test/samples-load-errors/invalid-yaml-directive-version-5.yml b/test/core/samples-load-errors/invalid-yaml-directive-version-5.yml similarity index 100% rename from test/samples-load-errors/invalid-yaml-directive-version-5.yml rename to test/core/samples-load-errors/invalid-yaml-directive-version-5.yml diff --git a/test/samples-load-errors/invalid-yaml-directive-version-6.yml b/test/core/samples-load-errors/invalid-yaml-directive-version-6.yml similarity index 100% rename from test/samples-load-errors/invalid-yaml-directive-version-6.yml rename to test/core/samples-load-errors/invalid-yaml-directive-version-6.yml diff --git a/test/samples-load-errors/invalid-yaml-version.yml b/test/core/samples-load-errors/invalid-yaml-version.yml similarity index 100% rename from test/samples-load-errors/invalid-yaml-version.yml rename to test/core/samples-load-errors/invalid-yaml-version.yml diff --git a/test/samples-load-errors/no-block-collection-end.yml b/test/core/samples-load-errors/no-block-collection-end.yml similarity index 100% rename from test/samples-load-errors/no-block-collection-end.yml rename to test/core/samples-load-errors/no-block-collection-end.yml diff --git a/test/samples-load-errors/no-block-mapping-end-2.yml b/test/core/samples-load-errors/no-block-mapping-end-2.yml similarity index 100% rename from test/samples-load-errors/no-block-mapping-end-2.yml rename to test/core/samples-load-errors/no-block-mapping-end-2.yml diff --git a/test/samples-load-errors/no-block-mapping-end.yml b/test/core/samples-load-errors/no-block-mapping-end.yml similarity index 100% rename from test/samples-load-errors/no-block-mapping-end.yml rename to test/core/samples-load-errors/no-block-mapping-end.yml diff --git a/test/samples-load-errors/no-document-start.yml b/test/core/samples-load-errors/no-document-start.yml similarity index 100% rename from test/samples-load-errors/no-document-start.yml rename to test/core/samples-load-errors/no-document-start.yml diff --git a/test/samples-load-errors/no-flow-mapping-end.yml b/test/core/samples-load-errors/no-flow-mapping-end.yml similarity index 100% rename from test/samples-load-errors/no-flow-mapping-end.yml rename to test/core/samples-load-errors/no-flow-mapping-end.yml diff --git a/test/samples-load-errors/no-flow-sequence-end.yml b/test/core/samples-load-errors/no-flow-sequence-end.yml similarity index 100% rename from test/samples-load-errors/no-flow-sequence-end.yml rename to test/core/samples-load-errors/no-flow-sequence-end.yml diff --git a/test/samples-load-errors/no-node-1.yml b/test/core/samples-load-errors/no-node-1.yml similarity index 100% rename from test/samples-load-errors/no-node-1.yml rename to test/core/samples-load-errors/no-node-1.yml diff --git a/test/samples-load-errors/no-node-2.yml b/test/core/samples-load-errors/no-node-2.yml similarity index 100% rename from test/samples-load-errors/no-node-2.yml rename to test/core/samples-load-errors/no-node-2.yml diff --git a/test/samples-load-errors/remove-possible-simple-key-bug.yml b/test/core/samples-load-errors/remove-possible-simple-key-bug.yml similarity index 100% rename from test/samples-load-errors/remove-possible-simple-key-bug.yml rename to test/core/samples-load-errors/remove-possible-simple-key-bug.yml diff --git a/test/samples-load-errors/unclosed-bracket.yml b/test/core/samples-load-errors/unclosed-bracket.yml similarity index 100% rename from test/samples-load-errors/unclosed-bracket.yml rename to test/core/samples-load-errors/unclosed-bracket.yml diff --git a/test/samples-load-errors/unclosed-quoted-scalar.yml b/test/core/samples-load-errors/unclosed-quoted-scalar.yml similarity index 100% rename from test/samples-load-errors/unclosed-quoted-scalar.yml rename to test/core/samples-load-errors/unclosed-quoted-scalar.yml diff --git a/test/samples-load-errors/undefined-anchor.yml b/test/core/samples-load-errors/undefined-anchor.yml similarity index 100% rename from test/samples-load-errors/undefined-anchor.yml rename to test/core/samples-load-errors/undefined-anchor.yml diff --git a/test/samples-load-errors/undefined-tag-handle.yml b/test/core/samples-load-errors/undefined-tag-handle.yml similarity index 100% rename from test/samples-load-errors/undefined-tag-handle.yml rename to test/core/samples-load-errors/undefined-tag-handle.yml diff --git a/test/support/schema.js b/test/core/support/schema.js similarity index 98% rename from test/support/schema.js rename to test/core/support/schema.js index 4be287fa..8afbccab 100644 --- a/test/support/schema.js +++ b/test/core/support/schema.js @@ -2,7 +2,7 @@ var util = require('util'); -var yaml = require('../../'); +var yaml = require('js-yaml'); function Tag1(parameters) { diff --git a/test/units/alias-nodes.js b/test/core/units/alias-nodes.js similarity index 98% rename from test/units/alias-nodes.js rename to test/core/units/alias-nodes.js index 44bc527c..188db130 100644 --- a/test/units/alias-nodes.js +++ b/test/core/units/alias-nodes.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); function TestClass(data) { diff --git a/test/units/bom-strip.js b/test/core/units/bom-strip.js similarity index 87% rename from test/units/bom-strip.js rename to test/core/units/bom-strip.js index 87bd1115..bb1e1fcb 100644 --- a/test/units/bom-strip.js +++ b/test/core/units/bom-strip.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('BOM strip', function () { diff --git a/test/units/character-set.js b/test/core/units/character-set.js similarity index 96% rename from test/units/character-set.js rename to test/core/units/character-set.js index d529a512..ab471a0a 100644 --- a/test/units/character-set.js +++ b/test/core/units/character-set.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Allow astral characters', function () { diff --git a/test/units/dump-scalar-styles.js b/test/core/units/dump-scalar-styles.js similarity index 99% rename from test/units/dump-scalar-styles.js rename to test/core/units/dump-scalar-styles.js index a9cf1f27..12458d61 100644 --- a/test/units/dump-scalar-styles.js +++ b/test/core/units/dump-scalar-styles.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'); -var yaml = require('../..'); +var yaml = require('js-yaml'); // Indents lines by 2 spaces. Empty lines (\n only) are not indented. function indent(string) { diff --git a/test/units/empty-node-resolving.js b/test/core/units/empty-node-resolving.js similarity index 97% rename from test/units/empty-node-resolving.js rename to test/core/units/empty-node-resolving.js index eebc0766..712e4d3c 100644 --- a/test/units/empty-node-resolving.js +++ b/test/core/units/empty-node-resolving.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); describe('Resolving explicit tags on empty nodes', function () { diff --git a/test/units/is-negative-zero.js b/test/core/units/is-negative-zero.js similarity index 75% rename from test/units/is-negative-zero.js rename to test/core/units/is-negative-zero.js index acf0a914..c03bc577 100644 --- a/test/units/is-negative-zero.js +++ b/test/core/units/is-negative-zero.js @@ -3,7 +3,7 @@ var assert = require('assert'); -var isNegativeZero = require('../../lib/common').isNegativeZero; +var isNegativeZero = require('../../../lib/common').isNegativeZero; it('isNegativeZero', function () { diff --git a/test/units/loader-parameters.js b/test/core/units/loader-parameters.js similarity index 97% rename from test/units/loader-parameters.js rename to test/core/units/loader-parameters.js index 96946210..e1c04bf9 100644 --- a/test/units/loader-parameters.js +++ b/test/core/units/loader-parameters.js @@ -1,7 +1,7 @@ 'use strict'; var assert = require('assert'); -var yaml = require('../..'); +var yaml = require('js-yaml'); describe('loader parameters', function () { var testStr = 'test: 1 \ntest: 2'; diff --git a/test/units/replacer.js b/test/core/units/replacer.js similarity index 99% rename from test/units/replacer.js rename to test/core/units/replacer.js index 81072d5e..991dda72 100644 --- a/test/units/replacer.js +++ b/test/core/units/replacer.js @@ -1,7 +1,7 @@ 'use strict'; const assert = require('assert'); -const yaml = require('../..'); +const yaml = require('js-yaml'); describe('replacer', function () { diff --git a/test/units/single-document-error.js b/test/core/units/single-document-error.js similarity index 93% rename from test/units/single-document-error.js rename to test/core/units/single-document-error.js index 1ae8b141..8529e6c3 100644 --- a/test/units/single-document-error.js +++ b/test/core/units/single-document-error.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); it('Loading multidocument source using `load` should cause an error', function () { diff --git a/test/units/skip-invalid.js b/test/core/units/skip-invalid.js similarity index 95% rename from test/units/skip-invalid.js rename to test/core/units/skip-invalid.js index 54e539f2..d77612d1 100644 --- a/test/units/skip-invalid.js +++ b/test/core/units/skip-invalid.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var sample = { diff --git a/test/units/snippet.js b/test/core/units/snippet.js similarity index 95% rename from test/units/snippet.js rename to test/core/units/snippet.js index 47d82c22..70943d4d 100644 --- a/test/units/snippet.js +++ b/test/core/units/snippet.js @@ -4,7 +4,7 @@ var assert = require('assert'); var path = require('path'); var fs = require('fs'); -var snippet = require('../../lib/snippet'); +var snippet = require('../../../lib/snippet'); it('Snippet', function () { diff --git a/test/units/snippet.txt b/test/core/units/snippet.txt similarity index 100% rename from test/units/snippet.txt rename to test/core/units/snippet.txt diff --git a/test/units/sort-keys.js b/test/core/units/sort-keys.js similarity index 95% rename from test/units/sort-keys.js rename to test/core/units/sort-keys.js index 9cde2f4b..a439150f 100644 --- a/test/units/sort-keys.js +++ b/test/core/units/sort-keys.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var sample = { b: 1, a: 2, c: 3 }; var unsortedExpected = 'b: 1\na: 2\nc: 3\n'; diff --git a/test/units/tagmultikind.js b/test/core/units/tagmultikind.js similarity index 95% rename from test/units/tagmultikind.js rename to test/core/units/tagmultikind.js index 13dbc850..036b2d97 100644 --- a/test/units/tagmultikind.js +++ b/test/core/units/tagmultikind.js @@ -2,7 +2,7 @@ var assert = require('assert'); -var yaml = require('../../'); +var yaml = require('js-yaml'); var tags = [ { tag: 'Include', From 1608fa00eb46552e573108165bfc2e9869c1a4f4 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Thu, 28 May 2026 17:33:23 +0300 Subject: [PATCH 04/23] tests: drop mocha --- package.json | 5 ++--- test/.eslintrc.yml | 1 - test/core/00-units.test.js | 1 + test/core/10-loader.test.js | 1 + test/core/11-load-errors.test.js | 1 + test/core/20-dumper.test.js | 1 + test/core/25-dumper-fuzzy.test.js | 2 ++ test/core/30-issues.test.js | 1 + test/core/issues/0008.js | 1 + test/core/issues/0017.js | 1 + test/core/issues/0019.js | 1 + test/core/issues/0026.js | 1 + test/core/issues/0027.js | 1 + test/core/issues/0033.js | 1 + test/core/issues/0046.js | 1 + test/core/issues/0054.js | 1 + test/core/issues/0063.js | 1 + test/core/issues/0064.js | 1 + test/core/issues/0068.js | 1 + test/core/issues/0080.js | 1 + test/core/issues/0085.js | 1 + test/core/issues/0092.js | 1 + test/core/issues/0093.js | 1 + test/core/issues/0095.js | 1 + test/core/issues/0108.js | 1 + test/core/issues/0110.js | 1 + test/core/issues/0112.js | 1 + test/core/issues/0117.js | 1 + test/core/issues/0144.js | 1 + test/core/issues/0154.js | 1 + test/core/issues/0155.js | 1 + test/core/issues/0156.js | 1 + test/core/issues/0160.js | 1 + test/core/issues/0164.js | 1 + test/core/issues/0194.js | 1 + test/core/issues/0203.js | 1 + test/core/issues/0205.js | 1 + test/core/issues/0220.js | 1 + test/core/issues/0221.js | 1 + test/core/issues/0235.js | 2 ++ test/core/issues/0243.js | 1 + test/core/issues/0248-listener.js | 2 ++ test/core/issues/0258.js | 1 + test/core/issues/0266.js | 1 + test/core/issues/0301.js | 1 + test/core/issues/0303.js | 2 ++ test/core/issues/0321.js | 1 + test/core/issues/0332.js | 1 + test/core/issues/0333.js | 1 + test/core/issues/0335.js | 1 + test/core/issues/0342.js | 1 + test/core/issues/0346.js | 2 ++ test/core/issues/0350.js | 1 + test/core/issues/0351.js | 1 + test/core/issues/0385.js | 1 + test/core/issues/0399.js | 1 + test/core/issues/0403.js | 1 + test/core/issues/0418.js | 1 + test/core/issues/0432.js | 1 + test/core/issues/0468.js | 1 + test/core/issues/0470.js | 1 + test/core/issues/0475.js | 1 + test/core/issues/0519.js | 2 ++ test/core/issues/0521.js | 1 + test/core/issues/0525-1.js | 1 + test/core/issues/0525-2.js | 1 + test/core/issues/0529.js | 2 ++ test/core/issues/0570.js | 1 + test/core/issues/0571.js | 1 + test/core/issues/0576.js | 1 + test/core/issues/0586.js | 2 ++ test/core/issues/0587.js | 1 + test/core/issues/0614.js | 2 ++ test/core/units/alias-nodes.js | 1 + test/core/units/bom-strip.js | 1 + test/core/units/character-set.js | 1 + test/core/units/dump-scalar-styles.js | 2 ++ test/core/units/empty-node-resolving.js | 1 + test/core/units/is-negative-zero.js | 1 + test/core/units/loader-parameters.js | 2 ++ test/core/units/replacer.js | 2 ++ test/core/units/single-document-error.js | 1 + test/core/units/skip-invalid.js | 1 + test/core/units/snippet.js | 1 + test/core/units/sort-keys.js | 1 + test/core/units/tagmultikind.js | 1 + 86 files changed, 98 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e6d2c4bd..d55323f4 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "scripts": { "lint": "eslint .", "test": "npm run lint && npm run test:core", - "test:core": "mocha test/core/*.test.*", - "coverage": "npm run lint && c8 -r html mocha test/core/*.test.*", + "test:core": "node --test test/core/*.test.*", + "coverage": "npm run lint && c8 -r html node --test test/core/*.test.*", "demo": "npm run lint && node support/build_demo.js", "gh-demo": "npm run demo && gh-pages -d demo -f", "browserify": "rollup -c support/rollup.config.js", @@ -55,7 +55,6 @@ "eslint": "^7.0.0", "fast-check": "^2.8.0", "gh-pages": "^3.1.0", - "mocha": "^8.2.1", "c8": "^11.0.0", "rollup": "^2.34.1", "rollup-plugin-node-polyfills": "^0.2.1", diff --git a/test/.eslintrc.yml b/test/.eslintrc.yml index 5fa543ad..1ca27d93 100644 --- a/test/.eslintrc.yml +++ b/test/.eslintrc.yml @@ -1,6 +1,5 @@ env: node: true - mocha: true es6: true parserOptions: diff --git a/test/core/00-units.test.js b/test/core/00-units.test.js index 7dfa4953..a8cb6896 100644 --- a/test/core/00-units.test.js +++ b/test/core/00-units.test.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe } = require('node:test'); var path = require('path'); var fs = require('fs'); diff --git a/test/core/10-loader.test.js b/test/core/10-loader.test.js index 36b30aae..49a521e5 100644 --- a/test/core/10-loader.test.js +++ b/test/core/10-loader.test.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); var assert = require('assert'); var path = require('path'); diff --git a/test/core/11-load-errors.test.js b/test/core/11-load-errors.test.js index 729a32cd..615c995e 100644 --- a/test/core/11-load-errors.test.js +++ b/test/core/11-load-errors.test.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); var assert = require('assert'); var path = require('path'); diff --git a/test/core/20-dumper.test.js b/test/core/20-dumper.test.js index 67ff31ee..188b9dd1 100644 --- a/test/core/20-dumper.test.js +++ b/test/core/20-dumper.test.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); var assert = require('assert'); var path = require('path'); diff --git a/test/core/25-dumper-fuzzy.test.js b/test/core/25-dumper-fuzzy.test.js index db8cba5a..aff15496 100644 --- a/test/core/25-dumper-fuzzy.test.js +++ b/test/core/25-dumper-fuzzy.test.js @@ -1,5 +1,7 @@ 'use strict'; +const { describe, it } = require('node:test'); + var assert = require('assert'); var fc = require('fast-check'); var yaml = require('js-yaml'); diff --git a/test/core/30-issues.test.js b/test/core/30-issues.test.js index 4a4095ab..be903cf5 100644 --- a/test/core/30-issues.test.js +++ b/test/core/30-issues.test.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe } = require('node:test'); var path = require('path'); var fs = require('fs'); diff --git a/test/core/issues/0008.js b/test/core/issues/0008.js index 75e50e13..a74632fa 100644 --- a/test/core/issues/0008.js +++ b/test/core/issues/0008.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0017.js b/test/core/issues/0017.js index 0d33ab2b..e8856016 100644 --- a/test/core/issues/0017.js +++ b/test/core/issues/0017.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0019.js b/test/core/issues/0019.js index 881d6d11..e54237fb 100644 --- a/test/core/issues/0019.js +++ b/test/core/issues/0019.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0026.js b/test/core/issues/0026.js index f94b02c9..9e9aa6a3 100644 --- a/test/core/issues/0026.js +++ b/test/core/issues/0026.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0027.js b/test/core/issues/0027.js index f68b07e1..a83414a4 100644 --- a/test/core/issues/0027.js +++ b/test/core/issues/0027.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0033.js b/test/core/issues/0033.js index 6f3fc78e..be7a2947 100644 --- a/test/core/issues/0033.js +++ b/test/core/issues/0033.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0046.js b/test/core/issues/0046.js index 4ef03242..a6317f12 100644 --- a/test/core/issues/0046.js +++ b/test/core/issues/0046.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0054.js b/test/core/issues/0054.js index 87d97701..ef10d42c 100644 --- a/test/core/issues/0054.js +++ b/test/core/issues/0054.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0063.js b/test/core/issues/0063.js index 1cfd411c..4d1cccff 100644 --- a/test/core/issues/0063.js +++ b/test/core/issues/0063.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0064.js b/test/core/issues/0064.js index e056c3ee..ecfc10d9 100644 --- a/test/core/issues/0064.js +++ b/test/core/issues/0064.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0068.js b/test/core/issues/0068.js index 520b0d8f..d2af9023 100644 --- a/test/core/issues/0068.js +++ b/test/core/issues/0068.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0080.js b/test/core/issues/0080.js index a2c9d710..7a922b40 100644 --- a/test/core/issues/0080.js +++ b/test/core/issues/0080.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0085.js b/test/core/issues/0085.js index f3627de5..57916fb6 100644 --- a/test/core/issues/0085.js +++ b/test/core/issues/0085.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0092.js b/test/core/issues/0092.js index f93053c5..c5401a95 100644 --- a/test/core/issues/0092.js +++ b/test/core/issues/0092.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0093.js b/test/core/issues/0093.js index 267e06b4..64a5ceac 100644 --- a/test/core/issues/0093.js +++ b/test/core/issues/0093.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0095.js b/test/core/issues/0095.js index cfbc4b8a..e2ac3d14 100644 --- a/test/core/issues/0095.js +++ b/test/core/issues/0095.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0108.js b/test/core/issues/0108.js index cba67b57..028762fc 100644 --- a/test/core/issues/0108.js +++ b/test/core/issues/0108.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0110.js b/test/core/issues/0110.js index 87185366..2348f927 100644 --- a/test/core/issues/0110.js +++ b/test/core/issues/0110.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0112.js b/test/core/issues/0112.js index 2b3e7b54..95a26387 100644 --- a/test/core/issues/0112.js +++ b/test/core/issues/0112.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0117.js b/test/core/issues/0117.js index 43365bd9..1b580d75 100644 --- a/test/core/issues/0117.js +++ b/test/core/issues/0117.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0144.js b/test/core/issues/0144.js index 2dbccd1d..cd3c1468 100644 --- a/test/core/issues/0144.js +++ b/test/core/issues/0144.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0154.js b/test/core/issues/0154.js index be288e31..7a21aebc 100644 --- a/test/core/issues/0154.js +++ b/test/core/issues/0154.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0155.js b/test/core/issues/0155.js index 9a7fa19b..16797e8e 100644 --- a/test/core/issues/0155.js +++ b/test/core/issues/0155.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0156.js b/test/core/issues/0156.js index 8b81563f..f6517ad2 100644 --- a/test/core/issues/0156.js +++ b/test/core/issues/0156.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0160.js b/test/core/issues/0160.js index 2e279765..e36450ff 100644 --- a/test/core/issues/0160.js +++ b/test/core/issues/0160.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0164.js b/test/core/issues/0164.js index c5d18313..742fb788 100644 --- a/test/core/issues/0164.js +++ b/test/core/issues/0164.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0194.js b/test/core/issues/0194.js index c7783bf9..426fec88 100644 --- a/test/core/issues/0194.js +++ b/test/core/issues/0194.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0203.js b/test/core/issues/0203.js index bb267607..e3c1e481 100644 --- a/test/core/issues/0203.js +++ b/test/core/issues/0203.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0205.js b/test/core/issues/0205.js index 01cbeaeb..decfde41 100644 --- a/test/core/issues/0205.js +++ b/test/core/issues/0205.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0220.js b/test/core/issues/0220.js index a72a78f6..ba3dd7fb 100644 --- a/test/core/issues/0220.js +++ b/test/core/issues/0220.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0221.js b/test/core/issues/0221.js index 17ef7513..3a890463 100644 --- a/test/core/issues/0221.js +++ b/test/core/issues/0221.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0235.js b/test/core/issues/0235.js index 82ee5fbc..c82de73b 100644 --- a/test/core/issues/0235.js +++ b/test/core/issues/0235.js @@ -1,5 +1,7 @@ 'use strict'; +const { it } = require('node:test'); + var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0243.js b/test/core/issues/0243.js index 0989a012..5c9f6b7e 100644 --- a/test/core/issues/0243.js +++ b/test/core/issues/0243.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0248-listener.js b/test/core/issues/0248-listener.js index 40646f3c..ff21b7ef 100644 --- a/test/core/issues/0248-listener.js +++ b/test/core/issues/0248-listener.js @@ -1,5 +1,7 @@ 'use strict'; +const { it } = require('node:test'); + var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0258.js b/test/core/issues/0258.js index 2a1576ac..25d89a3c 100644 --- a/test/core/issues/0258.js +++ b/test/core/issues/0258.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0266.js b/test/core/issues/0266.js index dcad8868..50aa3beb 100644 --- a/test/core/issues/0266.js +++ b/test/core/issues/0266.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0301.js b/test/core/issues/0301.js index 03998c45..6831e396 100644 --- a/test/core/issues/0301.js +++ b/test/core/issues/0301.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0303.js b/test/core/issues/0303.js index dd45a1f4..d11aff8c 100644 --- a/test/core/issues/0303.js +++ b/test/core/issues/0303.js @@ -1,5 +1,7 @@ 'use strict'; +const { it } = require('node:test'); + var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0321.js b/test/core/issues/0321.js index 9ef40ce1..b2fca629 100644 --- a/test/core/issues/0321.js +++ b/test/core/issues/0321.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0332.js b/test/core/issues/0332.js index c33776cc..51096235 100644 --- a/test/core/issues/0332.js +++ b/test/core/issues/0332.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0333.js b/test/core/issues/0333.js index bc8fc761..1b50e1df 100644 --- a/test/core/issues/0333.js +++ b/test/core/issues/0333.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0335.js b/test/core/issues/0335.js index a3431269..c3d10206 100644 --- a/test/core/issues/0335.js +++ b/test/core/issues/0335.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0342.js b/test/core/issues/0342.js index efa1295e..6741e88b 100644 --- a/test/core/issues/0342.js +++ b/test/core/issues/0342.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0346.js b/test/core/issues/0346.js index a40ef646..b24ec684 100644 --- a/test/core/issues/0346.js +++ b/test/core/issues/0346.js @@ -1,5 +1,7 @@ 'use strict'; +const { it } = require('node:test'); + var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0350.js b/test/core/issues/0350.js index 62ef389e..a7b53548 100644 --- a/test/core/issues/0350.js +++ b/test/core/issues/0350.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0351.js b/test/core/issues/0351.js index 8790a417..3f8682d0 100644 --- a/test/core/issues/0351.js +++ b/test/core/issues/0351.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0385.js b/test/core/issues/0385.js index 60945d25..8d16d053 100644 --- a/test/core/issues/0385.js +++ b/test/core/issues/0385.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0399.js b/test/core/issues/0399.js index 9298eee3..ee344f06 100644 --- a/test/core/issues/0399.js +++ b/test/core/issues/0399.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0403.js b/test/core/issues/0403.js index 0a816040..b55421c5 100644 --- a/test/core/issues/0403.js +++ b/test/core/issues/0403.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0418.js b/test/core/issues/0418.js index 8aa8b8a3..27de5071 100644 --- a/test/core/issues/0418.js +++ b/test/core/issues/0418.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0432.js b/test/core/issues/0432.js index 7c8381ee..d2a1eadf 100644 --- a/test/core/issues/0432.js +++ b/test/core/issues/0432.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0468.js b/test/core/issues/0468.js index 1ee04299..2c9fa730 100644 --- a/test/core/issues/0468.js +++ b/test/core/issues/0468.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0470.js b/test/core/issues/0470.js index 395d66d9..061d32f5 100644 --- a/test/core/issues/0470.js +++ b/test/core/issues/0470.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0475.js b/test/core/issues/0475.js index dc8aa271..97334f2f 100644 --- a/test/core/issues/0475.js +++ b/test/core/issues/0475.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0519.js b/test/core/issues/0519.js index d86858a8..4a1d8896 100644 --- a/test/core/issues/0519.js +++ b/test/core/issues/0519.js @@ -1,5 +1,7 @@ 'use strict'; +const { it } = require('node:test'); + var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0521.js b/test/core/issues/0521.js index d67022ff..d98b692c 100644 --- a/test/core/issues/0521.js +++ b/test/core/issues/0521.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0525-1.js b/test/core/issues/0525-1.js index 7fab76cc..30faafc7 100644 --- a/test/core/issues/0525-1.js +++ b/test/core/issues/0525-1.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0525-2.js b/test/core/issues/0525-2.js index 017b2ed9..e656cbe7 100644 --- a/test/core/issues/0525-2.js +++ b/test/core/issues/0525-2.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0529.js b/test/core/issues/0529.js index 60a41a58..a29aa7b1 100644 --- a/test/core/issues/0529.js +++ b/test/core/issues/0529.js @@ -1,5 +1,7 @@ 'use strict'; +const { describe, it } = require('node:test'); + /* eslint-disable max-len */ const assert = require('assert'); diff --git a/test/core/issues/0570.js b/test/core/issues/0570.js index ef7ccad8..5b0ce667 100644 --- a/test/core/issues/0570.js +++ b/test/core/issues/0570.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0571.js b/test/core/issues/0571.js index ec58c17e..1e33e2d3 100644 --- a/test/core/issues/0571.js +++ b/test/core/issues/0571.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0576.js b/test/core/issues/0576.js index 767a958f..7866a021 100644 --- a/test/core/issues/0576.js +++ b/test/core/issues/0576.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0586.js b/test/core/issues/0586.js index 781857c5..a46da1d8 100644 --- a/test/core/issues/0586.js +++ b/test/core/issues/0586.js @@ -1,5 +1,7 @@ 'use strict'; +const { it } = require('node:test'); + /* eslint-disable no-use-before-define, new-cap */ diff --git a/test/core/issues/0587.js b/test/core/issues/0587.js index 09cbc081..29408cde 100644 --- a/test/core/issues/0587.js +++ b/test/core/issues/0587.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/issues/0614.js b/test/core/issues/0614.js index 698a7b5f..6e6bc87b 100644 --- a/test/core/issues/0614.js +++ b/test/core/issues/0614.js @@ -1,5 +1,7 @@ 'use strict'; +const { it } = require('node:test'); + /* global BigInt */ diff --git a/test/core/units/alias-nodes.js b/test/core/units/alias-nodes.js index 188db130..2eeab6fb 100644 --- a/test/core/units/alias-nodes.js +++ b/test/core/units/alias-nodes.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/bom-strip.js b/test/core/units/bom-strip.js index bb1e1fcb..7eab36e8 100644 --- a/test/core/units/bom-strip.js +++ b/test/core/units/bom-strip.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/character-set.js b/test/core/units/character-set.js index ab471a0a..6f7058e2 100644 --- a/test/core/units/character-set.js +++ b/test/core/units/character-set.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/dump-scalar-styles.js b/test/core/units/dump-scalar-styles.js index 12458d61..cc93590d 100644 --- a/test/core/units/dump-scalar-styles.js +++ b/test/core/units/dump-scalar-styles.js @@ -1,5 +1,7 @@ 'use strict'; +const { describe, it } = require('node:test'); + var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/empty-node-resolving.js b/test/core/units/empty-node-resolving.js index 712e4d3c..9bb7e76c 100644 --- a/test/core/units/empty-node-resolving.js +++ b/test/core/units/empty-node-resolving.js @@ -1,5 +1,6 @@ 'use strict'; +const { describe, it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/is-negative-zero.js b/test/core/units/is-negative-zero.js index c03bc577..942a8886 100644 --- a/test/core/units/is-negative-zero.js +++ b/test/core/units/is-negative-zero.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); diff --git a/test/core/units/loader-parameters.js b/test/core/units/loader-parameters.js index e1c04bf9..7bd2404b 100644 --- a/test/core/units/loader-parameters.js +++ b/test/core/units/loader-parameters.js @@ -1,5 +1,7 @@ 'use strict'; +const { describe, it } = require('node:test'); + var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/replacer.js b/test/core/units/replacer.js index 991dda72..10c2b17f 100644 --- a/test/core/units/replacer.js +++ b/test/core/units/replacer.js @@ -1,5 +1,7 @@ 'use strict'; +const { describe, it } = require('node:test'); + const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/units/single-document-error.js b/test/core/units/single-document-error.js index 8529e6c3..477a9c2a 100644 --- a/test/core/units/single-document-error.js +++ b/test/core/units/single-document-error.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/skip-invalid.js b/test/core/units/skip-invalid.js index d77612d1..aabe4773 100644 --- a/test/core/units/skip-invalid.js +++ b/test/core/units/skip-invalid.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/snippet.js b/test/core/units/snippet.js index 70943d4d..112d92e2 100644 --- a/test/core/units/snippet.js +++ b/test/core/units/snippet.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var path = require('path'); diff --git a/test/core/units/sort-keys.js b/test/core/units/sort-keys.js index a439150f..25d712c8 100644 --- a/test/core/units/sort-keys.js +++ b/test/core/units/sort-keys.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); diff --git a/test/core/units/tagmultikind.js b/test/core/units/tagmultikind.js index 036b2d97..35b89ddb 100644 --- a/test/core/units/tagmultikind.js +++ b/test/core/units/tagmultikind.js @@ -1,5 +1,6 @@ 'use strict'; +const { it } = require('node:test'); var assert = require('assert'); var yaml = require('js-yaml'); From dcd60b4a0dca7eca900db17618e80c0b2bbc0541 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Thu, 28 May 2026 18:18:38 +0300 Subject: [PATCH 05/23] Add build test --- package.json | 1 + test/build/dist.test.js | 74 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 test/build/dist.test.js diff --git a/package.json b/package.json index d55323f4..8e282522 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "lint": "eslint .", "test": "npm run lint && npm run test:core", "test:core": "node --test test/core/*.test.*", + "test:build": "npm run browserify && node --test test/build/*.test.*", "coverage": "npm run lint && c8 -r html node --test test/core/*.test.*", "demo": "npm run lint && node support/build_demo.js", "gh-demo": "npm run demo && gh-pages -d demo -f", diff --git a/test/build/dist.test.js b/test/build/dist.test.js new file mode 100644 index 00000000..4d8c4449 --- /dev/null +++ b/test/build/dist.test.js @@ -0,0 +1,74 @@ +'use strict'; + +const { describe, it } = require('node:test'); + +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); +const vm = require('vm'); + + +const distDir = path.resolve(__dirname, '../../dist'); + +const expectedKeys = [ + 'CORE_SCHEMA', + 'DEFAULT_SCHEMA', + 'FAILSAFE_SCHEMA', + 'JSON_SCHEMA', + 'Schema', + 'Type', + 'YAMLException', + 'default', + 'dump', + 'load', + 'loadAll', + 'safeDump', + 'safeLoad', + 'safeLoadAll', + 'types' +]; + + +function checkExports(yaml, options) { + assert.deepStrictEqual(Object.keys(yaml).sort(), expectedKeys.slice().sort()); + assert.strictEqual(yaml.default.load, yaml.load); + assert.strictEqual(yaml.load('a: 1').a, 1); + assert.strictEqual(typeof yaml.dump, 'function'); + assert.strictEqual(typeof yaml.types.binary, 'object'); + + if (options && options.checkEsModule) { + assert.strictEqual(yaml.__esModule, true); + } +} + + +function loadGlobal(filename) { + const context = {}; + + vm.runInNewContext(fs.readFileSync(path.join(distDir, filename), 'utf8'), context); + + return context.jsyaml; +} + + +describe('dist build', function () { + it('exports the expected UMD API from js-yaml.js', function () { + checkExports(require('../../dist/js-yaml.js'), { checkEsModule: true }); + }); + + it('exports the expected UMD API from js-yaml.min.js', function () { + checkExports(require('../../dist/js-yaml.min.js'), { checkEsModule: true }); + }); + + it('exports the expected ESM API from js-yaml.mjs', async function () { + checkExports(await import('../../dist/js-yaml.mjs')); + }); + + it('exposes the expected browser global from js-yaml.js', function () { + checkExports(loadGlobal('js-yaml.js')); + }); + + it('exposes the expected browser global from js-yaml.min.js', function () { + checkExports(loadGlobal('js-yaml.min.js')); + }); +}); From 4a5999dfdf9decb33af7b24f87ee6bca132fd096 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Thu, 28 May 2026 19:46:36 +0300 Subject: [PATCH 06/23] Polish package.json scripts --- package.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8e282522..72a6547e 100644 --- a/package.json +++ b/package.json @@ -35,14 +35,15 @@ }, "scripts": { "lint": "eslint .", - "test": "npm run lint && npm run test:core", + "test": "npm run lint && npm run test:core && npm run test:build", "test:core": "node --test test/core/*.test.*", - "test:build": "npm run browserify && node --test test/build/*.test.*", - "coverage": "npm run lint && c8 -r html node --test test/core/*.test.*", - "demo": "npm run lint && node support/build_demo.js", - "gh-demo": "npm run demo && gh-pages -d demo -f", - "browserify": "rollup -c support/rollup.config.js", - "prepublishOnly": "npm run gh-demo" + "test:build": "npm run build && node --test test/build/*.test.*", + "coverage": "npm run build && c8 --include 'lib/**' -r text -r html -r lcov node --test test/core/*.test.*", + "build": "rollup -c support/rollup.config.js", + "build:demo": "npm run lint && node support/build_demo.js", + "gh-demo": "npm run build:demo && gh-pages -d demo -f", + "prepack": "npm test && npm run build && npm run build:demo", + "postpublish": "npm run gh-demo" }, "unpkg": "dist/js-yaml.min.js", "jsdelivr": "dist/js-yaml.min.js", From 2e3404d5d7d8676dc91525f58aa4b239500fff52 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Thu, 28 May 2026 22:11:20 +0300 Subject: [PATCH 07/23] rollup => vite --- lib/index_vite_proxy.tmp.mjs | 37 +++++++++++++++++ package.json | 8 ++-- support/build-dist.mjs | 80 ++++++++++++++++++++++++++++++++++++ test/build/dist.test.js | 12 ++++++ 4 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 lib/index_vite_proxy.tmp.mjs create mode 100644 support/build-dist.mjs diff --git a/lib/index_vite_proxy.tmp.mjs b/lib/index_vite_proxy.tmp.mjs new file mode 100644 index 00000000..303f2316 --- /dev/null +++ b/lib/index_vite_proxy.tmp.mjs @@ -0,0 +1,37 @@ +import yaml from '../index.js' + +const { + Type, + Schema, + FAILSAFE_SCHEMA, + JSON_SCHEMA, + CORE_SCHEMA, + DEFAULT_SCHEMA, + load, + loadAll, + dump, + YAMLException, + types, + safeLoad, + safeLoadAll, + safeDump +} = yaml + +export { + Type, + Schema, + FAILSAFE_SCHEMA, + JSON_SCHEMA, + CORE_SCHEMA, + DEFAULT_SCHEMA, + load, + loadAll, + dump, + YAMLException, + types, + safeLoad, + safeLoadAll, + safeDump +} + +export default yaml diff --git a/package.json b/package.json index 72a6547e..0a6a195a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "test:core": "node --test test/core/*.test.*", "test:build": "npm run build && node --test test/build/*.test.*", "coverage": "npm run build && c8 --include 'lib/**' -r text -r html -r lcov node --test test/core/*.test.*", - "build": "rollup -c support/rollup.config.js", + "build": "node support/build-dist.mjs", "build:demo": "npm run lint && node support/build_demo.js", "gh-demo": "npm run build:demo && gh-pages -d demo -f", "prepack": "npm test && npm run build && npm run build:demo", @@ -53,15 +53,15 @@ "devDependencies": { "@rollup/plugin-commonjs": "^17.0.0", "@rollup/plugin-node-resolve": "^11.0.0", + "c8": "^11.0.0", "codemirror": "^5.13.4", "eslint": "^7.0.0", "fast-check": "^2.8.0", "gh-pages": "^3.1.0", - "c8": "^11.0.0", "rollup": "^2.34.1", "rollup-plugin-node-polyfills": "^0.2.1", - "rollup-plugin-terser": "^7.0.2", "shelljs": "^0.8.4", - "tinybench": "^6.0.2" + "tinybench": "^6.0.2", + "vite": "^8.0.14" } } diff --git a/support/build-dist.mjs b/support/build-dist.mjs new file mode 100644 index 00000000..2405355a --- /dev/null +++ b/support/build-dist.mjs @@ -0,0 +1,80 @@ +import { rm } from 'node:fs/promises' +import { createRequire } from 'node:module' +import { build } from 'vite' + +const require = createRequire(import.meta.url) +const pkg = require('../package.json') + +const banner = `/*! ${pkg.name} ${pkg.version} https://github.com/${pkg.repository} @license ${pkg.license} */` + +const common = { + configFile: false, + logLevel: 'info', + build: { + outDir: 'dist', + emptyOutDir: false, + sourcemap: true, + target: 'es2015' + } +} + +await rm('dist', { recursive: true, force: true }) + +await build({ + ...common, + build: { + ...common.build, + minify: false, + lib: { + entry: 'lib/index_vite_proxy.tmp.mjs', + name: 'jsyaml', + formats: [ 'umd' ], + fileName: () => 'js-yaml.js' + }, + rollupOptions: { + external: [], + output: { + banner + } + } + } +}) + +await build({ + ...common, + build: { + ...common.build, + minify: true, + lib: { + entry: 'lib/index_vite_proxy.tmp.mjs', + name: 'jsyaml', + formats: [ 'umd' ], + fileName: () => 'js-yaml.min.js' + }, + rollupOptions: { + external: [], + output: { + banner + } + } + } +}) + +await build({ + ...common, + build: { + ...common.build, + minify: false, + lib: { + entry: 'lib/index_vite_proxy.tmp.mjs', + formats: [ 'es' ], + fileName: () => 'js-yaml.mjs' + }, + rollupOptions: { + external: [], + output: { + banner + } + } + } +}) diff --git a/test/build/dist.test.js b/test/build/dist.test.js index 4d8c4449..8bb86bff 100644 --- a/test/build/dist.test.js +++ b/test/build/dist.test.js @@ -52,6 +52,18 @@ function loadGlobal(filename) { describe('dist build', function () { + it('keeps Vite proxy exports in sync with the CommonJS entry', async function () { + const yaml = require('../../index.js'); + const proxy = await import('../../lib/index_vite_proxy.tmp.mjs'); + + assert.deepStrictEqual(Object.keys(proxy).sort(), Object.keys(yaml).concat('default').sort()); + assert.strictEqual(proxy.default, yaml); + + Object.keys(yaml).forEach(function (key) { + assert.strictEqual(proxy[key], yaml[key]); + }); + }); + it('exports the expected UMD API from js-yaml.js', function () { checkExports(require('../../dist/js-yaml.js'), { checkEsModule: true }); }); From 9062228d47efee14b40bcc752beb9cbd46badec2 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Thu, 28 May 2026 22:13:18 +0300 Subject: [PATCH 08/23] Remove dist/ from repo (build on publish) --- .gitignore | 1 + dist/js-yaml.js | 3880 ------------------------------------------- dist/js-yaml.min.js | 2 - dist/js-yaml.mjs | 3856 ------------------------------------------ 4 files changed, 1 insertion(+), 7738 deletions(-) delete mode 100644 dist/js-yaml.js delete mode 100644 dist/js-yaml.min.js delete mode 100644 dist/js-yaml.mjs diff --git a/.gitignore b/.gitignore index 5fc6a3d9..2949f09b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules doc benchmark/implementations/* !/benchmark/implementations/current/ +dist/ diff --git a/dist/js-yaml.js b/dist/js-yaml.js deleted file mode 100644 index 21c52eca..00000000 --- a/dist/js-yaml.js +++ /dev/null @@ -1,3880 +0,0 @@ - -/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jsyaml = {})); -})(this, (function (exports) { 'use strict'; - - function isNothing(subject) { - return (typeof subject === 'undefined') || (subject === null); - } - - - function isObject(subject) { - return (typeof subject === 'object') && (subject !== null); - } - - - function toArray(sequence) { - if (Array.isArray(sequence)) return sequence; - else if (isNothing(sequence)) return []; - - return [ sequence ]; - } - - - function extend(target, source) { - var index, length, key, sourceKeys; - - if (source) { - sourceKeys = Object.keys(source); - - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; - } - } - - return target; - } - - - function repeat(string, count) { - var result = '', cycle; - - for (cycle = 0; cycle < count; cycle += 1) { - result += string; - } - - return result; - } - - - function isNegativeZero(number) { - return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); - } - - - var isNothing_1 = isNothing; - var isObject_1 = isObject; - var toArray_1 = toArray; - var repeat_1 = repeat; - var isNegativeZero_1 = isNegativeZero; - var extend_1 = extend; - - var common = { - isNothing: isNothing_1, - isObject: isObject_1, - toArray: toArray_1, - repeat: repeat_1, - isNegativeZero: isNegativeZero_1, - extend: extend_1 - }; - - // YAML error class. http://stackoverflow.com/questions/8458984 - - - function formatError(exception, compact) { - var where = '', message = exception.reason || '(unknown reason)'; - - if (!exception.mark) return message; - - if (exception.mark.name) { - where += 'in "' + exception.mark.name + '" '; - } - - where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; - - if (!compact && exception.mark.snippet) { - where += '\n\n' + exception.mark.snippet; - } - - return message + ' ' + where; - } - - - function YAMLException$1(reason, mark) { - // Super constructor - Error.call(this); - - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = formatError(this, false); - - // Include stack trace in error object - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; - } - } - - - // Inherit from Error - YAMLException$1.prototype = Object.create(Error.prototype); - YAMLException$1.prototype.constructor = YAMLException$1; - - - YAMLException$1.prototype.toString = function toString(compact) { - return this.name + ': ' + formatError(this, compact); - }; - - - var exception = YAMLException$1; - - // get snippet for a single line, respecting maxLength - function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { - var head = ''; - var tail = ''; - var maxHalfLength = Math.floor(maxLineLength / 2) - 1; - - if (position - lineStart > maxHalfLength) { - head = ' ... '; - lineStart = position - maxHalfLength + head.length; - } - - if (lineEnd - position > maxHalfLength) { - tail = ' ...'; - lineEnd = position + maxHalfLength - tail.length; - } - - return { - str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, - pos: position - lineStart + head.length // relative position - }; - } - - - function padStart(string, max) { - return common.repeat(' ', max - string.length) + string; - } - - - function makeSnippet(mark, options) { - options = Object.create(options || null); - - if (!mark.buffer) return null; - - if (!options.maxLength) options.maxLength = 79; - if (typeof options.indent !== 'number') options.indent = 1; - if (typeof options.linesBefore !== 'number') options.linesBefore = 3; - if (typeof options.linesAfter !== 'number') options.linesAfter = 2; - - var re = /\r?\n|\r|\0/g; - var lineStarts = [ 0 ]; - var lineEnds = []; - var match; - var foundLineNo = -1; - - while ((match = re.exec(mark.buffer))) { - lineEnds.push(match.index); - lineStarts.push(match.index + match[0].length); - - if (mark.position <= match.index && foundLineNo < 0) { - foundLineNo = lineStarts.length - 2; - } - } - - if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; - - var result = '', i, line; - var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; - var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); - - for (i = 1; i <= options.linesBefore; i++) { - if (foundLineNo - i < 0) break; - line = getLine( - mark.buffer, - lineStarts[foundLineNo - i], - lineEnds[foundLineNo - i], - mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), - maxLineLength - ); - result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n' + result; - } - - line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); - result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n'; - result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; - - for (i = 1; i <= options.linesAfter; i++) { - if (foundLineNo + i >= lineEnds.length) break; - line = getLine( - mark.buffer, - lineStarts[foundLineNo + i], - lineEnds[foundLineNo + i], - mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), - maxLineLength - ); - result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n'; - } - - return result.replace(/\n$/, ''); - } - - - var snippet = makeSnippet; - - var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'multi', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'representName', - 'defaultStyle', - 'styleAliases' - ]; - - var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' - ]; - - function compileStyleAliases(map) { - var result = {}; - - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } - - return result; - } - - function Type$1(tag, options) { - options = options || {}; - - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); - } - }); - - // TODO: Add tag format check. - this.options = options; // keep original options in case user wants to extend this type later - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.representName = options['representName'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.multi = options['multi'] || false; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } - } - - var type = Type$1; - - /*eslint-disable max-len*/ - - - - - - function compileList(schema, name) { - var result = []; - - schema[name].forEach(function (currentType) { - var newIndex = result.length; - - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && - previousType.kind === currentType.kind && - previousType.multi === currentType.multi) { - - newIndex = previousIndex; - } - }); - - result[newIndex] = currentType; - }); - - return result; - } - - - function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {}, - multi: { - scalar: [], - sequence: [], - mapping: [], - fallback: [] - } - }, index, length; - - function collectType(type) { - if (type.multi) { - result.multi[type.kind].push(type); - result.multi['fallback'].push(type); - } else { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; - } - } - - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } - return result; - } - - - function Schema$1(definition) { - return this.extend(definition); - } - - - Schema$1.prototype.extend = function extend(definition) { - var implicit = []; - var explicit = []; - - if (definition instanceof type) { - // Schema.extend(type) - explicit.push(definition); - - } else if (Array.isArray(definition)) { - // Schema.extend([ type1, type2, ... ]) - explicit = explicit.concat(definition); - - } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { - // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) - if (definition.implicit) implicit = implicit.concat(definition.implicit); - if (definition.explicit) explicit = explicit.concat(definition.explicit); - - } else { - throw new exception('Schema.extend argument should be a Type, [ Type ], ' + - 'or a schema definition ({ implicit: [...], explicit: [...] })'); - } - - implicit.forEach(function (type$1) { - if (!(type$1 instanceof type)) { - throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - - if (type$1.loadKind && type$1.loadKind !== 'scalar') { - throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - - if (type$1.multi) { - throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); - } - }); - - explicit.forEach(function (type$1) { - if (!(type$1 instanceof type)) { - throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - }); - - var result = Object.create(Schema$1.prototype); - - result.implicit = (this.implicit || []).concat(implicit); - result.explicit = (this.explicit || []).concat(explicit); - - result.compiledImplicit = compileList(result, 'implicit'); - result.compiledExplicit = compileList(result, 'explicit'); - result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); - - return result; - }; - - - var schema = Schema$1; - - var str = new type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } - }); - - var seq = new type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } - }); - - var map = new type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } - }); - - var failsafe = new schema({ - explicit: [ - str, - seq, - map - ] - }); - - function resolveYamlNull(data) { - if (data === null) return true; - - var max = data.length; - - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); - } - - function constructYamlNull() { - return null; - } - - function isNull(object) { - return object === null; - } - - var _null = new type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; }, - empty: function () { return ''; } - }, - defaultStyle: 'lowercase' - }); - - function resolveYamlBoolean(data) { - if (data === null) return false; - - var max = data.length; - - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); - } - - function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; - } - - function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; - } - - var bool = new type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' - }); - - function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); - } - - function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); - } - - function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); - } - - function resolveYamlInteger(data) { - if (data === null) return false; - - var max = data.length, - index = 0, - hasDigits = false, - ch; - - if (!max) return false; - - ch = data[index]; - - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; - } - - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; - - // base 2, base 8, base 16 - - if (ch === 'b') { - // base 2 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - - if (ch === 'x') { - // base 16 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - - if (ch === 'o') { - // base 8 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - } - - // base 10 (except 0) - - // value should not start with `_`; - if (ch === '_') return false; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; - } - - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; - - return true; - } - - function constructYamlInteger(data) { - var value = data, sign = 1, ch; - - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); - } - - ch = value[0]; - - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } - - if (value === '0') return 0; - - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); - if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); - } - - return sign * parseInt(value, 10); - } - - function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); - } - - var int = new type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } - }); - - var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); - - function resolveYamlFloat(data) { - if (data === null) return false; - - if (!YAML_FLOAT_PATTERN.test(data) || - // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; - } - - return true; - } - - function constructYamlFloat(data) { - var value, sign; - - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } - - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - - } else if (value === '.nan') { - return NaN; - } - return sign * parseFloat(value, 10); - } - - - var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - - function representYamlFloat(object, style) { - var res; - - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } - - res = object.toString(10); - - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack - - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; - } - - function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); - } - - var float = new type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' - }); - - var json = failsafe.extend({ - implicit: [ - _null, - bool, - int, - float - ] - }); - - var core = json; - - var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day - - var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute - - function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; - } - - function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - - if (match === null) throw new Error('Date resolve error'); - - // match: [1] year [2] month [3] day - - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); - - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); - } - - // match: [4] hour [5] minute [6] second [7] fraction - - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); - - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; - } - fraction = +fraction; - } - - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; - } - - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - - if (delta) date.setTime(date.getTime() - delta); - - return date; - } - - function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); - } - - var timestamp = new type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp - }); - - function resolveYamlMerge(data) { - return data === '<<' || data === null; - } - - var merge = new type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge - }); - - /*eslint-disable no-bitwise*/ - - - - - - // [ 64, 65, 66 ] -> [ padding, CR, LF ] - var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - - - function resolveYamlBinary(data) { - if (data === null) return false; - - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); - - // Skip CR/LF - if (code > 64) continue; - - // Fail on illegal characters - if (code < 0) return false; - - bitlen += 6; - } - - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; - } - - function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; - - // Collect by 6*4 bits (3 bytes) - - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } - - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } - - // Dump tail - - tailbits = (max % 4) * 6; - - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } - - return new Uint8Array(result); - } - - function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; - - // Convert every three bytes to 4 ASCII characters. - - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } - - bits = (bits << 8) + object[idx]; - } - - // Dump tail - - tail = max % 3; - - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; - } - - return result; - } - - function isBinary(obj) { - return Object.prototype.toString.call(obj) === '[object Uint8Array]'; - } - - var binary = new type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary - }); - - var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; - var _toString$2 = Object.prototype.toString; - - function resolveYamlOmap(data) { - if (data === null) return true; - - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; - - if (_toString$2.call(pair) !== '[object Object]') return false; - - for (pairKey in pair) { - if (_hasOwnProperty$3.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } - } - - if (!pairHasKey) return false; - - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; - } - - return true; - } - - function constructYamlOmap(data) { - return data !== null ? data : []; - } - - var omap = new type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap - }); - - var _toString$1 = Object.prototype.toString; - - function resolveYamlPairs(data) { - if (data === null) return true; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - if (_toString$1.call(pair) !== '[object Object]') return false; - - keys = Object.keys(pair); - - if (keys.length !== 1) return false; - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return true; - } - - function constructYamlPairs(data) { - if (data === null) return []; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - keys = Object.keys(pair); - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return result; - } - - var pairs = new type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs - }); - - var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; - - function resolveYamlSet(data) { - if (data === null) return true; - - var key, object = data; - - for (key in object) { - if (_hasOwnProperty$2.call(object, key)) { - if (object[key] !== null) return false; - } - } - - return true; - } - - function constructYamlSet(data) { - return data !== null ? data : {}; - } - - var set = new type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet - }); - - var _default = core.extend({ - implicit: [ - timestamp, - merge - ], - explicit: [ - binary, - omap, - pairs, - set - ] - }); - - /*eslint-disable max-len,no-use-before-define*/ - - - - - - - - var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; - - - var CONTEXT_FLOW_IN = 1; - var CONTEXT_FLOW_OUT = 2; - var CONTEXT_BLOCK_IN = 3; - var CONTEXT_BLOCK_OUT = 4; - - - var CHOMPING_CLIP = 1; - var CHOMPING_STRIP = 2; - var CHOMPING_KEEP = 3; - - - var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; - var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; - var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; - var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; - var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - - - function _class(obj) { return Object.prototype.toString.call(obj); } - - function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); - } - - function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); - } - - function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); - } - - function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; - } - - function fromHexCode(c) { - var lc; - - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - /*eslint-disable no-bitwise*/ - lc = c | 0x20; - - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; - } - - return -1; - } - - function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; - } - - function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - return -1; - } - - function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; - } - - function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); - } - - // set a property of a literal object, while protecting against prototype pollution, - // see https://github.com/nodeca/js-yaml/issues/164 for more details - function setProperty(object, key, value) { - // used for this specific key only because Object.defineProperty is slow - if (key === '__proto__') { - Object.defineProperty(object, key, { - configurable: true, - enumerable: true, - writable: true, - value: value - }); - } else { - object[key] = value; - } - } - - var simpleEscapeCheck = new Array(256); // integer, for fast access - var simpleEscapeMap = new Array(256); - for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); - } - - - function State$1(input, options) { - this.input = input; - - this.filename = options['filename'] || null; - this.schema = options['schema'] || _default; - this.onWarning = options['onWarning'] || null; - // (Hidden) Remove? makes the loader to expect YAML 1.1 documents - // if such documents have no explicit %YAML directive - this.legacy = options['legacy'] || false; - - this.json = options['json'] || false; - this.listener = options['listener'] || null; - - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; - - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; - - // position of first leading tab in the current line, - // used to make sure there are no tabs in the indentation - this.firstTabInLine = -1; - - this.documents = []; - - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ - - } - - - function generateError(state, message) { - var mark = { - name: state.filename, - buffer: state.input.slice(0, -1), // omit trailing \0 - position: state.position, - line: state.line, - column: state.position - state.lineStart - }; - - mark.snippet = snippet(mark); - - return new exception(message, mark); - } - - function throwError(state, message) { - throw generateError(state, message); - } - - function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } - } - - - var directiveHandlers = { - - YAML: function handleYamlDirective(state, name, args) { - - var match, major, minor; - - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } - - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } - - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); - } - - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } - - state.version = args[0]; - state.checkLineBreaks = (minor < 2); - - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - - TAG: function handleTagDirective(state, name, args) { - - var handle, prefix; - - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } - - handle = args[0]; - prefix = args[1]; - - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - - if (_hasOwnProperty$1.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - - try { - prefix = decodeURIComponent(prefix); - } catch (err) { - throwError(state, 'tag prefix is malformed: ' + prefix); - } - - state.tagMap[handle] = prefix; - } - }; - - - function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; - - if (start < end) { - _result = state.input.slice(start, end); - - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } - - state.result += _result; - } - } - - function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; - - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } - - sourceKeys = Object.keys(source); - - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; - - if (!_hasOwnProperty$1.call(destination, key)) { - setProperty(destination, key, source[key]); - overridableKeys[key] = true; - } - } - } - - function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, - startLine, startLineStart, startPos) { - - var index, quantity; - - // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); - - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { - if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); - } - - if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; - } - } - } - - // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } - - - keyNode = String(keyNode); - - if (_result === null) { - _result = {}; - } - - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && - !_hasOwnProperty$1.call(overridableKeys, keyNode) && - _hasOwnProperty$1.call(_result, keyNode)) { - state.line = startLine || state.line; - state.lineStart = startLineStart || state.lineStart; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); - } - - setProperty(_result, keyNode, valueNode); - delete overridableKeys[keyNode]; - } - - return _result; - } - - function readLineBreak(state) { - var ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } - - state.line += 1; - state.lineStart = state.position; - state.firstTabInLine = -1; - } - - function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { - state.firstTabInLine = state.position; - } - ch = state.input.charCodeAt(++state.position); - } - - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } - - if (is_EOL(ch)) { - readLineBreak(state); - - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; - - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } - - return lineBreaks; - } - - function testDocumentSeparator(state) { - var _position = state.position, - ch; - - ch = state.input.charCodeAt(_position); - - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { - - _position += 3; - - ch = state.input.charCodeAt(_position); - - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - - return false; - } - - function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } - } - - - function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; - - ch = state.input.charCodeAt(state.position); - - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; - } - - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } - - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; - - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } - - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); - - if (is_WS_OR_EOL(preceding)) { - break; - } - - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); - - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } - - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } - - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } - - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, captureEnd, false); - - if (state.result) { - return true; - } - - state.kind = _kind; - state.result = _result; - return false; - } - - function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x27/* ' */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a single quoted scalar'); - } - - function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x22/* " */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); - - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; - - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; - - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); - - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; - - } else { - throwError(state, 'expected hexadecimal character'); - } - } - - state.result += charFromCodepoint(hexResult); - - state.position++; - - } else { - throwError(state, 'unknown escape sequence'); - } - - captureStart = captureEnd = state.position; - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a double quoted scalar'); - } - - function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _lineStart, - _pos, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = Object.create(null), - keyNode, - keyTag, - valueNode, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(++state.position); - - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } else if (ch === 0x2C/* , */) { - // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 - throwError(state, "expected the node content, but found ','"); - } - - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; - - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } - - _line = state.line; // Save the current line. - _lineStart = state.lineStart; - _pos = state.position; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } - - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); - } else { - _result.push(keyNode); - } - - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } - - throwError(state, 'unexpected end of the stream within a flow collection'); - } - - function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } - - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } - - } else { - break; - } - } - - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } - - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; - - ch = state.input.charCodeAt(state.position); - - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } - - if (is_EOL(ch)) { - emptyLines++; - continue; - } - - // End of the scalar. - if (state.lineIndent < textIndent) { - - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } - - // Break this `while` cycle and go to the funciton's epilogue. - break; - } - - // Folded style: use fancy rules to handle line breaks. - if (folding) { - - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); - - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } - - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } - - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } - - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; - - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, state.position, false); - } - - return true; - } - - function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; - - // there is a leading tab before this token, so it can't be a block sequence/mapping; - // it can still be flow sequence/mapping or a scalar - if (state.firstTabInLine !== -1) return false; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - if (state.firstTabInLine !== -1) { - state.position = state.firstTabInLine; - throwError(state, 'tab characters must not be used in indentation'); - } - - if (ch !== 0x2D/* - */) { - break; - } - - following = state.input.charCodeAt(state.position + 1); - - if (!is_WS_OR_EOL(following)) { - break; - } - - detected = true; - state.position++; - - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; - } - - function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _keyLine, - _keyLineStart, - _keyPos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = Object.create(null), - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; - - // there is a leading tab before this token, so it can't be a block sequence/mapping; - // it can still be flow sequence/mapping or a scalar - if (state.firstTabInLine !== -1) return false; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - if (!atExplicitKey && state.firstTabInLine !== -1) { - state.position = state.firstTabInLine; - throwError(state, 'tab characters must not be used in indentation'); - } - - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { - - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = true; - allowCompact = true; - - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; - - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } - - state.position += 1; - ch = following; - - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else { - _keyLine = state.line; - _keyLineStart = state.lineStart; - _keyPos = state.position; - - if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { - // Neither implicit nor explicit notation. - // Reading is done. Go to the epilogue. - break; - } - - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); - - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); - - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } - - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - } - - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (atExplicitKey) { - _keyLine = state.line; - _keyLineStart = state.lineStart; - _keyPos = state.position; - } - - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } - - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - } - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - // - // Epilogue. - // - - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - } - - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; - } - - return detected; - } - - function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x21/* ! */) return false; - - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } - - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); - - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - - } else { - tagHandle = '!'; - } - - _position = state.position; - - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); - - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); - - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } - - ch = state.input.charCodeAt(++state.position); - } - - tagName = state.input.slice(_position, state.position); - - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); - } - } - - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } - - try { - tagName = decodeURIComponent(tagName); - } catch (err) { - throwError(state, 'tag name is malformed: ' + tagName); - } - - if (isVerbatim) { - state.tag = tagName; - - } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - - } else if (tagHandle === '!') { - state.tag = '!' + tagName; - - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; - - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } - - return true; - } - - function readAnchorProperty(state) { - var _position, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x26/* & */) return false; - - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } - - state.anchor = state.input.slice(_position, state.position); - return true; - } - - function readAlias(state) { - var _position, alias, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x2A/* * */) return false; - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } - - alias = state.input.slice(_position, state.position); - - if (!_hasOwnProperty$1.call(state.anchorMap, alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } - - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; - } - - function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } - - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; - - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } - - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } - - blockIndent = state.position - state.lineStart; - - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; - - } else if (readAlias(state)) { - hasContent = true; - - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } - - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; - - if (state.tag === null) { - state.tag = '?'; - } - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } - - if (state.tag === null) { - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - - } else if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "! [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); - } - - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; - - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (state.tag !== '!') { - if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; - } else { - // looking for multi type - type = null; - typeList = state.typeMap.multi[state.kind || 'fallback']; - - for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { - if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { - type = typeList[typeIndex]; - break; - } - } - } - - if (!type) { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } - - if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result, state.tag); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } - - if (state.listener !== null) { - state.listener('close', state); - } - return state.tag !== null || state.anchor !== null || hasContent; - } - - function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; - - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = Object.create(null); - state.anchorMap = Object.create(null); - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } - - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; - - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } - - if (is_EOL(ch)) break; - - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveArgs.push(state.input.slice(_position, state.position)); - } - - if (ch !== 0) readLineBreak(state); - - if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } - } - - skipSeparationSpace(state, true, -1); - - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } - - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); - - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } - - state.documents.push(state.result); - - if (state.position === state.lineStart && testDocumentSeparator(state)) { - - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; - } - - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } - } - - - function loadDocuments(input, options) { - input = String(input); - options = options || {}; - - if (input.length !== 0) { - - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; - } - - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } - - var state = new State$1(input, options); - - var nullpos = input.indexOf('\0'); - - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } - - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; - - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } - - while (state.position < (state.length - 1)) { - readDocument(state); - } - - return state.documents; - } - - - function loadAll$1(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - var documents = loadDocuments(input, options); - - if (typeof iterator !== 'function') { - return documents; - } - - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } - } - - - function load$1(input, options) { - var documents = loadDocuments(input, options); - - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new exception('expected a single document in the stream, but found more'); - } - - - var loadAll_1 = loadAll$1; - var load_1 = load$1; - - var loader = { - loadAll: loadAll_1, - load: load_1 - }; - - /*eslint-disable no-use-before-define*/ - - - - - - var _toString = Object.prototype.toString; - var _hasOwnProperty = Object.prototype.hasOwnProperty; - - var CHAR_BOM = 0xFEFF; - var CHAR_TAB = 0x09; /* Tab */ - var CHAR_LINE_FEED = 0x0A; /* LF */ - var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ - var CHAR_SPACE = 0x20; /* Space */ - var CHAR_EXCLAMATION = 0x21; /* ! */ - var CHAR_DOUBLE_QUOTE = 0x22; /* " */ - var CHAR_SHARP = 0x23; /* # */ - var CHAR_PERCENT = 0x25; /* % */ - var CHAR_AMPERSAND = 0x26; /* & */ - var CHAR_SINGLE_QUOTE = 0x27; /* ' */ - var CHAR_ASTERISK = 0x2A; /* * */ - var CHAR_COMMA = 0x2C; /* , */ - var CHAR_MINUS = 0x2D; /* - */ - var CHAR_COLON = 0x3A; /* : */ - var CHAR_EQUALS = 0x3D; /* = */ - var CHAR_GREATER_THAN = 0x3E; /* > */ - var CHAR_QUESTION = 0x3F; /* ? */ - var CHAR_COMMERCIAL_AT = 0x40; /* @ */ - var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ - var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ - var CHAR_GRAVE_ACCENT = 0x60; /* ` */ - var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ - var CHAR_VERTICAL_LINE = 0x7C; /* | */ - var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - - var ESCAPE_SEQUENCES = {}; - - ESCAPE_SEQUENCES[0x00] = '\\0'; - ESCAPE_SEQUENCES[0x07] = '\\a'; - ESCAPE_SEQUENCES[0x08] = '\\b'; - ESCAPE_SEQUENCES[0x09] = '\\t'; - ESCAPE_SEQUENCES[0x0A] = '\\n'; - ESCAPE_SEQUENCES[0x0B] = '\\v'; - ESCAPE_SEQUENCES[0x0C] = '\\f'; - ESCAPE_SEQUENCES[0x0D] = '\\r'; - ESCAPE_SEQUENCES[0x1B] = '\\e'; - ESCAPE_SEQUENCES[0x22] = '\\"'; - ESCAPE_SEQUENCES[0x5C] = '\\\\'; - ESCAPE_SEQUENCES[0x85] = '\\N'; - ESCAPE_SEQUENCES[0xA0] = '\\_'; - ESCAPE_SEQUENCES[0x2028] = '\\L'; - ESCAPE_SEQUENCES[0x2029] = '\\P'; - - var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' - ]; - - var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; - - function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; - - if (map === null) return {}; - - result = {}; - keys = Object.keys(map); - - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); - - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); - } - type = schema.compiledTypeMap['fallback'][tag]; - - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; - } - - result[tag] = style; - } - - return result; - } - - function encodeHex(character) { - var string, handle, length; - - string = character.toString(16).toUpperCase(); - - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); - } - - return '\\' + handle + common.repeat('0', length - string.length) + string; - } - - - var QUOTING_TYPE_SINGLE = 1, - QUOTING_TYPE_DOUBLE = 2; - - function State(options) { - this.schema = options['schema'] || _default; - this.indent = Math.max(1, (options['indent'] || 2)); - this.noArrayIndent = options['noArrayIndent'] || false; - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; - this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; - this.forceQuotes = options['forceQuotes'] || false; - this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; - - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; - - this.tag = null; - this.result = ''; - - this.duplicates = []; - this.usedDuplicates = null; - } - - // Indents every line in a string. Empty lines (\n only) are not indented. - function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; - - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } - - if (line.length && line !== '\n') result += ind; - - result += line; - } - - return result; - } - - function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); - } - - function testImplicitResolving(state, str) { - var index, length, type; - - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; - - if (type.resolve(str)) { - return true; - } - } - - return false; - } - - // [33] s-white ::= s-space | s-tab - function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; - } - - // Returns true if the character can be printed without escaping. - // From YAML 1.2: "any allowed characters known to be non-printable - // should also be escaped. [However,] This isn’t mandatory" - // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. - function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) - || (0x10000 <= c && c <= 0x10FFFF); - } - - // [34] ns-char ::= nb-char - s-white - // [27] nb-char ::= c-printable - b-char - c-byte-order-mark - // [26] b-char ::= b-line-feed | b-carriage-return - // Including s-white (for some reason, examples doesn't match specs in this aspect) - // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark - function isNsCharOrWhitespace(c) { - return isPrintable(c) - && c !== CHAR_BOM - // - b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; - } - - // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out - // c = flow-in ⇒ ns-plain-safe-in - // c = block-key ⇒ ns-plain-safe-out - // c = flow-key ⇒ ns-plain-safe-in - // [128] ns-plain-safe-out ::= ns-char - // [129] ns-plain-safe-in ::= ns-char - c-flow-indicator - // [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) - // | ( /* An ns-char preceding */ “#” ) - // | ( “:” /* Followed by an ns-plain-safe(c) */ ) - function isPlainSafe(c, prev, inblock) { - var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); - var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); - return ( - // ns-plain-safe - inblock ? // c = flow-in - cIsNsCharOrWhitespace - : cIsNsCharOrWhitespace - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - ) - // ns-plain-char - && c !== CHAR_SHARP // false on '#' - && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' - || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' - || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' - } - - // Simplified test for values allowed as the first character in plain style. - function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part - return isPrintable(c) && c !== CHAR_BOM - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_EQUALS - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE - // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; - } - - // Simplified test for values allowed as the last character in plain style. - function isPlainSafeLast(c) { - // just not whitespace or colon, it will be checked to be plain character later - return !isWhitespace(c) && c !== CHAR_COLON; - } - - // Same as 'string'.codePointAt(pos), but works in older browsers. - function codePointAt(string, pos) { - var first = string.charCodeAt(pos), second; - if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { - second = string.charCodeAt(pos + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - return first; - } - - // Determines whether block indentation indicator is required. - function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); - } - - var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; - - // Determines which scalar styles are possible and returns the preferred style. - // lineWidth = -1 => no limit. - // Pre-conditions: str.length > 0. - // Post-conditions: - // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. - // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). - // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). - function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, - testAmbiguousType, quotingType, forceQuotes, inblock) { - - var i; - var char = 0; - var prevChar = null; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(codePointAt(string, 0)) - && isPlainSafeLast(codePointAt(string, string.length - 1)); - - if (singleLineOnly || forceQuotes) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char, prevChar, inblock); - prevChar = char; - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; - } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char, prevChar, inblock); - prevChar = char; - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - if (plain && !forceQuotes && !testAmbiguousType(string)) { - return STYLE_PLAIN; - } - return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; - } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - if (!forceQuotes) { - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; - } - return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; - } - - // Note: line breaking/folding is implemented for only the folded style. - // NB. We drop the last trailing newline (if any) of a returned block scalar - // since the dumper adds its own newline. This always works: - // • No ending newline => unaffected; already using strip "-" chomping. - // • Ending newline => removed then restored. - // Importantly, this keeps the "+" chomp indicator from gaining an extra line. - function writeScalar(state, string, level, iskey, inblock) { - state.dump = (function () { - if (string.length === 0) { - return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; - } - if (!state.noCompatMode) { - if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { - return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); - } - } - - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); - - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } - - switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, - testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { - - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); - case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); - case STYLE_DOUBLE: - return '"' + escapeString(string) + '"'; - default: - throw new exception('impossible error: invalid scalar style'); - } - }()); - } - - // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. - function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; - - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); - - return indentIndicator + chomp + '\n'; - } - - // (See the note for writeScalar.) - function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; - } - - // Note: a long line without a suitable break point will exceed the width limit. - // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. - function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; - - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; - - // rest of the lines - var match; - while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; - } - - return result; - } - - // Greedy line breaking. - // Picks the longest line under the limit each time, - // otherwise settles for the shortest line over the limit. - // NB. More-indented lines *cannot* be folded, as that would add an extra \n. - function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; - - // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; - // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; - - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } - - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); - } else { - result += line.slice(start); - } - - return result.slice(1); // drop extra \n joiner - } - - // Escapes a double-quoted string. - function escapeString(string) { - var result = ''; - var char = 0; - var escapeSeq; - - for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - escapeSeq = ESCAPE_SEQUENCES[char]; - - if (!escapeSeq && isPrintable(char)) { - result += string[i]; - if (char >= 0x10000) result += string[i + 1]; - } else { - result += escapeSeq || encodeHex(char); - } - } - - return result; - } - - function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length, - value; - - for (index = 0, length = object.length; index < length; index += 1) { - value = object[index]; - - if (state.replacer) { - value = state.replacer.call(object, String(index), value); - } - - // Write only valid elements, put null instead of invalid elements. - if (writeNode(state, level, value, false, false) || - (typeof value === 'undefined' && - writeNode(state, level, null, false, false))) { - - if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = '[' + _result + ']'; - } - - function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length, - value; - - for (index = 0, length = object.length; index < length; index += 1) { - value = object[index]; - - if (state.replacer) { - value = state.replacer.call(object, String(index), value); - } - - // Write only valid elements, put null instead of invalid elements. - if (writeNode(state, level + 1, value, true, true, false, true) || - (typeof value === 'undefined' && - writeNode(state, level + 1, null, true, true, false, true))) { - - if (!compact || _result !== '') { - _result += generateNextLine(state, level); - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; - } else { - _result += '- '; - } - - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. - } - - function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - - pairBuffer = ''; - if (_result !== '') pairBuffer += ', '; - - if (state.condenseFlow) pairBuffer += '"'; - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (state.replacer) { - objectValue = state.replacer.call(object, objectKey, objectValue); - } - - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } - - if (state.dump.length > 1024) pairBuffer += '? '; - - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); - - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = '{' + _result + '}'; - } - - function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; - - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new exception('sortKeys must be a boolean or a function'); - } - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; - - if (!compact || _result !== '') { - pairBuffer += generateNextLine(state, level); - } - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (state.replacer) { - objectValue = state.replacer.call(object, objectKey, objectValue); - } - - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } - - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); - - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } - - pairBuffer += state.dump; - - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } - - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; - } else { - pairBuffer += ': '; - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. - } - - function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; - - typeList = explicit ? state.explicitTypes : state.implicitTypes; - - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; - - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { - - if (explicit) { - if (type.multi && type.representName) { - state.tag = type.representName(object); - } else { - state.tag = type.tag; - } - } else { - state.tag = '?'; - } - - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; - - if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } - - state.dump = _result; - } - - return true; - } - } - - return false; - } - - // Serializes `object` and writes it to global `result`. - // Returns true on success, or false on invalid object. - // - function writeNode(state, level, object, block, compact, iskey, isblockseq) { - state.tag = null; - state.dump = object; - - if (!detectType(state, object, false)) { - detectType(state, object, true); - } - - var type = _toString.call(state.dump); - var inblock = block; - var tagStr; - - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } - - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; - - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } - - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } - - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object Array]') { - if (block && (state.dump.length !== 0)) { - if (state.noArrayIndent && !isblockseq && level > 0) { - writeBlockSequence(state, level - 1, state.dump, compact); - } else { - writeBlockSequence(state, level, state.dump, compact); - } - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowSequence(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey, inblock); - } - } else if (type === '[object Undefined]') { - return false; - } else { - if (state.skipInvalid) return false; - throw new exception('unacceptable kind of an object to dump ' + type); - } - - if (state.tag !== null && state.tag !== '?') { - // Need to encode all characters except those allowed by the spec: - // - // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ - // [36] ns-hex-digit ::= ns-dec-digit - // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ - // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ - // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” - // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” - // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” - // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” - // - // Also need to encode '!' because it has special meaning (end of tag prefix). - // - tagStr = encodeURI( - state.tag[0] === '!' ? state.tag.slice(1) : state.tag - ).replace(/!/g, '%21'); - - if (state.tag[0] === '!') { - tagStr = '!' + tagStr; - } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { - tagStr = '!!' + tagStr.slice(18); - } else { - tagStr = '!<' + tagStr + '>'; - } - - state.dump = tagStr + ' ' + state.dump; - } - } - - return true; - } - - function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; - - inspectNode(object, objects, duplicatesIndexes); - - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); - } - - function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; - - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); - - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); - } - } else { - objectKeyList = Object.keys(object); - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); - } - } - } - } - } - - function dump$1(input, options) { - options = options || {}; - - var state = new State(options); - - if (!state.noRefs) getDuplicateReferences(input, state); - - var value = input; - - if (state.replacer) { - value = state.replacer.call({ '': value }, '', value); - } - - if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; - - return ''; - } - - var dump_1 = dump$1; - - var dumper = { - dump: dump_1 - }; - - function renamed(from, to) { - return function () { - throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + - 'Use yaml.' + to + ' instead, which is now safe by default.'); - }; - } - - - var Type = type; - var Schema = schema; - var FAILSAFE_SCHEMA = failsafe; - var JSON_SCHEMA = json; - var CORE_SCHEMA = core; - var DEFAULT_SCHEMA = _default; - var load = loader.load; - var loadAll = loader.loadAll; - var dump = dumper.dump; - var YAMLException = exception; - - // Re-export all types in case user wants to create custom schema - var types = { - binary: binary, - float: float, - map: map, - null: _null, - pairs: pairs, - set: set, - timestamp: timestamp, - bool: bool, - int: int, - merge: merge, - omap: omap, - seq: seq, - str: str - }; - - // Removed functions from JS-YAML 3.0.x - var safeLoad = renamed('safeLoad', 'load'); - var safeLoadAll = renamed('safeLoadAll', 'loadAll'); - var safeDump = renamed('safeDump', 'dump'); - - var jsYaml = { - Type: Type, - Schema: Schema, - FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, - JSON_SCHEMA: JSON_SCHEMA, - CORE_SCHEMA: CORE_SCHEMA, - DEFAULT_SCHEMA: DEFAULT_SCHEMA, - load: load, - loadAll: loadAll, - dump: dump, - YAMLException: YAMLException, - types: types, - safeLoad: safeLoad, - safeLoadAll: safeLoadAll, - safeDump: safeDump - }; - - exports.CORE_SCHEMA = CORE_SCHEMA; - exports.DEFAULT_SCHEMA = DEFAULT_SCHEMA; - exports.FAILSAFE_SCHEMA = FAILSAFE_SCHEMA; - exports.JSON_SCHEMA = JSON_SCHEMA; - exports.Schema = Schema; - exports.Type = Type; - exports.YAMLException = YAMLException; - exports["default"] = jsYaml; - exports.dump = dump; - exports.load = load; - exports.loadAll = loadAll; - exports.safeDump = safeDump; - exports.safeLoad = safeLoad; - exports.safeLoadAll = safeLoadAll; - exports.types = types; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/dist/js-yaml.min.js b/dist/js-yaml.min.js deleted file mode 100644 index 8e7f7664..00000000 --- a/dist/js-yaml.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jsyaml={})}(this,function(e){"use strict";function t(e){return null==e}var n={isNothing:t,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:t(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;nl&&(t=i-l+(o=" ... ").length),n-i>l&&(n=i+l-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function l(e,t){return n.repeat(" ",t-e.length)+e}var c=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var i,r=/\r?\n|\r|\0/g,o=[0],c=[],s=-1;i=r.exec(e.buffer);)c.push(i.index),o.push(i.index+i[0].length),e.position<=i.index&&s<0&&(s=o.length-2);s<0&&(s=o.length-1);var u,p,f="",d=Math.min(e.line+t.linesAfter,c.length).toString().length,h=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(s-u<0);u++)p=a(e.buffer,o[s-u],c[s-u],e.position-(o[s]-o[s-u]),h),f=n.repeat(" ",t.indent)+l((e.line-u+1).toString(),d)+" | "+p.str+"\n"+f;for(p=a(e.buffer,o[s],c[s],e.position,h),f+=n.repeat(" ",t.indent)+l((e.line+1).toString(),d)+" | "+p.str+"\n",f+=n.repeat("-",t.indent+d+3+p.pos)+"^\n",u=1;u<=t.linesAfter&&!(s+u>=c.length);u++)p=a(e.buffer,o[s+u],c[s+u],e.position-(o[s]-o[s+u]),h),f+=n.repeat(" ",t.indent)+l((e.line+u+1).toString(),d)+" | "+p.str+"\n";return f.replace(/\n$/,"")},s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],u=["scalar","sequence","mapping"];var p=function(e,t){if(t=t||{},Object.keys(t).forEach(function(t){if(-1===s.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach(function(n){e[n].forEach(function(e){t[String(e)]=n})}),t}(t.styleAliases||null),-1===u.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function f(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)}),n[t]=e}),n}function d(e){return this.extend(e)}d.prototype.extend=function(e){var t=[],n=[];if(e instanceof p)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new o("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach(function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new o("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(d.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=f(i,"implicit"),i.compiledExplicit=f(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),I=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var S=/^[-+]?[0-9]+e/;var O=new p("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!I.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var i;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";return i=e.toString(10),S.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"}),j=b.extend({implicit:[A,v,x,O]}),T=j,N=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),F=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var E=new p("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==N.exec(e)||null!==F.exec(e))},construct:function(e){var t,n,i,r,o,a,l,c,s=0,u=null;if(null===(t=N.exec(e))&&(t=F.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],l=+t[6],t[7]){for(s=t[7].slice(0,3);s.length<3;)s+="0";s=+s}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,i,r,o,a,l,s)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var M=new p("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var _=new p("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=L;for(n=0;n64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=L,a=0,l=[];for(t=0;t>16&255),l.push(a>>8&255),l.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)):18===n?(l.push(a>>10&255),l.push(a>>2&255)):12===n&&l.push(a>>4&255),new Uint8Array(l)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=L;for(t=0;t>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),D=Object.prototype.hasOwnProperty,U=Object.prototype.toString;var q=new p("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],l=e;for(t=0,n=l.length;t>10),56320+(e-65536&1023))}function ae(e,t,n){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var le=new Array(256),ce=new Array(256),se=0;se<256;se++)le[se]=re(se)?1:0,ce[se]=re(se);function ue(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||P,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function pe(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=c(n),new o(t,n)}function fe(e,t){throw pe(e,t)}function de(e,t){e.onWarning&&e.onWarning.call(null,pe(e,t))}var he={YAML:function(e,t,n){var i,r,o;null!==e.version&&fe(e,"duplication of %YAML directive"),1!==n.length&&fe(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&fe(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&fe(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&de(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&fe(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],V.test(i)||fe(e,"ill-formed tag handle (first argument) of the TAG directive"),W.call(e.tagMap,i)&&fe(e,'there is a previously declared suffix for "'+i+'" tag handle'),Z.test(r)||fe(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){fe(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function ge(e,t,n,i){var r,o,a,l;if(t1&&(e.result+=n.repeat("\n",t-1))}function ke(e,t){var n,i,r=e.tag,o=e.anchor,a=[],l=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,fe(e,"tab characters must not be used in indentation")),45===i)&&X(e.input.charCodeAt(e.position+1));)if(l=!0,e.position++,Ae(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,Ie(e,t,3,!1,!0),a.push(e.result),Ae(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)fe(e,"bad indentation of a sequence entry");else if(e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt)&&(y&&(a=e.line,l=e.lineStart,c=e.position),Ie(e,t,4,!0,r)&&(y?g=e.result:m=e.result),y||(ye(e,f,d,h,g,m,a,l,c),h=g=m=null),Ae(e,!0,-1),s=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==s)fe(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===o?fe(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?fe(e,"repeat of an indentation width identifier"):(u=t+o-1,s=!0)}if(z(a)){do{a=e.input.charCodeAt(++e.position)}while(z(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!Q(a)&&0!==a)}for(;0!==a;){for(be(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!s||e.lineIndentu&&(u=e.lineIndent),Q(a))p++;else{if(e.lineIndent0){for(r=a,o=0;r>0;r--)(a=te(l=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:fe(e,"expected hexadecimal character");e.result+=oe(o),e.position++}else fe(e,"unknown escape sequence");n=i=e.position}else Q(l)?(ge(e,n,i,!0),we(e,Ae(e,!1,t)),n=i=e.position):e.position===e.lineStart&&ve(e)?fe(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}fe(e,"unexpected end of the stream within a double quoted scalar")}(e,d)?y=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!X(i)&&!ee(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&fe(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),W.call(e.anchorMap,n)||fe(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Ae(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,l,c,s,u,p=e.kind,f=e.result;if(X(u=e.input.charCodeAt(e.position))||ee(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(X(i=e.input.charCodeAt(e.position+1))||n&&ee(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(X(i=e.input.charCodeAt(e.position+1))||n&&ee(i))break}else if(35===u){if(X(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&ve(e)||n&&ee(u))break;if(Q(u)){if(l=e.line,c=e.lineStart,s=e.lineIndent,Ae(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=l,e.lineStart=c,e.lineIndent=s;break}}a&&(ge(e,r,o,!1),we(e,e.line-l),r=o=e.position,a=!1),z(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return ge(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,d,1===i)&&(y=!0,null===e.tag&&(e.tag="?")):(y=!0,null===e.tag&&null===e.anchor||fe(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===g&&(y=c&&ke(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&fe(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,u=e.implicitTypes.length;s"),null!==e.result&&f.kind!==e.kind&&fe(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):fe(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function Se(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(Ae(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!X(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&fe(e,"directive name must not be less than one character in length");0!==r;){for(;z(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!Q(r));break}if(Q(r))break;for(t=e.position;0!==r&&!X(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&be(e),W.call(he,n)?he[n](e,n,i):de(e,'unknown document directive "'+n+'"')}Ae(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,Ae(e,!0,-1)):a&&fe(e,"directives end mark is expected"),Ie(e,e.lineIndent-1,4,!1,!0),Ae(e,!0,-1),e.checkLineBreaks&&$.test(e.input.slice(o,e.position))&&de(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&ve(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,Ae(e,!0,-1)):e.position=55296&&i<=56319&&t+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function We(e){return/^\n* /.test(e)}function He(e,t,n,i,r,o,a,l){var c,s,u=0,p=null,f=!1,d=!1,h=-1!==i,g=-1,m=Re(s=Pe(e,0))&&s!==Fe&&!Ye(s)&&45!==s&&63!==s&&58!==s&&44!==s&&91!==s&&93!==s&&123!==s&&125!==s&&35!==s&&38!==s&&42!==s&&33!==s&&124!==s&&61!==s&&62!==s&&39!==s&&34!==s&&37!==s&&64!==s&&96!==s&&function(e){return!Ye(e)&&58!==e}(Pe(e,e.length-1));if(t||a)for(c=0;c=65536?c+=2:c++){if(!Re(u=Pe(e,c)))return 5;m=m&&Ke(u,p,l),p=u}else{for(c=0;c=65536?c+=2:c++){if(10===(u=Pe(e,c)))f=!0,h&&(d=d||c-g-1>i&&" "!==e[g+1],g=c);else if(!Re(u))return 5;m=m&&Ke(u,p,l),p=u}d=d||h&&c-g-1>i&&" "!==e[g+1]}return f||d?n>9&&We(e)?5:a?2===o?5:2:d?4:3:!m||a||r(e)?2===o?5:2:1}function $e(e,t,n,i,r){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Me.indexOf(t)||Le.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),l=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=i||e.flowLevel>-1&&n>=e.flowLevel;switch(He(t,c,e.indent,l,function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+Ge(t,e.indent)+Ve(Ue(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(l=e.indexOf("\n"),l=-1!==l?l:e.length,r.lastIndex=l,Ze(e.slice(0,l),t)),a="\n"===e[0]||" "===e[0];var l;for(;i=r.exec(e);){var c=i[1],s=i[2];n=" "===s[0],o+=c+(a||n||""===s?"":"\n")+Ze(s,t),a=n}return o}(t,l),a));case 5:return'"'+function(e){for(var t,n="",i=0,r=0;r=65536?r+=2:r++)i=Pe(e,r),!(t=Ee[i])&&Re(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=t||_e(i);return n}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function Ge(e,t){var n=We(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function Ve(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Ze(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,l=0,c="";n=r.exec(e);)(l=n.index)-o>t&&(i=a>o?a:l,c+="\n"+e.slice(o,i),o=i+1),a=l;return c+="\n",e.length-o>t&&a>o?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function Je(e,t,n,i){var r,o,a,l="",c=e.tag;for(r=0,o=n.length;r tag resolver accepts not "'+s+'" style');i=c.represent[s](t,s)}e.dump=i}return!0}return!1}function ze(e,t,n,i,r,a,l){e.tag=null,e.dump=n,Qe(e,n,!1)||Qe(e,n,!0);var c,s=Te.call(e.dump),u=i;i&&(i=e.flowLevel<0||e.flowLevel>t);var p,f,d="[object Object]"===s||"[object Array]"===s;if(d&&(f=-1!==(p=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||f||2!==e.indent&&t>0)&&(r=!1),f&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(d&&f&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),"[object Object]"===s)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,a,l,c,s,u,p="",f=e.tag,d=Object.keys(n);if(!0===e.sortKeys)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(r=0,a=d.length;r1024)&&(e.dump&&10===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,s&&(u+=qe(e,t)),ze(e,t+1,c,!0,s)&&(e.dump&&10===e.dump.charCodeAt(0)?u+=":":u+=": ",p+=u+=e.dump));e.tag=f,e.dump=p||"{}"}(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a,l,c="",s=e.tag,u=Object.keys(n);for(i=0,r=u.length;i1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),ze(e,t,a,!1,!1)&&(c+=l+=e.dump));e.tag=s,e.dump="{"+c+"}"}(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump));else if("[object Array]"===s)i&&0!==e.dump.length?(e.noArrayIndent&&!l&&t>0?Je(e,t-1,e.dump,r):Je(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a="",l=e.tag;for(i=0,r=n.length;i",e.dump=c+" "+e.dump)}return!0}function Xe(e,t){var n,i,r=[],o=[];for(et(e,r,o),n=0,i=o.length;n maxHalfLength) { - head = ' ... '; - lineStart = position - maxHalfLength + head.length; - } - - if (lineEnd - position > maxHalfLength) { - tail = ' ...'; - lineEnd = position + maxHalfLength - tail.length; - } - - return { - str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, - pos: position - lineStart + head.length // relative position - }; -} - - -function padStart(string, max) { - return common.repeat(' ', max - string.length) + string; -} - - -function makeSnippet(mark, options) { - options = Object.create(options || null); - - if (!mark.buffer) return null; - - if (!options.maxLength) options.maxLength = 79; - if (typeof options.indent !== 'number') options.indent = 1; - if (typeof options.linesBefore !== 'number') options.linesBefore = 3; - if (typeof options.linesAfter !== 'number') options.linesAfter = 2; - - var re = /\r?\n|\r|\0/g; - var lineStarts = [ 0 ]; - var lineEnds = []; - var match; - var foundLineNo = -1; - - while ((match = re.exec(mark.buffer))) { - lineEnds.push(match.index); - lineStarts.push(match.index + match[0].length); - - if (mark.position <= match.index && foundLineNo < 0) { - foundLineNo = lineStarts.length - 2; - } - } - - if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; - - var result = '', i, line; - var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; - var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); - - for (i = 1; i <= options.linesBefore; i++) { - if (foundLineNo - i < 0) break; - line = getLine( - mark.buffer, - lineStarts[foundLineNo - i], - lineEnds[foundLineNo - i], - mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), - maxLineLength - ); - result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n' + result; - } - - line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); - result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n'; - result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; - - for (i = 1; i <= options.linesAfter; i++) { - if (foundLineNo + i >= lineEnds.length) break; - line = getLine( - mark.buffer, - lineStarts[foundLineNo + i], - lineEnds[foundLineNo + i], - mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), - maxLineLength - ); - result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n'; - } - - return result.replace(/\n$/, ''); -} - - -var snippet = makeSnippet; - -var TYPE_CONSTRUCTOR_OPTIONS = [ - 'kind', - 'multi', - 'resolve', - 'construct', - 'instanceOf', - 'predicate', - 'represent', - 'representName', - 'defaultStyle', - 'styleAliases' -]; - -var YAML_NODE_KINDS = [ - 'scalar', - 'sequence', - 'mapping' -]; - -function compileStyleAliases(map) { - var result = {}; - - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } - - return result; -} - -function Type$1(tag, options) { - options = options || {}; - - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); - } - }); - - // TODO: Add tag format check. - this.options = options; // keep original options in case user wants to extend this type later - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.representName = options['representName'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.multi = options['multi'] || false; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } -} - -var type = Type$1; - -/*eslint-disable max-len*/ - - - - - -function compileList(schema, name) { - var result = []; - - schema[name].forEach(function (currentType) { - var newIndex = result.length; - - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && - previousType.kind === currentType.kind && - previousType.multi === currentType.multi) { - - newIndex = previousIndex; - } - }); - - result[newIndex] = currentType; - }); - - return result; -} - - -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {}, - multi: { - scalar: [], - sequence: [], - mapping: [], - fallback: [] - } - }, index, length; - - function collectType(type) { - if (type.multi) { - result.multi[type.kind].push(type); - result.multi['fallback'].push(type); - } else { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; - } - } - - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } - return result; -} - - -function Schema$1(definition) { - return this.extend(definition); -} - - -Schema$1.prototype.extend = function extend(definition) { - var implicit = []; - var explicit = []; - - if (definition instanceof type) { - // Schema.extend(type) - explicit.push(definition); - - } else if (Array.isArray(definition)) { - // Schema.extend([ type1, type2, ... ]) - explicit = explicit.concat(definition); - - } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { - // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) - if (definition.implicit) implicit = implicit.concat(definition.implicit); - if (definition.explicit) explicit = explicit.concat(definition.explicit); - - } else { - throw new exception('Schema.extend argument should be a Type, [ Type ], ' + - 'or a schema definition ({ implicit: [...], explicit: [...] })'); - } - - implicit.forEach(function (type$1) { - if (!(type$1 instanceof type)) { - throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - - if (type$1.loadKind && type$1.loadKind !== 'scalar') { - throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - - if (type$1.multi) { - throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); - } - }); - - explicit.forEach(function (type$1) { - if (!(type$1 instanceof type)) { - throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - }); - - var result = Object.create(Schema$1.prototype); - - result.implicit = (this.implicit || []).concat(implicit); - result.explicit = (this.explicit || []).concat(explicit); - - result.compiledImplicit = compileList(result, 'implicit'); - result.compiledExplicit = compileList(result, 'explicit'); - result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); - - return result; -}; - - -var schema = Schema$1; - -var str = new type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); - -var seq = new type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); - -var map = new type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); - -var failsafe = new schema({ - explicit: [ - str, - seq, - map - ] -}); - -function resolveYamlNull(data) { - if (data === null) return true; - - var max = data.length; - - return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); -} - -function constructYamlNull() { - return null; -} - -function isNull(object) { - return object === null; -} - -var _null = new type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; }, - empty: function () { return ''; } - }, - defaultStyle: 'lowercase' -}); - -function resolveYamlBoolean(data) { - if (data === null) return false; - - var max = data.length; - - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} - -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} - -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} - -var bool = new type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); - -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); -} - -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); -} - -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); -} - -function resolveYamlInteger(data) { - if (data === null) return false; - - var max = data.length, - index = 0, - hasDigits = false, - ch; - - if (!max) return false; - - ch = data[index]; - - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; - } - - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; - - // base 2, base 8, base 16 - - if (ch === 'b') { - // base 2 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - - if (ch === 'x') { - // base 16 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - - - if (ch === 'o') { - // base 8 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; - } - } - - // base 10 (except 0) - - // value should not start with `_`; - if (ch === '_') return false; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - hasDigits = true; - } - - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; - - return true; -} - -function constructYamlInteger(data) { - var value = data, sign = 1, ch; - - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); - } - - ch = value[0]; - - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } - - if (value === '0') return 0; - - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); - if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); - } - - return sign * parseInt(value, 10); -} - -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); -} - -var int = new type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); - -var YAML_FLOAT_PATTERN = new RegExp( - // 2.5e4, 2.5 and integers - '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + - // .2e4, .2 - // special case, seems not from spec - '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + - // .inf - '|[-+]?\\.(?:inf|Inf|INF)' + - // .nan - '|\\.(?:nan|NaN|NAN))$'); - -function resolveYamlFloat(data) { - if (data === null) return false; - - if (!YAML_FLOAT_PATTERN.test(data) || - // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; - } - - return true; -} - -function constructYamlFloat(data) { - var value, sign; - - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } - - if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - - } else if (value === '.nan') { - return NaN; - } - return sign * parseFloat(value, 10); -} - - -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - -function representYamlFloat(object, style) { - var res; - - if (isNaN(object)) { - switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } - - res = object.toString(10); - - // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack - - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; -} - -function isFloat(object) { - return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); -} - -var float = new type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); - -var json = failsafe.extend({ - implicit: [ - _null, - bool, - int, - float - ] -}); - -var core = json; - -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day - -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute - -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; -} - -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - - if (match === null) throw new Error('Date resolve error'); - - // match: [1] year [2] month [3] day - - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); - - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); - } - - // match: [4] hour [5] minute [6] second [7] fraction - - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); - - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; - } - fraction = +fraction; - } - - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; - } - - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - - if (delta) date.setTime(date.getTime() - delta); - - return date; -} - -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); -} - -var timestamp = new type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); - -function resolveYamlMerge(data) { - return data === '<<' || data === null; -} - -var merge = new type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); - -/*eslint-disable no-bitwise*/ - - - - - -// [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - - -function resolveYamlBinary(data) { - if (data === null) return false; - - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; - - // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); - - // Skip CR/LF - if (code > 64) continue; - - // Fail on illegal characters - if (code < 0) return false; - - bitlen += 6; - } - - // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; -} - -function constructYamlBinary(data) { - var idx, tailbits, - input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; - - // Collect by 6*4 bits (3 bytes) - - for (idx = 0; idx < max; idx++) { - if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } - - bits = (bits << 6) | map.indexOf(input.charAt(idx)); - } - - // Dump tail - - tailbits = (max % 4) * 6; - - if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); - } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); - } - - return new Uint8Array(result); -} - -function representYamlBinary(object /*, style*/) { - var result = '', bits = 0, idx, tail, - max = object.length, - map = BASE64_MAP; - - // Convert every three bytes to 4 ASCII characters. - - for (idx = 0; idx < max; idx++) { - if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } - - bits = (bits << 8) + object[idx]; - } - - // Dump tail - - tail = max % 3; - - if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; - } - - return result; -} - -function isBinary(obj) { - return Object.prototype.toString.call(obj) === '[object Uint8Array]'; -} - -var binary = new type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); - -var _hasOwnProperty$3 = Object.prototype.hasOwnProperty; -var _toString$2 = Object.prototype.toString; - -function resolveYamlOmap(data) { - if (data === null) return true; - - var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; - - if (_toString$2.call(pair) !== '[object Object]') return false; - - for (pairKey in pair) { - if (_hasOwnProperty$3.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; - } - } - - if (!pairHasKey) return false; - - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; - } - - return true; -} - -function constructYamlOmap(data) { - return data !== null ? data : []; -} - -var omap = new type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); - -var _toString$1 = Object.prototype.toString; - -function resolveYamlPairs(data) { - if (data === null) return true; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - if (_toString$1.call(pair) !== '[object Object]') return false; - - keys = Object.keys(pair); - - if (keys.length !== 1) return false; - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return true; -} - -function constructYamlPairs(data) { - if (data === null) return []; - - var index, length, pair, keys, result, - object = data; - - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - - keys = Object.keys(pair); - - result[index] = [ keys[0], pair[keys[0]] ]; - } - - return result; -} - -var pairs = new type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); - -var _hasOwnProperty$2 = Object.prototype.hasOwnProperty; - -function resolveYamlSet(data) { - if (data === null) return true; - - var key, object = data; - - for (key in object) { - if (_hasOwnProperty$2.call(object, key)) { - if (object[key] !== null) return false; - } - } - - return true; -} - -function constructYamlSet(data) { - return data !== null ? data : {}; -} - -var set = new type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); - -var _default = core.extend({ - implicit: [ - timestamp, - merge - ], - explicit: [ - binary, - omap, - pairs, - set - ] -}); - -/*eslint-disable max-len,no-use-before-define*/ - - - - - - - -var _hasOwnProperty$1 = Object.prototype.hasOwnProperty; - - -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; - - -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; - - -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - - -function _class(obj) { return Object.prototype.toString.call(obj); } - -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); -} - -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); -} - -function is_WS_OR_EOL(c) { - return (c === 0x09/* Tab */) || - (c === 0x20/* Space */) || - (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); -} - -function is_FLOW_INDICATOR(c) { - return c === 0x2C/* , */ || - c === 0x5B/* [ */ || - c === 0x5D/* ] */ || - c === 0x7B/* { */ || - c === 0x7D/* } */; -} - -function fromHexCode(c) { - var lc; - - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - /*eslint-disable no-bitwise*/ - lc = c | 0x20; - - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; - } - - return -1; -} - -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; -} - -function fromDecimalCode(c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; - } - - return -1; -} - -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; -} - -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } - // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - return String.fromCharCode( - ((c - 0x010000) >> 10) + 0xD800, - ((c - 0x010000) & 0x03FF) + 0xDC00 - ); -} - -// set a property of a literal object, while protecting against prototype pollution, -// see https://github.com/nodeca/js-yaml/issues/164 for more details -function setProperty(object, key, value) { - // used for this specific key only because Object.defineProperty is slow - if (key === '__proto__') { - Object.defineProperty(object, key, { - configurable: true, - enumerable: true, - writable: true, - value: value - }); - } else { - object[key] = value; - } -} - -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} - - -function State$1(input, options) { - this.input = input; - - this.filename = options['filename'] || null; - this.schema = options['schema'] || _default; - this.onWarning = options['onWarning'] || null; - // (Hidden) Remove? makes the loader to expect YAML 1.1 documents - // if such documents have no explicit %YAML directive - this.legacy = options['legacy'] || false; - - this.json = options['json'] || false; - this.listener = options['listener'] || null; - - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; - - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; - - // position of first leading tab in the current line, - // used to make sure there are no tabs in the indentation - this.firstTabInLine = -1; - - this.documents = []; - - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ - -} - - -function generateError(state, message) { - var mark = { - name: state.filename, - buffer: state.input.slice(0, -1), // omit trailing \0 - position: state.position, - line: state.line, - column: state.position - state.lineStart - }; - - mark.snippet = snippet(mark); - - return new exception(message, mark); -} - -function throwError(state, message) { - throw generateError(state, message); -} - -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } -} - - -var directiveHandlers = { - - YAML: function handleYamlDirective(state, name, args) { - - var match, major, minor; - - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } - - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } - - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); - } - - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } - - state.version = args[0]; - state.checkLineBreaks = (minor < 2); - - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - - TAG: function handleTagDirective(state, name, args) { - - var handle, prefix; - - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } - - handle = args[0]; - prefix = args[1]; - - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - - if (_hasOwnProperty$1.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - - try { - prefix = decodeURIComponent(prefix); - } catch (err) { - throwError(state, 'tag prefix is malformed: ' + prefix); - } - - state.tagMap[handle] = prefix; - } -}; - - -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; - - if (start < end) { - _result = state.input.slice(start, end); - - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } - - state.result += _result; - } -} - -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; - - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } - - sourceKeys = Object.keys(source); - - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; - - if (!_hasOwnProperty$1.call(destination, key)) { - setProperty(destination, key, source[key]); - overridableKeys[key] = true; - } - } -} - -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, - startLine, startLineStart, startPos) { - - var index, quantity; - - // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); - - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { - if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); - } - - if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; - } - } - } - - // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } - - - keyNode = String(keyNode); - - if (_result === null) { - _result = {}; - } - - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && - !_hasOwnProperty$1.call(overridableKeys, keyNode) && - _hasOwnProperty$1.call(_result, keyNode)) { - state.line = startLine || state.line; - state.lineStart = startLineStart || state.lineStart; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); - } - - setProperty(_result, keyNode, valueNode); - delete overridableKeys[keyNode]; - } - - return _result; -} - -function readLineBreak(state) { - var ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x0A/* LF */) { - state.position++; - } else if (ch === 0x0D/* CR */) { - state.position++; - if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } - - state.line += 1; - state.lineStart = state.position; - state.firstTabInLine = -1; -} - -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { - state.firstTabInLine = state.position; - } - ch = state.input.charCodeAt(++state.position); - } - - if (allowComments && ch === 0x23/* # */) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); - } - - if (is_EOL(ch)) { - readLineBreak(state); - - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; - - while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } - - return lineBreaks; -} - -function testDocumentSeparator(state) { - var _position = state.position, - ch; - - ch = state.input.charCodeAt(_position); - - // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && - ch === state.input.charCodeAt(_position + 1) && - ch === state.input.charCodeAt(_position + 2)) { - - _position += 3; - - ch = state.input.charCodeAt(_position); - - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - - return false; -} - -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } -} - - -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; - - ch = state.input.charCodeAt(state.position); - - if (is_WS_OR_EOL(ch) || - is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || - ch === 0x60/* ` */) { - return false; - } - - if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } - - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; - - while (ch !== 0) { - if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } - - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); - - if (is_WS_OR_EOL(preceding)) { - break; - } - - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); - - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } - - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } - - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } - - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, captureEnd, false); - - if (state.result) { - return true; - } - - state.kind = _kind; - state.result = _result; - return false; -} - -function readSingleQuotedScalar(state, nodeIndent) { - var ch, - captureStart, captureEnd; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x27/* ' */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a single quoted scalar'); -} - -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x22/* " */) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - - } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); - - // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; - - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; - - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); - - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; - - } else { - throwError(state, 'expected hexadecimal character'); - } - } - - state.result += charFromCodepoint(hexResult); - - state.position++; - - } else { - throwError(state, 'unknown escape sequence'); - } - - captureStart = captureEnd = state.position; - - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); - - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} - -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _lineStart, - _pos, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = Object.create(null), - keyNode, - keyTag, - valueNode, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; - } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; - } else { - return false; - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(++state.position); - - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } else if (ch === 0x2C/* , */) { - // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 - throwError(state, "expected the node content, but found ','"); - } - - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; - - if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } - - _line = state.line; // Save the current line. - _lineStart = state.lineStart; - _pos = state.position; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } - - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); - } else { - _result.push(keyNode); - } - - skipSeparationSpace(state, true, nodeIndent); - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } - - throwError(state, 'unexpected end of the stream within a flow collection'); -} - -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x7C/* | */) { - folding = false; - } else if (ch === 0x3E/* > */) { - folding = true; - } else { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { - if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } - - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } - - } else { - break; - } - } - - if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); - } - } - - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; - - ch = state.input.charCodeAt(state.position); - - while ((!detectedIndent || state.lineIndent < textIndent) && - (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } - - if (is_EOL(ch)) { - emptyLines++; - continue; - } - - // End of the scalar. - if (state.lineIndent < textIndent) { - - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } - - // Break this `while` cycle and go to the funciton's epilogue. - break; - } - - // Folded style: use fancy rules to handle line breaks. - if (folding) { - - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; - // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - - // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); - - // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; - } - - // Several line breaks - perceive as different lines. - } else { - state.result += common.repeat('\n', emptyLines); - } - - // Literal style: just add exact number of line breaks between content lines. - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } - - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; - - while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, state.position, false); - } - - return true; -} - -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; - - // there is a leading tab before this token, so it can't be a block sequence/mapping; - // it can still be flow sequence/mapping or a scalar - if (state.firstTabInLine !== -1) return false; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - if (state.firstTabInLine !== -1) { - state.position = state.firstTabInLine; - throwError(state, 'tab characters must not be used in indentation'); - } - - if (ch !== 0x2D/* - */) { - break; - } - - following = state.input.charCodeAt(state.position + 1); - - if (!is_WS_OR_EOL(following)) { - break; - } - - detected = true; - state.position++; - - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - return false; -} - -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _keyLine, - _keyLineStart, - _keyPos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = Object.create(null), - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; - - // there is a leading tab before this token, so it can't be a block sequence/mapping; - // it can still be flow sequence/mapping or a scalar - if (state.firstTabInLine !== -1) return false; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - if (!atExplicitKey && state.firstTabInLine !== -1) { - state.position = state.firstTabInLine; - throwError(state, 'tab characters must not be used in indentation'); - } - - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - - // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { - - if (ch === 0x3F/* ? */) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = true; - allowCompact = true; - - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; - - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } - - state.position += 1; - ch = following; - - // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else { - _keyLine = state.line; - _keyLineStart = state.lineStart; - _keyPos = state.position; - - if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { - // Neither implicit nor explicit notation. - // Reading is done. Go to the epilogue. - break; - } - - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); - - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); - - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } - - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - } - - // - // Common reading code for both explicit and implicit notations. - // - if (state.line === _line || state.lineIndent > nodeIndent) { - if (atExplicitKey) { - _keyLine = state.line; - _keyLineStart = state.lineStart; - _keyPos = state.position; - } - - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } - - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; - } - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - } - - if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - // - // Epilogue. - // - - // Special case: last mapping's node contains only the key in explicit notation. - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - } - - // Expose the resulting mapping. - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; - } - - return detected; -} - -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x21/* ! */) return false; - - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } - - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); - - } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - - } else { - tagHandle = '!'; - } - - _position = state.position; - - if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); - - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - - if (ch === 0x21/* ! */) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); - - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } - - ch = state.input.charCodeAt(++state.position); - } - - tagName = state.input.slice(_position, state.position); - - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); - } - } - - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } - - try { - tagName = decodeURIComponent(tagName); - } catch (err) { - throwError(state, 'tag name is malformed: ' + tagName); - } - - if (isVerbatim) { - state.tag = tagName; - - } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - - } else if (tagHandle === '!') { - state.tag = '!' + tagName; - - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; - - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } - - return true; -} - -function readAnchorProperty(state) { - var _position, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x26/* & */) return false; - - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } - - state.anchor = state.input.slice(_position, state.position); - return true; -} - -function readAlias(state) { - var _position, alias, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x2A/* * */) return false; - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } - - alias = state.input.slice(_position, state.position); - - if (!_hasOwnProperty$1.call(state.anchorMap, alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } - - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; -} - -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } - - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; - - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } - - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } - - blockIndent = state.position - state.lineStart; - - if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || - readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || - readSingleQuotedScalar(state, flowIndent) || - readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; - - } else if (readAlias(state)) { - hasContent = true; - - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } - - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; - - if (state.tag === null) { - state.tag = '?'; - } - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } - - if (state.tag === null) { - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - - } else if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "! [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); - } - - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; - - if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - break; - } - } - } else if (state.tag !== '!') { - if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; - } else { - // looking for multi type - type = null; - typeList = state.typeMap.multi[state.kind || 'fallback']; - - for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { - if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { - type = typeList[typeIndex]; - break; - } - } - } - - if (!type) { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } - - if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result, state.tag); - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } - - if (state.listener !== null) { - state.listener('close', state); - } - return state.tag !== null || state.anchor !== null || hasContent; -} - -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; - - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = Object.create(null); - state.anchorMap = Object.create(null); - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); - - ch = state.input.charCodeAt(state.position); - - if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; - } - - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; - - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; - } - - if (is_EOL(ch)) break; - - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveArgs.push(state.input.slice(_position, state.position)); - } - - if (ch !== 0) readLineBreak(state); - - if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } - } - - skipSeparationSpace(state, true, -1); - - if (state.lineIndent === 0 && - state.input.charCodeAt(state.position) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && - state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } - - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); - - if (state.checkLineBreaks && - PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } - - state.documents.push(state.result); - - if (state.position === state.lineStart && testDocumentSeparator(state)) { - - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - return; - } - - if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } -} - - -function loadDocuments(input, options) { - input = String(input); - options = options || {}; - - if (input.length !== 0) { - - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && - input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; - } - - // Strip BOM - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } - - var state = new State$1(input, options); - - var nullpos = input.indexOf('\0'); - - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } - - // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; - - while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; - } - - while (state.position < (state.length - 1)) { - readDocument(state); - } - - return state.documents; -} - - -function loadAll$1(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - var documents = loadDocuments(input, options); - - if (typeof iterator !== 'function') { - return documents; - } - - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } -} - - -function load$1(input, options) { - var documents = loadDocuments(input, options); - - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - throw new exception('expected a single document in the stream, but found more'); -} - - -var loadAll_1 = loadAll$1; -var load_1 = load$1; - -var loader = { - loadAll: loadAll_1, - load: load_1 -}; - -/*eslint-disable no-use-before-define*/ - - - - - -var _toString = Object.prototype.toString; -var _hasOwnProperty = Object.prototype.hasOwnProperty; - -var CHAR_BOM = 0xFEFF; -var CHAR_TAB = 0x09; /* Tab */ -var CHAR_LINE_FEED = 0x0A; /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ -var CHAR_SPACE = 0x20; /* Space */ -var CHAR_EXCLAMATION = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22; /* " */ -var CHAR_SHARP = 0x23; /* # */ -var CHAR_PERCENT = 0x25; /* % */ -var CHAR_AMPERSAND = 0x26; /* & */ -var CHAR_SINGLE_QUOTE = 0x27; /* ' */ -var CHAR_ASTERISK = 0x2A; /* * */ -var CHAR_COMMA = 0x2C; /* , */ -var CHAR_MINUS = 0x2D; /* - */ -var CHAR_COLON = 0x3A; /* : */ -var CHAR_EQUALS = 0x3D; /* = */ -var CHAR_GREATER_THAN = 0x3E; /* > */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - -var ESCAPE_SEQUENCES = {}; - -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; - -var DEPRECATED_BOOLEANS_SYNTAX = [ - 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', - 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; - -var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; - -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; - - if (map === null) return {}; - - result = {}; - keys = Object.keys(map); - - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); - - if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); - } - type = schema.compiledTypeMap['fallback'][tag]; - - if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; - } - - result[tag] = style; - } - - return result; -} - -function encodeHex(character) { - var string, handle, length; - - string = character.toString(16).toUpperCase(); - - if (character <= 0xFF) { - handle = 'x'; - length = 2; - } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; - } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; - } else { - throw new exception('code point within a string may not be greater than 0xFFFFFFFF'); - } - - return '\\' + handle + common.repeat('0', length - string.length) + string; -} - - -var QUOTING_TYPE_SINGLE = 1, - QUOTING_TYPE_DOUBLE = 2; - -function State(options) { - this.schema = options['schema'] || _default; - this.indent = Math.max(1, (options['indent'] || 2)); - this.noArrayIndent = options['noArrayIndent'] || false; - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; - this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; - this.forceQuotes = options['forceQuotes'] || false; - this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; - - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; - - this.tag = null; - this.result = ''; - - this.duplicates = []; - this.usedDuplicates = null; -} - -// Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length; - - while (position < length) { - next = string.indexOf('\n', position); - if (next === -1) { - line = string.slice(position); - position = length; - } else { - line = string.slice(position, next + 1); - position = next + 1; - } - - if (line.length && line !== '\n') result += ind; - - result += line; - } - - return result; -} - -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); -} - -function testImplicitResolving(state, str) { - var index, length, type; - - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; - - if (type.resolve(str)) { - return true; - } - } - - return false; -} - -// [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; -} - -// Returns true if the character can be printed without escaping. -// From YAML 1.2: "any allowed characters known to be non-printable -// should also be escaped. [However,] This isn’t mandatory" -// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) - || (0x10000 <= c && c <= 0x10FFFF); -} - -// [34] ns-char ::= nb-char - s-white -// [27] nb-char ::= c-printable - b-char - c-byte-order-mark -// [26] b-char ::= b-line-feed | b-carriage-return -// Including s-white (for some reason, examples doesn't match specs in this aspect) -// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark -function isNsCharOrWhitespace(c) { - return isPrintable(c) - && c !== CHAR_BOM - // - b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; -} - -// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out -// c = flow-in ⇒ ns-plain-safe-in -// c = block-key ⇒ ns-plain-safe-out -// c = flow-key ⇒ ns-plain-safe-in -// [128] ns-plain-safe-out ::= ns-char -// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator -// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) -// | ( /* An ns-char preceding */ “#” ) -// | ( “:” /* Followed by an ns-plain-safe(c) */ ) -function isPlainSafe(c, prev, inblock) { - var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); - var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); - return ( - // ns-plain-safe - inblock ? // c = flow-in - cIsNsCharOrWhitespace - : cIsNsCharOrWhitespace - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - ) - // ns-plain-char - && c !== CHAR_SHARP // false on '#' - && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' - || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' - || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' -} - -// Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { - // Uses a subset of ns-char - c-indicator - // where ns-char = nb-char - s-white. - // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part - return isPrintable(c) && c !== CHAR_BOM - && !isWhitespace(c) // - s-white - // - (c-indicator ::= - // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_EQUALS - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE - // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; -} - -// Simplified test for values allowed as the last character in plain style. -function isPlainSafeLast(c) { - // just not whitespace or colon, it will be checked to be plain character later - return !isWhitespace(c) && c !== CHAR_COLON; -} - -// Same as 'string'.codePointAt(pos), but works in older browsers. -function codePointAt(string, pos) { - var first = string.charCodeAt(pos), second; - if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { - second = string.charCodeAt(pos + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - return first; -} - -// Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); -} - -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; - -// Determines which scalar styles are possible and returns the preferred style. -// lineWidth = -1 => no limit. -// Pre-conditions: str.length > 0. -// Post-conditions: -// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. -// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). -// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, - testAmbiguousType, quotingType, forceQuotes, inblock) { - - var i; - var char = 0; - var prevChar = null; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly - var plain = isPlainSafeFirst(codePointAt(string, 0)) - && isPlainSafeLast(codePointAt(string, string.length - 1)); - - if (singleLineOnly || forceQuotes) { - // Case: no block styles. - // Check for disallowed characters to rule out plain and single. - for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char, prevChar, inblock); - prevChar = char; - } - } else { - // Case: block styles permitted. - for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - if (char === CHAR_LINE_FEED) { - hasLineBreak = true; - // Check if any line can be folded. - if (shouldTrackWidth) { - hasFoldableLine = hasFoldableLine || - // Foldable line = too long, and not more-indented. - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; - } - } else if (!isPrintable(char)) { - return STYLE_DOUBLE; - } - plain = plain && isPlainSafe(char, prevChar, inblock); - prevChar = char; - } - // in case the end is missing a \n - hasFoldableLine = hasFoldableLine || (shouldTrackWidth && - (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); - } - // Although every style can represent \n without escaping, prefer block styles - // for multiline, since they're more readable and they don't add empty lines. - // Also prefer folding a super-long line. - if (!hasLineBreak && !hasFoldableLine) { - // Strings interpretable as another type have to be quoted; - // e.g. the string 'true' vs. the boolean true. - if (plain && !forceQuotes && !testAmbiguousType(string)) { - return STYLE_PLAIN; - } - return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; - } - // Edge case: block indentation indicator can only have one digit. - if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; - } - // At this point we know block styles are valid. - // Prefer literal style unless we want to fold. - if (!forceQuotes) { - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; - } - return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; -} - -// Note: line breaking/folding is implemented for only the folded style. -// NB. We drop the last trailing newline (if any) of a returned block scalar -// since the dumper adds its own newline. This always works: -// • No ending newline => unaffected; already using strip "-" chomping. -// • Ending newline => removed then restored. -// Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar(state, string, level, iskey, inblock) { - state.dump = (function () { - if (string.length === 0) { - return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; - } - if (!state.noCompatMode) { - if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { - return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); - } - } - - var indent = state.indent * Math.max(1, level); // no 0-indent scalars - // As indentation gets deeper, let the width decrease monotonically - // to the lower bound min(state.lineWidth, 40). - // Note that this implies - // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound. - // state.lineWidth > 40 + state.indent: width decreases until the lower bound. - // This behaves better than a constant minimum width which disallows narrower options, - // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); - - // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey - // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); - } - - switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, - testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { - - case STYLE_PLAIN: - return string; - case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; - case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); - case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); - case STYLE_DOUBLE: - return '"' + escapeString(string) + '"'; - default: - throw new exception('impossible error: invalid scalar style'); - } - }()); -} - -// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; - - // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); - - return indentIndicator + chomp + '\n'; -} - -// (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; -} - -// Note: a long line without a suitable break point will exceed the width limit. -// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { - // In folded style, $k$ consecutive newlines output as $k+1$ newlines— - // unless they're before or after a more-indented line, or at the very - // beginning or end, in which case $k$ maps to $k$. - // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; - - // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); - // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; - - // rest of the lines - var match; - while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; - } - - return result; -} - -// Greedy line breaking. -// Picks the longest line under the limit each time, -// otherwise settles for the shortest line over the limit. -// NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; - - // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; - // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; - - // Invariants: 0 <= start <= length-1. - // 0 <= curr <= next <= max(0, length-2). curr - start <= width. - // Inside the loop: - // A match implies length >= 2, so curr and next are <= length-2. - while ((match = breakRe.exec(line))) { - next = match.index; - // maintain invariant: curr - start <= width - if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); - // skip the space that was output as \n - start = end + 1; // derive start <= length-1 - } - curr = next; - } - - // By the invariants, start <= length-1, so there is something left over. - // It is either the whole string or a part starting from non-whitespace. - result += '\n'; - // Insert a break if the remainder is too long and there is a break available. - if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); - } else { - result += line.slice(start); - } - - return result.slice(1); // drop extra \n joiner -} - -// Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char = 0; - var escapeSeq; - - for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - escapeSeq = ESCAPE_SEQUENCES[char]; - - if (!escapeSeq && isPrintable(char)) { - result += string[i]; - if (char >= 0x10000) result += string[i + 1]; - } else { - result += escapeSeq || encodeHex(char); - } - } - - return result; -} - -function writeFlowSequence(state, level, object) { - var _result = '', - _tag = state.tag, - index, - length, - value; - - for (index = 0, length = object.length; index < length; index += 1) { - value = object[index]; - - if (state.replacer) { - value = state.replacer.call(object, String(index), value); - } - - // Write only valid elements, put null instead of invalid elements. - if (writeNode(state, level, value, false, false) || - (typeof value === 'undefined' && - writeNode(state, level, null, false, false))) { - - if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = '[' + _result + ']'; -} - -function writeBlockSequence(state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length, - value; - - for (index = 0, length = object.length; index < length; index += 1) { - value = object[index]; - - if (state.replacer) { - value = state.replacer.call(object, String(index), value); - } - - // Write only valid elements, put null instead of invalid elements. - if (writeNode(state, level + 1, value, true, true, false, true) || - (typeof value === 'undefined' && - writeNode(state, level + 1, null, true, true, false, true))) { - - if (!compact || _result !== '') { - _result += generateNextLine(state, level); - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; - } else { - _result += '- '; - } - - _result += state.dump; - } - } - - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. -} - -function writeFlowMapping(state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer; - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - - pairBuffer = ''; - if (_result !== '') pairBuffer += ', '; - - if (state.condenseFlow) pairBuffer += '"'; - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (state.replacer) { - objectValue = state.replacer.call(object, objectKey, objectValue); - } - - if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; - } - - if (state.dump.length > 1024) pairBuffer += '? '; - - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); - - if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = '{' + _result + '}'; -} - -function writeBlockMapping(state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer; - - // Allow sorting keys so that the output file is deterministic - if (state.sortKeys === true) { - // Default sorting - objectKeyList.sort(); - } else if (typeof state.sortKeys === 'function') { - // Custom sort function - objectKeyList.sort(state.sortKeys); - } else if (state.sortKeys) { - // Something is wrong - throw new exception('sortKeys must be a boolean or a function'); - } - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; - - if (!compact || _result !== '') { - pairBuffer += generateNextLine(state, level); - } - - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; - - if (state.replacer) { - objectValue = state.replacer.call(object, objectKey, objectValue); - } - - if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. - } - - explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); - - if (explicitPair) { - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; - } else { - pairBuffer += '? '; - } - } - - pairBuffer += state.dump; - - if (explicitPair) { - pairBuffer += generateNextLine(state, level); - } - - if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. - } - - if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; - } else { - pairBuffer += ': '; - } - - pairBuffer += state.dump; - - // Both key and value are valid. - _result += pairBuffer; - } - - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. -} - -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; - - typeList = explicit ? state.explicitTypes : state.implicitTypes; - - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; - - if ((type.instanceOf || type.predicate) && - (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { - - if (explicit) { - if (type.multi && type.representName) { - state.tag = type.representName(object); - } else { - state.tag = type.tag; - } - } else { - state.tag = '?'; - } - - if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; - - if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); - } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); - } else { - throw new exception('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); - } - - state.dump = _result; - } - - return true; - } - } - - return false; -} - -// Serializes `object` and writes it to global `result`. -// Returns true on success, or false on invalid object. -// -function writeNode(state, level, object, block, compact, iskey, isblockseq) { - state.tag = null; - state.dump = object; - - if (!detectType(state, object, false)) { - detectType(state, object, true); - } - - var type = _toString.call(state.dump); - var inblock = block; - var tagStr; - - if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); - } - - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate; - - if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; - } - - if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; - } - - if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; - } else { - if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; - } - if (type === '[object Object]') { - if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowMapping(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object Array]') { - if (block && (state.dump.length !== 0)) { - if (state.noArrayIndent && !isblockseq && level > 0) { - writeBlockSequence(state, level - 1, state.dump, compact); - } else { - writeBlockSequence(state, level, state.dump, compact); - } - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; - } - } else { - writeFlowSequence(state, level, state.dump); - if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; - } - } - } else if (type === '[object String]') { - if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey, inblock); - } - } else if (type === '[object Undefined]') { - return false; - } else { - if (state.skipInvalid) return false; - throw new exception('unacceptable kind of an object to dump ' + type); - } - - if (state.tag !== null && state.tag !== '?') { - // Need to encode all characters except those allowed by the spec: - // - // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */ - // [36] ns-hex-digit ::= ns-dec-digit - // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */ - // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */ - // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-” - // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#” - // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,” - // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]” - // - // Also need to encode '!' because it has special meaning (end of tag prefix). - // - tagStr = encodeURI( - state.tag[0] === '!' ? state.tag.slice(1) : state.tag - ).replace(/!/g, '%21'); - - if (state.tag[0] === '!') { - tagStr = '!' + tagStr; - } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { - tagStr = '!!' + tagStr.slice(18); - } else { - tagStr = '!<' + tagStr + '>'; - } - - state.dump = tagStr + ' ' + state.dump; - } - } - - return true; -} - -function getDuplicateReferences(object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length; - - inspectNode(object, objects, duplicatesIndexes); - - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); - } - state.usedDuplicates = new Array(length); -} - -function inspectNode(object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length; - - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); - if (index !== -1) { - if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); - } - } else { - objects.push(object); - - if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); - } - } else { - objectKeyList = Object.keys(object); - - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); - } - } - } - } -} - -function dump$1(input, options) { - options = options || {}; - - var state = new State(options); - - if (!state.noRefs) getDuplicateReferences(input, state); - - var value = input; - - if (state.replacer) { - value = state.replacer.call({ '': value }, '', value); - } - - if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; - - return ''; -} - -var dump_1 = dump$1; - -var dumper = { - dump: dump_1 -}; - -function renamed(from, to) { - return function () { - throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + - 'Use yaml.' + to + ' instead, which is now safe by default.'); - }; -} - - -var Type = type; -var Schema = schema; -var FAILSAFE_SCHEMA = failsafe; -var JSON_SCHEMA = json; -var CORE_SCHEMA = core; -var DEFAULT_SCHEMA = _default; -var load = loader.load; -var loadAll = loader.loadAll; -var dump = dumper.dump; -var YAMLException = exception; - -// Re-export all types in case user wants to create custom schema -var types = { - binary: binary, - float: float, - map: map, - null: _null, - pairs: pairs, - set: set, - timestamp: timestamp, - bool: bool, - int: int, - merge: merge, - omap: omap, - seq: seq, - str: str -}; - -// Removed functions from JS-YAML 3.0.x -var safeLoad = renamed('safeLoad', 'load'); -var safeLoadAll = renamed('safeLoadAll', 'loadAll'); -var safeDump = renamed('safeDump', 'dump'); - -var jsYaml = { - Type: Type, - Schema: Schema, - FAILSAFE_SCHEMA: FAILSAFE_SCHEMA, - JSON_SCHEMA: JSON_SCHEMA, - CORE_SCHEMA: CORE_SCHEMA, - DEFAULT_SCHEMA: DEFAULT_SCHEMA, - load: load, - loadAll: loadAll, - dump: dump, - YAMLException: YAMLException, - types: types, - safeLoad: safeLoad, - safeLoadAll: safeLoadAll, - safeDump: safeDump -}; - -export { CORE_SCHEMA, DEFAULT_SCHEMA, FAILSAFE_SCHEMA, JSON_SCHEMA, Schema, Type, YAMLException, jsYaml as default, dump, load, loadAll, safeDump, safeLoad, safeLoadAll, types }; From 94a72c80ef654ef88e1e270b8baaaf017d6ec65b Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 00:41:38 +0300 Subject: [PATCH 09/23] Demo: migrate to vite build --- package.json | 11 +++--- support/build_demo.js | 16 --------- support/build_demo.mjs | 18 ++++++++++ .../demo_template/{base64.js => base64.mjs} | 11 ++---- support/demo_template/index.html | 6 ++-- support/demo_template/{demo.js => index.mjs} | 18 +++++----- support/demo_template/rollup.config.js | 15 -------- support/rollup.config.js | 34 ------------------- 8 files changed, 34 insertions(+), 95 deletions(-) delete mode 100644 support/build_demo.js create mode 100644 support/build_demo.mjs rename support/demo_template/{base64.js => base64.mjs} (97%) rename support/demo_template/{demo.js => index.mjs} (83%) delete mode 100644 support/demo_template/rollup.config.js delete mode 100644 support/rollup.config.js diff --git a/package.json b/package.json index 0a6a195a..6175acd4 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "test:build": "npm run build && node --test test/build/*.test.*", "coverage": "npm run build && c8 --include 'lib/**' -r text -r html -r lcov node --test test/core/*.test.*", "build": "node support/build-dist.mjs", - "build:demo": "npm run lint && node support/build_demo.js", + "build:demo": "npm run lint && node support/build_demo.mjs", "gh-demo": "npm run build:demo && gh-pages -d demo -f", "prepack": "npm test && npm run build && npm run build:demo", "postpublish": "npm run gh-demo" @@ -51,17 +51,14 @@ "argparse": "^2.0.1" }, "devDependencies": { - "@rollup/plugin-commonjs": "^17.0.0", - "@rollup/plugin-node-resolve": "^11.0.0", "c8": "^11.0.0", "codemirror": "^5.13.4", "eslint": "^7.0.0", "fast-check": "^2.8.0", "gh-pages": "^3.1.0", - "rollup": "^2.34.1", - "rollup-plugin-node-polyfills": "^0.2.1", - "shelljs": "^0.8.4", "tinybench": "^6.0.2", - "vite": "^8.0.14" + "vite": "^8.0.14", + "vite-plugin-node-polyfills": "^0.28.0", + "vite-plugin-singlefile": "^2.3.3" } } diff --git a/support/build_demo.js b/support/build_demo.js deleted file mode 100644 index 9cd139cd..00000000 --- a/support/build_demo.js +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env node - -'use strict'; - -/* eslint-env es6 */ - -const shell = require('shelljs'); - -shell.rm('-rf', 'demo'); -shell.mkdir('demo'); - -shell.exec('node_modules/.bin/rollup -c support/demo_template/rollup.config.js'); - -shell.cp('support/demo_template/index.html', 'demo/'); -shell.cp('support/demo_template/demo.css', 'demo/'); -shell.cp('node_modules/codemirror/lib/codemirror.css', 'demo/'); diff --git a/support/build_demo.mjs b/support/build_demo.mjs new file mode 100644 index 00000000..41a018c2 --- /dev/null +++ b/support/build_demo.mjs @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +import { build } from 'vite' +import { viteSingleFile } from 'vite-plugin-singlefile' +import { nodePolyfills } from 'vite-plugin-node-polyfills' + +await build({ + root: 'support/demo_template', + configFile: false, + plugins: [ + nodePolyfills({ include: [ 'util' ] }), + viteSingleFile({ removeViteModuleLoader: true }) + ], + build: { + outDir: '../../demo', + emptyOutDir: true + } +}) diff --git a/support/demo_template/base64.js b/support/demo_template/base64.mjs similarity index 97% rename from support/demo_template/base64.js rename to support/demo_template/base64.mjs index c0528ceb..bc7ab373 100644 --- a/support/demo_template/base64.js +++ b/support/demo_template/base64.mjs @@ -23,13 +23,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. - // Based on original artworks of base64 encoder/decoder by [Mozilla][1] // [1]: http://lxr.mozilla.org/mozilla/source/extensions/xml-rpc/src/nsXmlRpcClient.js - -'use strict'; - /* eslint-env browser */ /* eslint-disable no-bitwise */ @@ -105,7 +101,7 @@ function utf8Decode(bytes) { // public api //////////////////////////////////////////////////////////////// -function encode(str) { +export function encode(str) { var result = '', bytes = utf8Encode(str), length = bytes.length, @@ -136,7 +132,7 @@ function encode(str) { return result; } -function decode(data) { +export function decode(data) { var value, code, idx = 0, bytes = [], leftbits = 0, // number of bits decoded, but yet to be appended @@ -175,6 +171,3 @@ function decode(data) { return utf8Decode(bytes); } - -exports.encode = encode; -exports.decode = decode; diff --git a/support/demo_template/index.html b/support/demo_template/index.html index 0528ee1e..5332e9f6 100644 --- a/support/demo_template/index.html +++ b/support/demo_template/index.html @@ -7,10 +7,8 @@ - - - + - - -

JS-YAML demo. YAML JavaScript parser.

+ + +

Edit source here:

- +

Result (JS object dump):

- - diff --git a/support/demo_template/index.mjs b/support/demo_template/index.mjs index f78227de..2bb7c5d4 100644 --- a/support/demo_template/index.mjs +++ b/support/demo_template/index.mjs @@ -3,14 +3,24 @@ import jsyaml from '../../lib/index_vite_proxy.tmp.mjs' import codemirror from 'codemirror' import { inspect } from 'util' -import * as base64 from './base64.mjs' +import default_text from './sample.mjs' import 'codemirror/lib/codemirror.css' import 'codemirror/mode/yaml/yaml.js' import 'codemirror/mode/javascript/javascript.js' import './demo.css' -var source, result, permalink, default_text; +var source, result, permalink; + +function encodeBase64(str) { + return btoa(String.fromCharCode(...new TextEncoder().encode(str))); +} + +function decodeBase64(str) { + return new TextDecoder().decode(Uint8Array.from(atob(str), function (char) { + return char.charCodeAt(0); + })); +} var SexyYamlType = new jsyaml.Type('!sexy', { kind: 'sequence', // See node kinds in YAML spec: http://www.yaml.org/spec/1.2/spec.html#kind// @@ -25,7 +35,7 @@ function parse() { var str, obj; str = source.getValue(); - permalink.href = '#yaml=' + base64.encode(str); + permalink.href = '#yaml=' + encodeBase64(str); try { obj = jsyaml.load(str, { schema: SEXY_SCHEMA }); @@ -42,7 +52,7 @@ function updateSource() { var yaml; if (location.hash && location.hash.toString().slice(0, 6) === '#yaml=') { - yaml = base64.decode(location.hash.slice(6)); + yaml = decodeBase64(location.hash.slice(6)); } source.setValue(yaml || default_text); @@ -50,8 +60,7 @@ function updateSource() { } window.onload = function () { - permalink = document.getElementById('permalink'); - default_text = document.getElementById('source').value || ''; + permalink = document.getElementById('permalink'); source = codemirror.fromTextArea(document.getElementById('source'), { mode: 'yaml', diff --git a/support/demo_template/sample.mjs b/support/demo_template/sample.mjs new file mode 100644 index 00000000..95ca95e5 --- /dev/null +++ b/support/demo_template/sample.mjs @@ -0,0 +1,183 @@ +export default `--- +# Collection Types ############################################################# +################################################################################ + +# http://yaml.org/type/map.html -----------------------------------------------# + +map: + # Unordered set of key: value pairs. + Block style: !!map + Clark : Evans + Ingy : döt Net + Oren : Ben-Kiki + Flow style: !!map { Clark: Evans, Ingy: döt Net, Oren: Ben-Kiki } + +# http://yaml.org/type/omap.html ----------------------------------------------# + +omap: + # Explicitly typed ordered map (dictionary). + Bestiary: !!omap + - aardvark: African pig-like ant eater. Ugly. + - anteater: South-American ant eater. Two species. + - anaconda: South-American constrictor snake. Scaly. + # Etc. + # Flow style + Numbers: !!omap [ one: 1, two: 2, three : 3 ] + +# http://yaml.org/type/pairs.html ---------------------------------------------# + +pairs: + # Explicitly typed pairs. + Block tasks: !!pairs + - meeting: with team. + - meeting: with boss. + - break: lunch. + - meeting: with client. + Flow tasks: !!pairs [ meeting: with team, meeting: with boss ] + +# http://yaml.org/type/set.html -----------------------------------------------# + +set: + # Explicitly typed set. + baseball players: !!set + ? Mark McGwire + ? Sammy Sosa + ? Ken Griffey + # Flow style + baseball teams: !!set { Boston Red Sox, Detroit Tigers, New York Yankees } + +# http://yaml.org/type/seq.html -----------------------------------------------# + +seq: + # Ordered sequence of nodes + Block style: !!seq + - Mercury # Rotates - no light/dark sides. + - Venus # Deadliest. Aptly named. + - Earth # Mostly dirt. + - Mars # Seems empty. + - Jupiter # The king. + - Saturn # Pretty. + - Uranus # Where the sun hardly shines. + - Neptune # Boring. No rings. + - Pluto # You call this a planet? + Flow style: !!seq [ Mercury, Venus, Earth, Mars, # Rocks + Jupiter, Saturn, Uranus, Neptune, # Gas + Pluto ] # Overrated + + +# Scalar Types ################################################################# +################################################################################ + +# http://yaml.org/type/bool.html ----------------------------------------------# + +bool: + - true + - True + - TRUE + - false + - False + - FALSE + +# http://yaml.org/type/float.html ---------------------------------------------# + +float: + canonical: 6.8523015e+5 + exponentioal: 685.230_15e+03 + fixed: 685_230.15 + negative infinity: -.inf + not a number: .NaN + +# http://yaml.org/type/int.html -----------------------------------------------# + +int: + canonical: 685230 + decimal: +685_230 + octal: 0o2472256 + hexadecimal: 0x_0A_74_AE + binary: 0b1010_0111_0100_1010_1110 + +# http://yaml.org/type/merge.html ---------------------------------------------# + +merge: + - &CENTER { x: 1, y: 2 } + - &LEFT { x: 0, y: 2 } + - &BIG { r: 10 } + - &SMALL { r: 1 } + + # All the following maps are equal: + + - # Explicit keys + x: 1 + y: 2 + r: 10 + label: nothing + + - # Merge one map + << : *CENTER + r: 10 + label: center + + - # Merge multiple maps + << : [ *CENTER, *BIG ] + label: center/big + + - # Override + << : [ *BIG, *LEFT, *SMALL ] + x: 1 + label: big/left/small + +# http://yaml.org/type/null.html ----------------------------------------------# + +null: + # This mapping has four keys, + # one has a value. + empty: + canonical: ~ + english: null + ~: null key + # This sequence has five + # entries, two have values. + sparse: + - ~ + - 2nd entry + - + - 4th entry + - Null + +# http://yaml.org/type/str.html -----------------------------------------------# + +string: abcd + +# http://yaml.org/type/timestamp.html -----------------------------------------# + +timestamp: + canonical: 2001-12-15T02:59:43.1Z + valid iso8601: 2001-12-14t21:59:43.10-05:00 + space separated: 2001-12-14 21:59:43.10 -5 + no time zone (Z): 2001-12-15 2:59:43.10 + date (00:00:00Z): 2002-12-14 + + +# Custom types ################################################################# +################################################################################ + + +# JS-YAML allows you to specify a custom YAML types for your structures. +# This is a simple example of custom constructor defined in \`index.mjs\` for +# custom \`!sexy\` type: +# +# var SexyYamlType = new jsyaml.Type('!sexy', { +# kind: 'sequence', +# construct: function (data) { +# return data.map(function (string) { return 'sexy ' + string; }); +# } +# }); +# +# var SEXY_SCHEMA = jsyaml.Schema.create([ SexyYamlType ]); +# +# result = jsyaml.load(yourData, { schema: SEXY_SCHEMA }); + +foobar: !sexy + - bunny + - chocolate +` From 3b0659b2d2d2b50252e5e139e0b3237ff11d25e5 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 02:22:50 +0300 Subject: [PATCH 11/23] Deps bump --- package.json | 6 +++--- test/core/25-dumper-fuzzy.test.js | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 6175acd4..615ded0f 100644 --- a/package.json +++ b/package.json @@ -52,10 +52,10 @@ }, "devDependencies": { "c8": "^11.0.0", - "codemirror": "^5.13.4", + "codemirror": "^5.65.21", "eslint": "^7.0.0", - "fast-check": "^2.8.0", - "gh-pages": "^3.1.0", + "fast-check": "^4.8.0", + "gh-pages": "^6.3.0", "tinybench": "^6.0.2", "vite": "^8.0.14", "vite-plugin-node-polyfills": "^0.28.0", diff --git a/test/core/25-dumper-fuzzy.test.js b/test/core/25-dumper-fuzzy.test.js index aff15496..5fcb53b8 100644 --- a/test/core/25-dumper-fuzzy.test.js +++ b/test/core/25-dumper-fuzzy.test.js @@ -7,7 +7,7 @@ var fc = require('fast-check'); var yaml = require('js-yaml'); // Generate valid YAML instances for yaml.safeDump -var key = fc.string16bits(); +var key = fc.string({ unit: fc.nat({ max: 0xffff }).map(n => String.fromCharCode(n)) }); var values = [ key, fc.boolean(), fc.integer(), fc.double(), fc.constantFrom(null, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) @@ -21,15 +21,15 @@ var dumpOptionsArbitrary = fc.record({ noRefs: fc.boolean(), noCompatMode: fc.boolean(), condenseFlow: fc.boolean(), - indent: fc.integer(1, 80), - flowLevel: fc.integer(-1, 10), + indent: fc.integer({ min: 1, max: 80 }), + flowLevel: fc.integer({ min: -1, max: 10 }), styles: fc.record({ '!!null': fc.constantFrom('lowercase', 'canonical', 'uppercase', 'camelcase'), '!!int': fc.constantFrom('decimal', 'binary', 'octal', 'hexadecimal'), '!!bool': fc.constantFrom('lowercase', 'uppercase', 'camelcase'), '!!float': fc.constantFrom('lowercase', 'uppercase', 'camelcase') - }, { with_deleted_keys: true }) -}, { with_deleted_keys: true }) + }, { requiredKeys: [] }) +}, { requiredKeys: [] }) .map(function (instance) { if (instance.condenseFlow === true && instance.flowLevel !== undefined) { instance.flowLevel = -1; } return instance; From cb027de0741987df22a08c2325d6890fa1f667ee Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 03:38:28 +0300 Subject: [PATCH 12/23] Demo: update twbs & layout --- support/demo_template/demo.css | 59 +++++--------------------------- support/demo_template/index.html | 26 ++++++++------ 2 files changed, 24 insertions(+), 61 deletions(-) diff --git a/support/demo_template/demo.css b/support/demo_template/demo.css index c391c820..c45c4c60 100644 --- a/support/demo_template/demo.css +++ b/support/demo_template/demo.css @@ -1,43 +1,6 @@ -html, body { - height: 100%; -} - -body { - margin: 0 30px; - padding-bottom: 125px; - overflow-x: hidden; -} - -.header { - padding: 1px 0 30px; - white-space: nowrap; - overflow: hidden; - position: relative; -} - -.subheader { - position: absolute; - top: -35px; - width: 100%; -} - -.content { - height: 100%; -} - -#permalink { - float: right; -} - -.src, .dst { - width: 49%; - position: relative; - float: left; - height: 100%; -} - -.dst { - float: right; +.demo-column { + flex: 1 1 0; + min-width: 0; } .src .CodeMirror { @@ -49,29 +12,23 @@ body { .dst .CodeMirror { background-color: #F8F8F8; - border: 1px solid #eee; + border: 1px solid #ddd; border-radius: 3px; } -/*.CodeMirror-scroll { - height: 500px; - line-height: 1.2; -}*/ - .CodeMirror { + flex: 1 1 auto; height: 100%; + min-height: 0; font-size: 13px; } -.CodeMirror .cm-comment { +/* .CodeMirror .cm-comment { color: #baa; -} +} */ .github-link { color: #333; - position: absolute; - right: 0; - top: 18px; } .github-link:hover { color: #000; diff --git a/support/demo_template/index.html b/support/demo_template/index.html index 1f11c8bd..3a1e3949 100644 --- a/support/demo_template/index.html +++ b/support/demo_template/index.html @@ -2,31 +2,37 @@ YAML parser for JavaScript - JS-YAML - + + - + - + -
-

JS-YAML demo. YAML JavaScript parser.

+
+

js-yaml demo

-
-
-

Edit source here:

+
+
+
+ Edit source + +
-
-

Result (JS object dump):

+
+
+ Result (JS object dump) +
From 32ef2bc5c3d805c2110c26e1d2b86f6d17420d03 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 03:48:23 +0300 Subject: [PATCH 13/23] Demo: add link to clear editor content --- support/demo_template/demo.css | 4 ++-- support/demo_template/index.html | 5 ++++- support/demo_template/index.mjs | 9 ++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/support/demo_template/demo.css b/support/demo_template/demo.css index c45c4c60..ca678d5f 100644 --- a/support/demo_template/demo.css +++ b/support/demo_template/demo.css @@ -23,9 +23,9 @@ font-size: 13px; } -/* .CodeMirror .cm-comment { +.CodeMirror .cm-comment { color: #baa; -} */ +} .github-link { color: #333; diff --git a/support/demo_template/index.html b/support/demo_template/index.html index 3a1e3949..b450f6d7 100644 --- a/support/demo_template/index.html +++ b/support/demo_template/index.html @@ -25,7 +25,10 @@

js-yaml demo

Edit source - +
diff --git a/support/demo_template/index.mjs b/support/demo_template/index.mjs index 2bb7c5d4..2821b381 100644 --- a/support/demo_template/index.mjs +++ b/support/demo_template/index.mjs @@ -10,7 +10,7 @@ import 'codemirror/mode/yaml/yaml.js' import 'codemirror/mode/javascript/javascript.js' import './demo.css' -var source, result, permalink; +var source, result, permalink, clear; function encodeBase64(str) { return btoa(String.fromCharCode(...new TextEncoder().encode(str))); @@ -61,6 +61,7 @@ function updateSource() { window.onload = function () { permalink = document.getElementById('permalink'); + clear = document.getElementById('clear'); source = codemirror.fromTextArea(document.getElementById('source'), { mode: 'yaml', @@ -78,6 +79,12 @@ window.onload = function () { readOnly: true }); + clear.addEventListener('click', function (event) { + event.preventDefault(); + source.setValue(''); + parse(); + }); + // initial source updateSource(); }; From 9acc16efcba6b3af746e4de2922edc4ff9f276ba Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 04:53:22 +0300 Subject: [PATCH 14/23] lint => neostandard --- .eslintrc.yml | 138 --------------------------------------------- eslint.config.mjs | 39 +++++++++++++ package.json | 3 +- test/.eslintrc.yml | 9 --- 4 files changed, 41 insertions(+), 148 deletions(-) delete mode 100644 .eslintrc.yml create mode 100644 eslint.config.mjs delete mode 100644 test/.eslintrc.yml diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 03282b9b..00000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,138 +0,0 @@ -env: - node: true - browser: true - es6: false - -globals: - Uint8Array: false - -ignorePatterns: - - coverage/ - - demo/ - - dist/ - - node_modules - - benchmark/implementations - - rollup.config.js - -rules: - accessor-pairs: 2 - array-bracket-spacing: [ 2, "always", { "singleValue": true, "objectsInArrays": true, "arraysInArrays": true } ] - block-scoped-var: 2 - block-spacing: 2 - brace-style: [ 2, '1tbs', { "allowSingleLine": true } ] - #callback-return: 2 - comma-dangle: 2 - comma-spacing: 2 - comma-style: 2 - computed-property-spacing: [ 2, never ] - #consistent-return: 2 - consistent-this: [ 2, self ] - curly: [ 2, 'multi-line' ] - # dot-notation: [ 2, { allowKeywords: true } ] - dot-location: [ 2, 'property' ] - eol-last: 2 - eqeqeq: 2 - func-style: [ 2, declaration ] - guard-for-in: 2 - handle-callback-err: 2 - indent: [ 2, 2, { VariableDeclarator: { var: 2, let: 2, const: 3 }, SwitchCase: 1 } ] - # key-spacing: [ 2, { "align": "value" } ] - keyword-spacing: 2 - linebreak-style: 2 - max-depth: [ 1, 5 ] - max-nested-callbacks: [ 1, 7 ] - # string can exceed 80 chars, but should not overflow github website :) - max-len: [ 2, 120, 1000 ] - new-cap: 2 - new-parens: 2 - no-alert: 2 - no-array-constructor: 2 - no-bitwise: 2 - no-caller: 2 - no-case-declarations: 2 - no-catch-shadow: 2 - no-cond-assign: 2 - no-console: 1 - no-constant-condition: 2 - # no-control-regex: 2 - no-debugger: 1 - no-delete-var: 2 - no-div-regex: 2 - no-dupe-args: 2 - no-dupe-keys: 2 - no-duplicate-case: 2 - no-else-return: 2 - # no-empty: 1 - no-empty-character-class: 2 - no-empty-pattern: 2 - no-eq-null: 2 - no-eval: 2 - no-ex-assign: 2 - no-extend-native: 2 - no-extra-bind: 2 - no-extra-boolean-cast: 2 - no-extra-semi: 2 - no-fallthrough: 2 - no-floating-decimal: 2 - no-func-assign: 2 - no-implied-eval: 2 - no-inner-declarations: 2 - no-invalid-regexp: 2 - no-irregular-whitespace: 2 - no-iterator: 2 - no-labels: 2 - no-label-var: 2 - no-lone-blocks: 1 - no-lonely-if: 2 - no-loop-func: 2 - no-mixed-requires: [ 1, { "grouping": true } ] - no-mixed-spaces-and-tabs: 2 - no-native-reassign: 2 - no-negated-in-lhs: 2 - no-new: 2 - no-new-func: 2 - no-new-object: 2 - no-new-require: 2 - no-new-wrappers: 2 - no-obj-calls: 2 - no-octal: 2 - no-octal-escape: 2 - no-path-concat: 2 - no-proto: 2 - no-redeclare: 2 - # no-regex-spaces: 2 - no-return-assign: 2 - no-self-compare: 2 - no-sequences: 2 - # no-shadow: 2 - no-shadow-restricted-names: 2 - no-sparse-arrays: 2 - no-throw-literal: 2 - no-trailing-spaces: 2 - no-undef: 2 - no-undef-init: 2 - no-undefined: 2 - no-unexpected-multiline: 2 - no-unreachable: 2 - no-unused-expressions: 2 - no-unused-vars: 2 - no-use-before-define: 2 - no-void: 2 - no-with: 2 - object-curly-spacing: [ 2, always, { "objectsInObjects": true, "arraysInObjects": true } ] - operator-assignment: 1 - semi: 2 - semi-spacing: 2 - space-before-blocks: 2 - space-before-function-paren: [ 2, { "anonymous": "always", "named": "never" } ] - space-in-parens: [ 2, never ] - space-infix-ops: 2 - space-unary-ops: 2 - #spaced-comment: [ 1, always, { exceptions: [ '/', '=' ] } ] - strict: [ 2, global ] - quotes: [ 2, single, avoid-escape ] - quote-props: [ 1, 'as-needed' ] - radix: 2 - use-isnan: 2 - valid-typeof: 2 - yoda: [ 2, never, { "exceptRange": true } ] diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..5486d572 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,39 @@ +import neostandard from 'neostandard' + +export default [ + ...neostandard({ + env: ['browser', 'node'], + ignores: [ + 'coverage/**', + 'demo/**', + 'dist/**' + ] + }), + + { + rules: { + camelcase: 'off', + '@stylistic/semi': 'off', + 'no-var': 'off', + '@stylistic/no-multi-spaces': 'off', + '@stylistic/no-multiple-empty-lines': 'off', + '@stylistic/array-bracket-spacing': 'off', + '@stylistic/indent': 'off', + '@stylistic/space-before-function-paren': 'off', + '@stylistic/operator-linebreak': 'off', + '@stylistic/padded-blocks': 'off', + 'one-var': 'off', + '@stylistic/key-spacing': 'off', + 'prefer-const': 'off', + '@stylistic/spaced-comment': 'off', + '@stylistic/multiline-ternary': 'off', + 'no-useless-escape': 'off', + '@stylistic/no-mixed-operators': 'off', + yoda: 'off', + 'object-shorthand': 'off', + 'no-control-regex': 'off', + 'no-unmodified-loop-condition': 'off', + 'no-useless-return': 'off' + } + } +] diff --git a/package.json b/package.json index 615ded0f..5b289fb5 100644 --- a/package.json +++ b/package.json @@ -53,9 +53,10 @@ "devDependencies": { "c8": "^11.0.0", "codemirror": "^5.65.21", - "eslint": "^7.0.0", + "eslint": "^9.39.4", "fast-check": "^4.8.0", "gh-pages": "^6.3.0", + "neostandard": "^0.13.0", "tinybench": "^6.0.2", "vite": "^8.0.14", "vite-plugin-node-polyfills": "^0.28.0", diff --git a/test/.eslintrc.yml b/test/.eslintrc.yml deleted file mode 100644 index 1ca27d93..00000000 --- a/test/.eslintrc.yml +++ /dev/null @@ -1,9 +0,0 @@ -env: - node: true - es6: true - -parserOptions: - ecmaVersion: 2020 - -rules: - no-undefined: 0 From 417749563093a76640c48b9d813999fdfe0ef190 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 05:02:31 +0300 Subject: [PATCH 15/23] lint: fix warnings --- bin/js-yaml.js | 3 --- examples/custom_types.js | 2 -- examples/dumper.js | 2 -- examples/handle_unknown_types.js | 2 -- examples/int_type_override.js | 2 -- examples/sample_document.js | 2 -- lib/dumper.js | 2 -- lib/loader.js | 5 ----- lib/schema.js | 2 -- lib/type/binary.js | 3 --- lib/type/int.js | 1 - support/demo_template/index.mjs | 2 -- test/core/issues/0332.js | 1 - test/core/issues/0468.js | 1 - test/core/issues/0529.js | 2 -- test/core/issues/0586.js | 3 --- test/core/samples-common/construct-binary.js | 2 -- test/core/samples-common/construct-str-utf8.js | 2 -- test/core/units/alias-nodes.js | 1 - 19 files changed, 40 deletions(-) diff --git a/bin/js-yaml.js b/bin/js-yaml.js index a182f1af..5d18f1ea 100755 --- a/bin/js-yaml.js +++ b/bin/js-yaml.js @@ -3,9 +3,6 @@ 'use strict'; -/*eslint-disable no-console*/ - - var fs = require('fs'); var argparse = require('argparse'); var yaml = require('..'); diff --git a/examples/custom_types.js b/examples/custom_types.js index c4fa7471..093be10b 100644 --- a/examples/custom_types.js +++ b/examples/custom_types.js @@ -1,7 +1,5 @@ 'use strict'; -/*eslint-disable no-console*/ - var fs = require('fs'); var path = require('path'); var util = require('util'); diff --git a/examples/dumper.js b/examples/dumper.js index bb42c60c..e7f64c35 100644 --- a/examples/dumper.js +++ b/examples/dumper.js @@ -1,7 +1,5 @@ 'use strict'; -/*eslint-disable no-console*/ - var yaml = require('../'); var object = require('./dumper.json'); diff --git a/examples/handle_unknown_types.js b/examples/handle_unknown_types.js index 6faf7415..f57c0a70 100644 --- a/examples/handle_unknown_types.js +++ b/examples/handle_unknown_types.js @@ -1,7 +1,5 @@ 'use strict'; -/*eslint-disable no-console*/ - const util = require('util'); const yaml = require('../'); diff --git a/examples/int_type_override.js b/examples/int_type_override.js index b495fe49..31c20bbc 100644 --- a/examples/int_type_override.js +++ b/examples/int_type_override.js @@ -4,8 +4,6 @@ 'use strict'; /*global BigInt*/ -/*eslint-disable no-console*/ - const util = require('util'); const yaml = require('../'); diff --git a/examples/sample_document.js b/examples/sample_document.js index 1c707fd9..3b158b24 100644 --- a/examples/sample_document.js +++ b/examples/sample_document.js @@ -1,7 +1,5 @@ 'use strict'; -/*eslint-disable no-console*/ - var fs = require('fs'); var path = require('path'); var util = require('util'); diff --git a/lib/dumper.js b/lib/dumper.js index f357a6ae..d1a98da8 100644 --- a/lib/dumper.js +++ b/lib/dumper.js @@ -1,7 +1,5 @@ 'use strict'; -/*eslint-disable no-use-before-define*/ - var common = require('./common'); var YAMLException = require('./exception'); var DEFAULT_SCHEMA = require('./schema/default'); diff --git a/lib/loader.js b/lib/loader.js index 25abc808..074c5fdf 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -1,7 +1,5 @@ 'use strict'; -/*eslint-disable max-len,no-use-before-define*/ - var common = require('./common'); var YAMLException = require('./exception'); var makeSnippet = require('./snippet'); @@ -61,7 +59,6 @@ function fromHexCode(c) { return c - 0x30; } - /*eslint-disable no-bitwise*/ lc = c | 0x20; if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { @@ -87,7 +84,6 @@ function fromDecimalCode(c) { } function simpleEscapeSequence(c) { - /* eslint-disable indent */ return (c === 0x30/* 0 */) ? '\x00' : (c === 0x61/* a */) ? '\x07' : (c === 0x62/* b */) ? '\x08' : @@ -1720,7 +1716,6 @@ function load(input, options) { var documents = loadDocuments(input, options); if (documents.length === 0) { - /*eslint-disable no-undefined*/ return undefined; } else if (documents.length === 1) { return documents[0]; diff --git a/lib/schema.js b/lib/schema.js index 65b41f40..536f4147 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -1,7 +1,5 @@ 'use strict'; -/*eslint-disable max-len*/ - var YAMLException = require('./exception'); var Type = require('./type'); diff --git a/lib/type/binary.js b/lib/type/binary.js index e1523513..801e1804 100644 --- a/lib/type/binary.js +++ b/lib/type/binary.js @@ -1,8 +1,5 @@ 'use strict'; -/*eslint-disable no-bitwise*/ - - var Type = require('../type'); diff --git a/lib/type/int.js b/lib/type/int.js index 3fe3a443..e4271fc3 100644 --- a/lib/type/int.js +++ b/lib/type/int.js @@ -143,7 +143,6 @@ module.exports = new Type('tag:yaml.org,2002:int', { binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } }, defaultStyle: 'decimal', diff --git a/support/demo_template/index.mjs b/support/demo_template/index.mjs index 2821b381..9415f17d 100644 --- a/support/demo_template/index.mjs +++ b/support/demo_template/index.mjs @@ -1,5 +1,3 @@ -/* eslint-env browser */ - import jsyaml from '../../lib/index_vite_proxy.tmp.mjs' import codemirror from 'codemirror' import { inspect } from 'util' diff --git a/test/core/issues/0332.js b/test/core/issues/0332.js index 51096235..aef3764a 100644 --- a/test/core/issues/0332.js +++ b/test/core/issues/0332.js @@ -29,7 +29,6 @@ it('Should format errors', function () { try { yaml.load('foo:\n bar: 1\na'); } catch (err) { - // eslint-disable-next-line max-len assert.strictEqual(err.toString(), `YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key (4:1) 1 | foo: diff --git a/test/core/issues/0468.js b/test/core/issues/0468.js index 2c9fa730..f4c1e963 100644 --- a/test/core/issues/0468.js +++ b/test/core/issues/0468.js @@ -6,7 +6,6 @@ var assert = require('assert'); var yaml = require('js-yaml'); it('should not indent arrays an extra level when disabled', function () { - /* eslint-disable max-len */ var output = yaml.dump( [ { diff --git a/test/core/issues/0529.js b/test/core/issues/0529.js index a29aa7b1..588c330d 100644 --- a/test/core/issues/0529.js +++ b/test/core/issues/0529.js @@ -2,8 +2,6 @@ const { describe, it } = require('node:test'); -/* eslint-disable max-len */ - const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/issues/0586.js b/test/core/issues/0586.js index a46da1d8..7444834e 100644 --- a/test/core/issues/0586.js +++ b/test/core/issues/0586.js @@ -2,9 +2,6 @@ const { it } = require('node:test'); -/* eslint-disable no-use-before-define, new-cap */ - - const assert = require('assert'); const yaml = require('js-yaml'); diff --git a/test/core/samples-common/construct-binary.js b/test/core/samples-common/construct-binary.js index e862b5ef..afda0649 100644 --- a/test/core/samples-common/construct-binary.js +++ b/test/core/samples-common/construct-binary.js @@ -1,7 +1,5 @@ 'use strict'; -/*eslint-disable max-len*/ - function toTyped(data, encoding) { return new Uint8Array(Buffer.from(data, encoding)); } diff --git a/test/core/samples-common/construct-str-utf8.js b/test/core/samples-common/construct-str-utf8.js index 4b4c895e..a0bb6dab 100644 --- a/test/core/samples-common/construct-str-utf8.js +++ b/test/core/samples-common/construct-str-utf8.js @@ -1,5 +1,3 @@ 'use strict'; -/*eslint-disable max-len*/ - module.exports = '\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430'; diff --git a/test/core/units/alias-nodes.js b/test/core/units/alias-nodes.js index 2eeab6fb..6be3b0ef 100644 --- a/test/core/units/alias-nodes.js +++ b/test/core/units/alias-nodes.js @@ -20,7 +20,6 @@ var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ TestClassYaml ]); describe('Alias nodes', function () { - /* eslint-disable max-len */ describe('Resolving of an alias node should result the resolved and contructed value of the anchored node', function () { it('Simple built-in primitives', function () { assert.strictEqual(yaml.load('[&1 "foobar", *1]')[1], 'foobar'); From a5d6ec681f156fbaa4a895d7c8986cceacbc2224 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 13:58:08 +0300 Subject: [PATCH 16/23] CS: semi, no-multiple-empty-lines, array-bracket-spacing, space-before-function-paren, padded-blocks, spaced-comment --- benchmark/benchmark.mjs | 88 +- benchmark/implementations/current/index.mjs | 6 +- bin/js-yaml.js | 89 +- eslint.config.mjs | 6 - examples/custom_types.js | 76 +- examples/dumper.js | 12 +- examples/handle_unknown_types.js | 48 +- examples/int_type_override.js | 57 +- examples/sample_document.js | 17 +- index.js | 43 +- lib/common.js | 61 +- lib/dumper.js | 723 +++++---- lib/exception.js | 49 +- lib/loader.js | 1291 ++++++++--------- lib/schema.js | 97 +- lib/schema/core.js | 6 +- lib/schema/default.js | 6 +- lib/schema/failsafe.js | 9 +- lib/schema/json.js | 6 +- lib/snippet.js | 91 +- lib/type.js | 56 +- lib/type/binary.js | 100 +- lib/type/bool.js | 28 +- lib/type/float.js | 70 +- lib/type/int.js | 132 +- lib/type/map.js | 8 +- lib/type/merge.js | 10 +- lib/type/null.js | 32 +- lib/type/omap.js | 38 +- lib/type/pairs.js | 44 +- lib/type/seq.js | 8 +- lib/type/set.js | 22 +- lib/type/str.js | 8 +- lib/type/timestamp.js | 68 +- support/build-dist.mjs | 6 +- support/build_demo.mjs | 2 +- support/demo_template/index.mjs | 74 +- test/build/dist.test.js | 78 +- test/core/00-units.test.js | 17 +- test/core/10-loader.test.js | 41 +- test/core/11-load-errors.test.js | 33 +- test/core/20-dumper.test.js | 33 +- test/core/25-dumper-fuzzy.test.js | 34 +- test/core/30-issues.test.js | 17 +- test/core/issues/0008.js | 15 +- test/core/issues/0017.js | 15 +- test/core/issues/0019.js | 15 +- test/core/issues/0026.js | 15 +- test/core/issues/0027.js | 66 +- test/core/issues/0033.js | 17 +- test/core/issues/0046.js | 43 +- test/core/issues/0054.js | 19 +- test/core/issues/0063.js | 27 +- test/core/issues/0064.js | 17 +- test/core/issues/0068.js | 15 +- test/core/issues/0080.js | 39 +- test/core/issues/0085.js | 21 +- test/core/issues/0092.js | 15 +- test/core/issues/0093.js | 19 +- test/core/issues/0095.js | 35 +- test/core/issues/0108.js | 17 +- test/core/issues/0110.js | 37 +- test/core/issues/0112.js | 21 +- test/core/issues/0117.js | 13 +- test/core/issues/0144.js | 13 +- test/core/issues/0154.js | 19 +- test/core/issues/0155.js | 13 +- test/core/issues/0156.js | 22 +- test/core/issues/0160.js | 13 +- test/core/issues/0164.js | 30 +- test/core/issues/0194.js | 23 +- test/core/issues/0203.js | 15 +- test/core/issues/0205.js | 35 +- test/core/issues/0220.js | 19 +- test/core/issues/0221.js | 15 +- test/core/issues/0235.js | 16 +- test/core/issues/0243.js | 57 +- test/core/issues/0248-listener.js | 88 +- test/core/issues/0258.js | 25 +- test/core/issues/0266.js | 20 +- test/core/issues/0301.js | 23 +- test/core/issues/0303.js | 18 +- test/core/issues/0321.js | 21 +- test/core/issues/0332.js | 25 +- test/core/issues/0333.js | 15 +- test/core/issues/0335.js | 15 +- test/core/issues/0342.js | 43 +- test/core/issues/0346.js | 29 +- test/core/issues/0350.js | 15 +- test/core/issues/0351.js | 19 +- test/core/issues/0385.js | 67 +- test/core/issues/0399.js | 25 +- test/core/issues/0403.js | 31 +- test/core/issues/0418.js | 15 +- test/core/issues/0432.js | 33 +- test/core/issues/0468.js | 16 +- test/core/issues/0470.js | 19 +- test/core/issues/0475.js | 31 +- test/core/issues/0519.js | 14 +- test/core/issues/0521.js | 26 +- test/core/issues/0525-1.js | 19 +- test/core/issues/0525-2.js | 19 +- test/core/issues/0529.js | 40 +- test/core/issues/0570.js | 23 +- test/core/issues/0571.js | 98 +- test/core/issues/0576.js | 49 +- test/core/issues/0586.js | 49 +- test/core/issues/0587.js | 13 +- test/core/issues/0614.js | 39 +- test/core/samples-common/construct-binary.js | 8 +- test/core/samples-common/construct-bool.js | 12 +- test/core/samples-common/construct-custom.js | 48 +- test/core/samples-common/construct-float.js | 26 +- test/core/samples-common/construct-int.js | 4 +- test/core/samples-common/construct-map.js | 4 +- test/core/samples-common/construct-merge.js | 4 +- test/core/samples-common/construct-null.js | 4 +- test/core/samples-common/construct-omap.js | 4 +- test/core/samples-common/construct-pairs.js | 16 +- test/core/samples-common/construct-seq.js | 4 +- test/core/samples-common/construct-set.js | 4 +- .../samples-common/construct-str-ascii.js | 4 +- .../core/samples-common/construct-str-utf8.js | 4 +- test/core/samples-common/construct-str.js | 4 +- .../samples-common/construct-string-types.js | 46 +- .../samples-common/construct-timestamp.js | 4 +- test/core/samples-common/construct-value.js | 4 +- .../samples-common/dump-empty-collections.js | 5 +- .../samples-common/duplicate-mapping-key.js | 4 +- .../samples-common/duplicate-merge-key.js | 4 +- ...ting-unacceptable-unicode-character-bug.js | 4 +- .../invalid-single-quote-bug.js | 4 +- test/core/samples-common/more-floats.js | 30 +- .../core/samples-common/negative-float-bug.js | 4 +- .../single-dot-is-not-float-bug.js | 4 +- test/core/samples-common/timestamp-bugs.js | 4 +- test/core/samples-common/utf8-implicit.js | 4 +- .../core/samples-load-errors/duplicate-key.js | 4 +- .../duplicate-value-key.js | 4 +- test/core/support/schema.js | 93 +- test/core/units/alias-nodes.js | 68 +- test/core/units/bom-strip.js | 15 +- test/core/units/character-set.js | 33 +- test/core/units/dump-scalar-styles.js | 215 ++- test/core/units/empty-node-resolving.js | 63 +- test/core/units/is-negative-zero.js | 19 +- test/core/units/loader-parameters.js | 72 +- test/core/units/replacer.js | 231 ++- test/core/units/single-document-error.js | 23 +- test/core/units/skip-invalid.js | 32 +- test/core/units/snippet.js | 37 +- test/core/units/sort-keys.js | 30 +- test/core/units/tagmultikind.js | 32 +- 153 files changed, 3235 insertions(+), 3500 deletions(-) diff --git a/benchmark/benchmark.mjs b/benchmark/benchmark.mjs index a4715fa8..ffd5f638 100755 --- a/benchmark/benchmark.mjs +++ b/benchmark/benchmark.mjs @@ -1,48 +1,48 @@ #!/usr/bin/env node /* eslint no-console:0 */ -import fs from 'node:fs'; -import util from 'node:util'; -import { Bench } from 'tinybench'; +import fs from 'node:fs' +import util from 'node:util' +import { Bench } from 'tinybench' -const IMPLS = []; +const IMPLS = [] for (const name of fs.readdirSync(new URL('./implementations', import.meta.url)).sort()) { - const filepath = new URL(`./implementations/${name}/index.mjs`, import.meta.url); - const code = await import(filepath); + const filepath = new URL(`./implementations/${name}/index.mjs`, import.meta.url) + const code = await import(filepath) - IMPLS.push({ name, code }); + IMPLS.push({ name, code }) } -const SAMPLES = []; +const SAMPLES = [] fs.readdirSync(new URL('./samples', import.meta.url)).sort().forEach(function (sample) { - const filepath = new URL(`./samples/${sample}`, import.meta.url); + const filepath = new URL(`./samples/${sample}`, import.meta.url) - const content = {}; + const content = {} - content.string = fs.readFileSync(filepath, 'utf8'); + content.string = fs.readFileSync(filepath, 'utf8') - const title = `(${content.string.length} bytes)`; + const title = `(${content.string.length} bytes)` - const bench = new Bench({ name: title }); + const bench = new Bench({ name: title }) IMPLS.forEach(function (impl) { - bench.add(impl.name, function () { impl.code.run(content.string); }); - }); + bench.add(impl.name, function () { impl.code.run(content.string) }) + }) - SAMPLES.push({ name: sample.split('.')[0], filename: sample, title, content, bench }); -}); + SAMPLES.push({ name: sample.split('.')[0], filename: sample, title, content, bench }) +}) -function formatNumber(num) { - return num.toLocaleString('en-US', { maximumFractionDigits: 0 }); +function formatNumber (num) { + return num.toLocaleString('en-US', { maximumFractionDigits: 0 }) } -function formatTask(task) { - const result = task.result; +function formatTask (task) { + const result = task.result if (result.state !== 'completed') { - return `${task.name}: ${result.state}`; + return `${task.name}: ${result.state}` } return [ @@ -50,54 +50,54 @@ function formatTask(task) { `${formatNumber(result.throughput.mean)} ops/sec`, `+/-${result.throughput.rme.toFixed(2)}%`, `${result.throughput.samplesCount} samples` - ].join(' '); + ].join(' ') } -function select(patterns) { - const result = []; +function select (patterns) { + const result = [] if (!(patterns instanceof Array)) { - patterns = [ patterns ]; + patterns = [patterns] } - function checkName(name) { + function checkName (name) { return patterns.length === 0 || patterns.some(function (regexp) { - return regexp.test(name); - }); + return regexp.test(name) + }) } SAMPLES.forEach(function (sample) { if (checkName(sample.name)) { - result.push(sample); + result.push(sample) } - }); + }) - return result; + return result } -async function run(files) { - const selected = select(files); +async function run (files) { + const selected = select(files) if (selected.length > 0) { - console.log('Selected samples: (%d of %d)', selected.length, SAMPLES.length); + console.log('Selected samples: (%d of %d)', selected.length, SAMPLES.length) selected.forEach(function (sample) { - console.log(' > %s', sample.name); - }); + console.log(' > %s', sample.name) + }) } else { - console.log('There isn\'t any sample matches any of these patterns: %s', util.inspect(files)); + console.log('There isn\'t any sample matches any of these patterns: %s', util.inspect(files)) } for (const sample of selected) { - console.log('\n\nSample: %s %s', sample.filename, sample.title); + console.log('\n\nSample: %s %s', sample.filename, sample.title) sample.bench.addEventListener('cycle', function (event) { - console.log(' > %s', formatTask(event.task)); - }); + console.log(' > %s', formatTask(event.task)) + }) - await sample.bench.run(); + await sample.bench.run() } } await run(process.argv.slice(2).map(function (source) { - return new RegExp(source, 'i'); -})); + return new RegExp(source, 'i') +})) diff --git a/benchmark/implementations/current/index.mjs b/benchmark/implementations/current/index.mjs index c8176350..55a1bbc1 100644 --- a/benchmark/implementations/current/index.mjs +++ b/benchmark/implementations/current/index.mjs @@ -1,5 +1,5 @@ -import yaml from '../../../index.js'; +import yaml from '../../../index.js' -export function run(data) { - return yaml.load(data); +export function run (data) { + return yaml.load(data) } diff --git a/bin/js-yaml.js b/bin/js-yaml.js index 5d18f1ea..71a567fa 100755 --- a/bin/js-yaml.js +++ b/bin/js-yaml.js @@ -1,30 +1,27 @@ #!/usr/bin/env node +'use strict' -'use strict'; - -var fs = require('fs'); -var argparse = require('argparse'); -var yaml = require('..'); - - -//////////////////////////////////////////////////////////////////////////////// +var fs = require('fs') +var argparse = require('argparse') +var yaml = require('..') +/// ///////////////////////////////////////////////////////////////////////////// var cli = new argparse.ArgumentParser({ prog: 'js-yaml', add_help: true -}); +}) cli.add_argument('-v', '--version', { action: 'version', version: require('../package.json').version -}); +}) cli.add_argument('-c', '--compact', { help: 'Display errors in compact mode', action: 'store_true' -}); +}) // deprecated (not needed after we removed output colors) // option suppressed, but not completely removed for compatibility @@ -32,92 +29,88 @@ cli.add_argument('-j', '--to-json', { help: argparse.SUPPRESS, dest: 'json', action: 'store_true' -}); +}) cli.add_argument('-t', '--trace', { help: 'Show stack trace on error', action: 'store_true' -}); +}) cli.add_argument('file', { help: 'File to read, utf-8 encoded without BOM', nargs: '?', default: '-' -}); - +}) -//////////////////////////////////////////////////////////////////////////////// +/// ///////////////////////////////////////////////////////////////////////////// +var options = cli.parse_args() -var options = cli.parse_args(); +/// ///////////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////////////// - -function readFile(filename, encoding, callback) { +function readFile (filename, encoding, callback) { if (options.file === '-') { // read from stdin - var chunks = []; + var chunks = [] process.stdin.on('data', function (chunk) { - chunks.push(chunk); - }); + chunks.push(chunk) + }) process.stdin.on('end', function () { - return callback(null, Buffer.concat(chunks).toString(encoding)); - }); + return callback(null, Buffer.concat(chunks).toString(encoding)) + }) } else { - fs.readFile(filename, encoding, callback); + fs.readFile(filename, encoding, callback) } } readFile(options.file, 'utf8', function (error, input) { - var output, isYaml; + var output, isYaml if (error) { if (error.code === 'ENOENT') { - console.error('File not found: ' + options.file); - process.exit(2); + console.error('File not found: ' + options.file) + process.exit(2) } console.error( options.trace && error.stack || error.message || - String(error)); + String(error)) - process.exit(1); + process.exit(1) } try { - output = JSON.parse(input); - isYaml = false; + output = JSON.parse(input) + isYaml = false } catch (err) { if (err instanceof SyntaxError) { try { - output = []; - yaml.loadAll(input, function (doc) { output.push(doc); }, {}); - isYaml = true; - - if (output.length === 0) output = null; - else if (output.length === 1) output = output[0]; + output = [] + yaml.loadAll(input, function (doc) { output.push(doc) }, {}) + isYaml = true + if (output.length === 0) output = null + else if (output.length === 1) output = output[0] } catch (e) { - if (options.trace && err.stack) console.error(e.stack); - else console.error(e.toString(options.compact)); + if (options.trace && err.stack) console.error(e.stack) + else console.error(e.toString(options.compact)) - process.exit(1); + process.exit(1) } } else { console.error( options.trace && err.stack || err.message || - String(err)); + String(err)) - process.exit(1); + process.exit(1) } } - if (isYaml) console.log(JSON.stringify(output, null, ' ')); - else console.log(yaml.dump(output)); -}); + if (isYaml) console.log(JSON.stringify(output, null, ' ')) + else console.log(yaml.dump(output)) +}) diff --git a/eslint.config.mjs b/eslint.config.mjs index 5486d572..0c98367b 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -13,19 +13,13 @@ export default [ { rules: { camelcase: 'off', - '@stylistic/semi': 'off', 'no-var': 'off', '@stylistic/no-multi-spaces': 'off', - '@stylistic/no-multiple-empty-lines': 'off', - '@stylistic/array-bracket-spacing': 'off', '@stylistic/indent': 'off', - '@stylistic/space-before-function-paren': 'off', '@stylistic/operator-linebreak': 'off', - '@stylistic/padded-blocks': 'off', 'one-var': 'off', '@stylistic/key-spacing': 'off', 'prefer-const': 'off', - '@stylistic/spaced-comment': 'off', '@stylistic/multiline-ternary': 'off', 'no-useless-escape': 'off', '@stylistic/no-mixed-operators': 'off', diff --git a/examples/custom_types.js b/examples/custom_types.js index 093be10b..87ec74fb 100644 --- a/examples/custom_types.js +++ b/examples/custom_types.js @@ -1,35 +1,32 @@ -'use strict'; - -var fs = require('fs'); -var path = require('path'); -var util = require('util'); -var yaml = require('../'); +'use strict' +var fs = require('fs') +var path = require('path') +var util = require('util') +var yaml = require('../') // Let's define a couple of classes. -function Point(x, y, z) { - this.klass = 'Point'; - this.x = x; - this.y = y; - this.z = z; +function Point (x, y, z) { + this.klass = 'Point' + this.x = x + this.y = y + this.z = z } - -function Space(height, width, points) { +function Space (height, width, points) { if (points) { - if (!points.every(function (point) { return point instanceof Point; })) { - throw new Error('A non-Point inside a points array!'); + if (!points.every(function (point) { return point instanceof Point })) { + throw new Error('A non-Point inside a points array!') } } - this.klass = 'Space'; - this.height = height; - this.width = width; - this.points = points; + this.klass = 'Space' + this.height = height + this.width = width + this.points = points } - // Then define YAML types to load and dump our Point/Space objects. var PointYamlType = new yaml.Type('!point', { @@ -43,12 +40,12 @@ var PointYamlType = new yaml.Type('!point', { // `data` may be either: // - Null in case of an "empty node" (http://www.yaml.org/spec/1.2/spec.html#id2786563) // - Array since we specified `kind` to 'sequence' - return data !== null && data.length === 3; + return data !== null && data.length === 3 }, // If a node is resolved, use it to create a Point instance. construct: function (data) { - return new Point(data[0], data[1], data[2]); + return new Point(data[0], data[1], data[2]) }, // Dumper must process instances of Point by rules of this YAML type. @@ -56,46 +53,43 @@ var PointYamlType = new yaml.Type('!point', { // Dumper must represent Point objects as three-element sequence in YAML. represent: function (point) { - return [ point.x, point.y, point.z ]; + return [point.x, point.y, point.z] } -}); - +}) var SpaceYamlType = new yaml.Type('!space', { kind: 'mapping', construct: function (data) { - data = data || {}; // in case of empty node - return new Space(data.height || 0, data.width || 0, data.points || []); + data = data || {} // in case of empty node + return new Space(data.height || 0, data.width || 0, data.points || []) }, instanceOf: Space // `represent` is omitted here. So, Space objects will be dumped as is. // That is regular mapping with three key-value pairs but with !space tag. -}); - +}) // After our types are defined, it's time to join them into a schema. -var SPACE_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ SpaceYamlType, PointYamlType ]); +var SPACE_SCHEMA = yaml.DEFAULT_SCHEMA.extend([SpaceYamlType, PointYamlType]) // do not execute the following if file is required (http://stackoverflow.com/a/6398335) if (require.main === module) { - // And read a document using that schema. fs.readFile(path.join(__dirname, 'custom_types.yml'), 'utf8', function (error, data) { - var loaded; + var loaded if (!error) { - loaded = yaml.load(data, { schema: SPACE_SCHEMA }); - console.log(util.inspect(loaded, false, 20, true)); + loaded = yaml.load(data, { schema: SPACE_SCHEMA }) + console.log(util.inspect(loaded, false, 20, true)) } else { - console.error(error.stack || error.message || String(error)); + console.error(error.stack || error.message || String(error)) } - }); + }) } // There are some exports to play with this example interactively. -module.exports.Point = Point; -module.exports.Space = Space; -module.exports.PointYamlType = PointYamlType; -module.exports.SpaceYamlType = SpaceYamlType; -module.exports.SPACE_SCHEMA = SPACE_SCHEMA; +module.exports.Point = Point +module.exports.Space = Space +module.exports.PointYamlType = PointYamlType +module.exports.SpaceYamlType = SpaceYamlType +module.exports.SPACE_SCHEMA = SPACE_SCHEMA diff --git a/examples/dumper.js b/examples/dumper.js index e7f64c35..aee5b73b 100644 --- a/examples/dumper.js +++ b/examples/dumper.js @@ -1,8 +1,7 @@ -'use strict'; - -var yaml = require('../'); -var object = require('./dumper.json'); +'use strict' +var yaml = require('../') +var object = require('./dumper.json') console.log(yaml.dump(object, { flowLevel: 3, @@ -10,11 +9,10 @@ console.log(yaml.dump(object, { '!!int' : 'hexadecimal', '!!null' : 'camelcase' } -})); - +})) // Output: -//============================================================================== +//= ============================================================================= // name: Wizzard // level: 0x11 // sanity: Null diff --git a/examples/handle_unknown_types.js b/examples/handle_unknown_types.js index f57c0a70..efc18206 100644 --- a/examples/handle_unknown_types.js +++ b/examples/handle_unknown_types.js @@ -1,52 +1,50 @@ -'use strict'; - -const util = require('util'); -const yaml = require('../'); +'use strict' +const util = require('util') +const yaml = require('../') class CustomTag { - constructor(type, data) { - this.type = type; - this.data = data; + constructor (type, data) { + this.type = type + this.data = data } } - -const tags = [ 'scalar', 'sequence', 'mapping' ].map(function (kind) { +const tags = ['scalar', 'sequence', 'mapping'].map(function (kind) { // first argument here is a prefix, so this type will handle anything starting with ! return new yaml.Type('!', { kind: kind, multi: true, representName: function (object) { - return object.type; + return object.type }, represent: function (object) { - return object.data; + return object.data }, instanceOf: CustomTag, construct: function (data, type) { - return new CustomTag(type, data); + return new CustomTag(type, data) } - }); -}); + }) +}) -const SCHEMA = yaml.DEFAULT_SCHEMA.extend(tags); +const SCHEMA = yaml.DEFAULT_SCHEMA.extend(tags) const data = ` subject: Handling unknown types in JS-YAML scalar: !unknown_scalar_tag foo bar sequence: !unknown_sequence_tag [ 1, 2, 3 ] mapping: !unknown_mapping_tag { foo: 1, bar: 2 } -`; +` -const loaded = yaml.load(data, { schema: SCHEMA }); +const loaded = yaml.load(data, { schema: SCHEMA }) -console.log('Parsed as:'); -console.log('-'.repeat(70)); -console.log(util.inspect(loaded, false, 20, true)); +console.log('Parsed as:') +console.log('-'.repeat(70)) +console.log(util.inspect(loaded, false, 20, true)) -console.log(''); -console.log(''); -console.log('Dumped as:'); -console.log('-'.repeat(70)); -console.log(yaml.dump(loaded, { schema: SCHEMA })); +console.log('') +console.log('') +console.log('Dumped as:') +console.log('-'.repeat(70)) +console.log(yaml.dump(loaded, { schema: SCHEMA })) diff --git a/examples/int_type_override.js b/examples/int_type_override.js index 31c20bbc..ea4675fe 100644 --- a/examples/int_type_override.js +++ b/examples/int_type_override.js @@ -1,57 +1,54 @@ // This example overrides built-in !!int type to return BigInt instead of a Number // -'use strict'; - -/*global BigInt*/ -const util = require('util'); -const yaml = require('../'); +'use strict' +/* global BigInt */ +const util = require('util') +const yaml = require('../') // keep most of the original `int` options as is -let options = Object.assign({}, yaml.types.int.options); +let options = Object.assign({}, yaml.types.int.options) options.construct = data => { - let value = data, sign = 1n, ch; + let value = data, sign = 1n, ch if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); + value = value.replace(/_/g, '') } - ch = value[0]; + ch = value[0] if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1n; - value = value.slice(1); - ch = value[0]; + if (ch === '-') sign = -1n + value = value.slice(1) + ch = value[0] } - return sign * BigInt(value); -}; - + return sign * BigInt(value) +} options.predicate = object => { return Object.prototype.toString.call(object) === '[object BigInt]' || - yaml.types.int.options.predicate(object); -}; - + yaml.types.int.options.predicate(object) +} -let BigIntType = new yaml.Type('tag:yaml.org,2002:int', options); +let BigIntType = new yaml.Type('tag:yaml.org,2002:int', options) -const SCHEMA = yaml.DEFAULT_SCHEMA.extend({ implicit: [ BigIntType ] }); +const SCHEMA = yaml.DEFAULT_SCHEMA.extend({ implicit: [BigIntType] }) const data = ` bigint: -12_345_678_901_234_567_890 -`; +` -const loaded = yaml.load(data, { schema: SCHEMA }); +const loaded = yaml.load(data, { schema: SCHEMA }) -console.log('Parsed as:'); -console.log('-'.repeat(70)); -console.log(util.inspect(loaded, false, 20, true)); +console.log('Parsed as:') +console.log('-'.repeat(70)) +console.log(util.inspect(loaded, false, 20, true)) -console.log(''); -console.log(''); -console.log('Dumped as:'); -console.log('-'.repeat(70)); -console.log(yaml.dump(loaded, { schema: SCHEMA })); +console.log('') +console.log('') +console.log('Dumped as:') +console.log('-'.repeat(70)) +console.log(yaml.dump(loaded, { schema: SCHEMA })) diff --git a/examples/sample_document.js b/examples/sample_document.js index 3b158b24..27984a0e 100644 --- a/examples/sample_document.js +++ b/examples/sample_document.js @@ -1,17 +1,16 @@ -'use strict'; - -var fs = require('fs'); -var path = require('path'); -var util = require('util'); -var yaml = require('../'); +'use strict' +var fs = require('fs') +var path = require('path') +var util = require('util') +var yaml = require('../') try { var filename = path.join(__dirname, 'sample_document.yml'), contents = fs.readFileSync(filename, 'utf8'), - data = yaml.load(contents); + data = yaml.load(contents) - console.log(util.inspect(data, false, 10, true)); + console.log(util.inspect(data, false, 10, true)) } catch (err) { - console.log(err.stack || String(err)); + console.log(err.stack || String(err)) } diff --git a/index.js b/index.js index bcb7eba7..23eed6de 100644 --- a/index.js +++ b/index.js @@ -1,28 +1,25 @@ -'use strict'; +'use strict' +var loader = require('./lib/loader') +var dumper = require('./lib/dumper') -var loader = require('./lib/loader'); -var dumper = require('./lib/dumper'); - - -function renamed(from, to) { +function renamed (from, to) { return function () { throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' + - 'Use yaml.' + to + ' instead, which is now safe by default.'); - }; + 'Use yaml.' + to + ' instead, which is now safe by default.') + } } - -module.exports.Type = require('./lib/type'); -module.exports.Schema = require('./lib/schema'); -module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe'); -module.exports.JSON_SCHEMA = require('./lib/schema/json'); -module.exports.CORE_SCHEMA = require('./lib/schema/core'); -module.exports.DEFAULT_SCHEMA = require('./lib/schema/default'); -module.exports.load = loader.load; -module.exports.loadAll = loader.loadAll; -module.exports.dump = dumper.dump; -module.exports.YAMLException = require('./lib/exception'); +module.exports.Type = require('./lib/type') +module.exports.Schema = require('./lib/schema') +module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe') +module.exports.JSON_SCHEMA = require('./lib/schema/json') +module.exports.CORE_SCHEMA = require('./lib/schema/core') +module.exports.DEFAULT_SCHEMA = require('./lib/schema/default') +module.exports.load = loader.load +module.exports.loadAll = loader.loadAll +module.exports.dump = dumper.dump +module.exports.YAMLException = require('./lib/exception') // Re-export all types in case user wants to create custom schema module.exports.types = { @@ -39,9 +36,9 @@ module.exports.types = { omap: require('./lib/type/omap'), seq: require('./lib/type/seq'), str: require('./lib/type/str') -}; +} // Removed functions from JS-YAML 3.0.x -module.exports.safeLoad = renamed('safeLoad', 'load'); -module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll'); -module.exports.safeDump = renamed('safeDump', 'dump'); +module.exports.safeLoad = renamed('safeLoad', 'load') +module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll') +module.exports.safeDump = renamed('safeDump', 'dump') diff --git a/lib/common.js b/lib/common.js index 25ef7d8e..f360c775 100644 --- a/lib/common.js +++ b/lib/common.js @@ -1,59 +1,52 @@ -'use strict'; +'use strict' - -function isNothing(subject) { - return (typeof subject === 'undefined') || (subject === null); +function isNothing (subject) { + return (typeof subject === 'undefined') || (subject === null) } - -function isObject(subject) { - return (typeof subject === 'object') && (subject !== null); +function isObject (subject) { + return (typeof subject === 'object') && (subject !== null) } +function toArray (sequence) { + if (Array.isArray(sequence)) return sequence + else if (isNothing(sequence)) return [] -function toArray(sequence) { - if (Array.isArray(sequence)) return sequence; - else if (isNothing(sequence)) return []; - - return [ sequence ]; + return [sequence] } - -function extend(target, source) { - var index, length, key, sourceKeys; +function extend (target, source) { + var index, length, key, sourceKeys if (source) { - sourceKeys = Object.keys(source); + sourceKeys = Object.keys(source) for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; + key = sourceKeys[index] + target[key] = source[key] } } - return target; + return target } - -function repeat(string, count) { - var result = '', cycle; +function repeat (string, count) { + var result = '', cycle for (cycle = 0; cycle < count; cycle += 1) { - result += string; + result += string } - return result; + return result } - -function isNegativeZero(number) { - return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number); +function isNegativeZero (number) { + return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number) } - -module.exports.isNothing = isNothing; -module.exports.isObject = isObject; -module.exports.toArray = toArray; -module.exports.repeat = repeat; -module.exports.isNegativeZero = isNegativeZero; -module.exports.extend = extend; +module.exports.isNothing = isNothing +module.exports.isObject = isObject +module.exports.toArray = toArray +module.exports.repeat = repeat +module.exports.isNegativeZero = isNegativeZero +module.exports.extend = extend diff --git a/lib/dumper.js b/lib/dumper.js index d1a98da8..25c27f06 100644 --- a/lib/dumper.js +++ b/lib/dumper.js @@ -1,200 +1,199 @@ -'use strict'; - -var common = require('./common'); -var YAMLException = require('./exception'); -var DEFAULT_SCHEMA = require('./schema/default'); - -var _toString = Object.prototype.toString; -var _hasOwnProperty = Object.prototype.hasOwnProperty; - -var CHAR_BOM = 0xFEFF; -var CHAR_TAB = 0x09; /* Tab */ -var CHAR_LINE_FEED = 0x0A; /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */ -var CHAR_SPACE = 0x20; /* Space */ -var CHAR_EXCLAMATION = 0x21; /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22; /* " */ -var CHAR_SHARP = 0x23; /* # */ -var CHAR_PERCENT = 0x25; /* % */ -var CHAR_AMPERSAND = 0x26; /* & */ -var CHAR_SINGLE_QUOTE = 0x27; /* ' */ -var CHAR_ASTERISK = 0x2A; /* * */ -var CHAR_COMMA = 0x2C; /* , */ -var CHAR_MINUS = 0x2D; /* - */ -var CHAR_COLON = 0x3A; /* : */ -var CHAR_EQUALS = 0x3D; /* = */ -var CHAR_GREATER_THAN = 0x3E; /* > */ -var CHAR_QUESTION = 0x3F; /* ? */ -var CHAR_COMMERCIAL_AT = 0x40; /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */ -var CHAR_GRAVE_ACCENT = 0x60; /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */ -var CHAR_VERTICAL_LINE = 0x7C; /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */ - -var ESCAPE_SEQUENCES = {}; - -ESCAPE_SEQUENCES[0x00] = '\\0'; -ESCAPE_SEQUENCES[0x07] = '\\a'; -ESCAPE_SEQUENCES[0x08] = '\\b'; -ESCAPE_SEQUENCES[0x09] = '\\t'; -ESCAPE_SEQUENCES[0x0A] = '\\n'; -ESCAPE_SEQUENCES[0x0B] = '\\v'; -ESCAPE_SEQUENCES[0x0C] = '\\f'; -ESCAPE_SEQUENCES[0x0D] = '\\r'; -ESCAPE_SEQUENCES[0x1B] = '\\e'; -ESCAPE_SEQUENCES[0x22] = '\\"'; -ESCAPE_SEQUENCES[0x5C] = '\\\\'; -ESCAPE_SEQUENCES[0x85] = '\\N'; -ESCAPE_SEQUENCES[0xA0] = '\\_'; -ESCAPE_SEQUENCES[0x2028] = '\\L'; -ESCAPE_SEQUENCES[0x2029] = '\\P'; +'use strict' + +var common = require('./common') +var YAMLException = require('./exception') +var DEFAULT_SCHEMA = require('./schema/default') + +var _toString = Object.prototype.toString +var _hasOwnProperty = Object.prototype.hasOwnProperty + +var CHAR_BOM = 0xFEFF +var CHAR_TAB = 0x09 /* Tab */ +var CHAR_LINE_FEED = 0x0A /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D /* CR */ +var CHAR_SPACE = 0x20 /* Space */ +var CHAR_EXCLAMATION = 0x21 /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22 /* " */ +var CHAR_SHARP = 0x23 /* # */ +var CHAR_PERCENT = 0x25 /* % */ +var CHAR_AMPERSAND = 0x26 /* & */ +var CHAR_SINGLE_QUOTE = 0x27 /* ' */ +var CHAR_ASTERISK = 0x2A /* * */ +var CHAR_COMMA = 0x2C /* , */ +var CHAR_MINUS = 0x2D /* - */ +var CHAR_COLON = 0x3A /* : */ +var CHAR_EQUALS = 0x3D /* = */ +var CHAR_GREATER_THAN = 0x3E /* > */ +var CHAR_QUESTION = 0x3F /* ? */ +var CHAR_COMMERCIAL_AT = 0x40 /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B /* [ */ +var CHAR_RIGHT_SQUARE_BRACKET = 0x5D /* ] */ +var CHAR_GRAVE_ACCENT = 0x60 /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B /* { */ +var CHAR_VERTICAL_LINE = 0x7C /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D /* } */ + +var ESCAPE_SEQUENCES = {} + +ESCAPE_SEQUENCES[0x00] = '\\0' +ESCAPE_SEQUENCES[0x07] = '\\a' +ESCAPE_SEQUENCES[0x08] = '\\b' +ESCAPE_SEQUENCES[0x09] = '\\t' +ESCAPE_SEQUENCES[0x0A] = '\\n' +ESCAPE_SEQUENCES[0x0B] = '\\v' +ESCAPE_SEQUENCES[0x0C] = '\\f' +ESCAPE_SEQUENCES[0x0D] = '\\r' +ESCAPE_SEQUENCES[0x1B] = '\\e' +ESCAPE_SEQUENCES[0x22] = '\\"' +ESCAPE_SEQUENCES[0x5C] = '\\\\' +ESCAPE_SEQUENCES[0x85] = '\\N' +ESCAPE_SEQUENCES[0xA0] = '\\_' +ESCAPE_SEQUENCES[0x2028] = '\\L' +ESCAPE_SEQUENCES[0x2029] = '\\P' var DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; +] -var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; +var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/ -function compileStyleMap(schema, map) { - var result, keys, index, length, tag, style, type; +function compileStyleMap (schema, map) { + var result, keys, index, length, tag, style, type - if (map === null) return {}; + if (map === null) return {} - result = {}; - keys = Object.keys(map); + result = {} + keys = Object.keys(map) for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index]; - style = String(map[tag]); + tag = keys[index] + style = String(map[tag]) if (tag.slice(0, 2) === '!!') { - tag = 'tag:yaml.org,2002:' + tag.slice(2); + tag = 'tag:yaml.org,2002:' + tag.slice(2) } - type = schema.compiledTypeMap['fallback'][tag]; + type = schema.compiledTypeMap['fallback'][tag] if (type && _hasOwnProperty.call(type.styleAliases, style)) { - style = type.styleAliases[style]; + style = type.styleAliases[style] } - result[tag] = style; + result[tag] = style } - return result; + return result } -function encodeHex(character) { - var string, handle, length; +function encodeHex (character) { + var string, handle, length - string = character.toString(16).toUpperCase(); + string = character.toString(16).toUpperCase() if (character <= 0xFF) { - handle = 'x'; - length = 2; + handle = 'x' + length = 2 } else if (character <= 0xFFFF) { - handle = 'u'; - length = 4; + handle = 'u' + length = 4 } else if (character <= 0xFFFFFFFF) { - handle = 'U'; - length = 8; + handle = 'U' + length = 8 } else { - throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF'); + throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF') } - return '\\' + handle + common.repeat('0', length - string.length) + string; + return '\\' + handle + common.repeat('0', length - string.length) + string } - var QUOTING_TYPE_SINGLE = 1, - QUOTING_TYPE_DOUBLE = 2; - -function State(options) { - this.schema = options['schema'] || DEFAULT_SCHEMA; - this.indent = Math.max(1, (options['indent'] || 2)); - this.noArrayIndent = options['noArrayIndent'] || false; - this.skipInvalid = options['skipInvalid'] || false; - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']); - this.styleMap = compileStyleMap(this.schema, options['styles'] || null); - this.sortKeys = options['sortKeys'] || false; - this.lineWidth = options['lineWidth'] || 80; - this.noRefs = options['noRefs'] || false; - this.noCompatMode = options['noCompatMode'] || false; - this.condenseFlow = options['condenseFlow'] || false; - this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE; - this.forceQuotes = options['forceQuotes'] || false; - this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null; - - this.implicitTypes = this.schema.compiledImplicit; - this.explicitTypes = this.schema.compiledExplicit; - - this.tag = null; - this.result = ''; - - this.duplicates = []; - this.usedDuplicates = null; + QUOTING_TYPE_DOUBLE = 2 + +function State (options) { + this.schema = options['schema'] || DEFAULT_SCHEMA + this.indent = Math.max(1, (options['indent'] || 2)) + this.noArrayIndent = options['noArrayIndent'] || false + this.skipInvalid = options['skipInvalid'] || false + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']) + this.styleMap = compileStyleMap(this.schema, options['styles'] || null) + this.sortKeys = options['sortKeys'] || false + this.lineWidth = options['lineWidth'] || 80 + this.noRefs = options['noRefs'] || false + this.noCompatMode = options['noCompatMode'] || false + this.condenseFlow = options['condenseFlow'] || false + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE + this.forceQuotes = options['forceQuotes'] || false + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null + + this.implicitTypes = this.schema.compiledImplicit + this.explicitTypes = this.schema.compiledExplicit + + this.tag = null + this.result = '' + + this.duplicates = [] + this.usedDuplicates = null } // Indents every line in a string. Empty lines (\n only) are not indented. -function indentString(string, spaces) { +function indentString (string, spaces) { var ind = common.repeat(' ', spaces), position = 0, next = -1, result = '', line, - length = string.length; + length = string.length while (position < length) { - next = string.indexOf('\n', position); + next = string.indexOf('\n', position) if (next === -1) { - line = string.slice(position); - position = length; + line = string.slice(position) + position = length } else { - line = string.slice(position, next + 1); - position = next + 1; + line = string.slice(position, next + 1) + position = next + 1 } - if (line.length && line !== '\n') result += ind; + if (line.length && line !== '\n') result += ind - result += line; + result += line } - return result; + return result } -function generateNextLine(state, level) { - return '\n' + common.repeat(' ', state.indent * level); +function generateNextLine (state, level) { + return '\n' + common.repeat(' ', state.indent * level) } -function testImplicitResolving(state, str) { - var index, length, type; +function testImplicitResolving (state, str) { + var index, length, type for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index]; + type = state.implicitTypes[index] if (type.resolve(str)) { - return true; + return true } } - return false; + return false } // [33] s-white ::= s-space | s-tab -function isWhitespace(c) { - return c === CHAR_SPACE || c === CHAR_TAB; +function isWhitespace (c) { + return c === CHAR_SPACE || c === CHAR_TAB } // Returns true if the character can be printed without escaping. // From YAML 1.2: "any allowed characters known to be non-printable // should also be escaped. [However,] This isn’t mandatory" // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. -function isPrintable(c) { +function isPrintable (c) { return (0x00020 <= c && c <= 0x00007E) || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) - || (0x10000 <= c && c <= 0x10FFFF); + || (0x10000 <= c && c <= 0x10FFFF) } // [34] ns-char ::= nb-char - s-white @@ -202,12 +201,12 @@ function isPrintable(c) { // [26] b-char ::= b-line-feed | b-carriage-return // Including s-white (for some reason, examples doesn't match specs in this aspect) // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark -function isNsCharOrWhitespace(c) { +function isNsCharOrWhitespace (c) { return isPrintable(c) && c !== CHAR_BOM // - b-char && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED; + && c !== CHAR_LINE_FEED } // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out @@ -219,9 +218,9 @@ function isNsCharOrWhitespace(c) { // [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” ) // | ( /* An ns-char preceding */ “#” ) // | ( “:” /* Followed by an ns-plain-safe(c) */ ) -function isPlainSafe(c, prev, inblock) { - var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c); - var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c); +function isPlainSafe (c, prev, inblock) { + var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c) + var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c) return ( // ns-plain-safe inblock ? // c = flow-in @@ -238,11 +237,11 @@ function isPlainSafe(c, prev, inblock) { && c !== CHAR_SHARP // false on '#' && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' - || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]' + || (prev === CHAR_COLON && cIsNsChar) // change to true on ':[^ ]' } // Simplified test for values allowed as the first character in plain style. -function isPlainSafeFirst(c) { +function isPlainSafeFirst (c) { // Uses a subset of ns-char - c-indicator // where ns-char = nb-char - s-white. // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part @@ -271,39 +270,39 @@ function isPlainSafeFirst(c) { // | “%” | “@” | “`”) && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT; + && c !== CHAR_GRAVE_ACCENT } // Simplified test for values allowed as the last character in plain style. -function isPlainSafeLast(c) { +function isPlainSafeLast (c) { // just not whitespace or colon, it will be checked to be plain character later - return !isWhitespace(c) && c !== CHAR_COLON; + return !isWhitespace(c) && c !== CHAR_COLON } // Same as 'string'.codePointAt(pos), but works in older browsers. -function codePointAt(string, pos) { - var first = string.charCodeAt(pos), second; +function codePointAt (string, pos) { + var first = string.charCodeAt(pos), second if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { - second = string.charCodeAt(pos + 1); + second = string.charCodeAt(pos + 1) if (second >= 0xDC00 && second <= 0xDFFF) { // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; + return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000 } } - return first; + return first } // Determines whether block indentation indicator is required. -function needIndentIndicator(string) { - var leadingSpaceRe = /^\n* /; - return leadingSpaceRe.test(string); +function needIndentIndicator (string) { + var leadingSpaceRe = /^\n* / + return leadingSpaceRe.test(string) } var STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, - STYLE_DOUBLE = 5; + STYLE_DOUBLE = 5 // Determines which scalar styles are possible and returns the preferred style. // lineWidth = -1 => no limit. @@ -312,54 +311,53 @@ var STYLE_PLAIN = 1, // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string. // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1). // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). -function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, +function chooseScalarStyle (string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) { - - var i; - var char = 0; - var prevChar = null; - var hasLineBreak = false; - var hasFoldableLine = false; // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1; - var previousLineBreak = -1; // count the first line correctly + var i + var char = 0 + var prevChar = null + var hasLineBreak = false + var hasFoldableLine = false // only checked if shouldTrackWidth + var shouldTrackWidth = lineWidth !== -1 + var previousLineBreak = -1 // count the first line correctly var plain = isPlainSafeFirst(codePointAt(string, 0)) - && isPlainSafeLast(codePointAt(string, string.length - 1)); + && isPlainSafeLast(codePointAt(string, string.length - 1)) if (singleLineOnly || forceQuotes) { // Case: no block styles. // Check for disallowed characters to rule out plain and single. for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); + char = codePointAt(string, i) if (!isPrintable(char)) { - return STYLE_DOUBLE; + return STYLE_DOUBLE } - plain = plain && isPlainSafe(char, prevChar, inblock); - prevChar = char; + plain = plain && isPlainSafe(char, prevChar, inblock) + prevChar = char } } else { // Case: block styles permitted. for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); + char = codePointAt(string, i) if (char === CHAR_LINE_FEED) { - hasLineBreak = true; + hasLineBreak = true // Check if any line can be folded. if (shouldTrackWidth) { hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented. (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' '); - previousLineBreak = i; + string[previousLineBreak + 1] !== ' ') + previousLineBreak = i } } else if (!isPrintable(char)) { - return STYLE_DOUBLE; + return STYLE_DOUBLE } - plain = plain && isPlainSafe(char, prevChar, inblock); - prevChar = char; + plain = plain && isPlainSafe(char, prevChar, inblock) + prevChar = char } // in case the end is missing a \n hasFoldableLine = hasFoldableLine || (shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && - string[previousLineBreak + 1] !== ' ')); + string[previousLineBreak + 1] !== ' ')) } // Although every style can represent \n without escaping, prefer block styles // for multiline, since they're more readable and they don't add empty lines. @@ -368,20 +366,20 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, // Strings interpretable as another type have to be quoted; // e.g. the string 'true' vs. the boolean true. if (plain && !forceQuotes && !testAmbiguousType(string)) { - return STYLE_PLAIN; + return STYLE_PLAIN } - return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE } // Edge case: block indentation indicator can only have one digit. if (indentPerLevel > 9 && needIndentIndicator(string)) { - return STYLE_DOUBLE; + return STYLE_DOUBLE } // At this point we know block styles are valid. // Prefer literal style unless we want to fold. if (!forceQuotes) { - return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; + return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL } - return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE; + return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE } // Note: line breaking/folding is implemented for only the folded style. @@ -390,18 +388,18 @@ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, // • No ending newline => unaffected; already using strip "-" chomping. // • Ending newline => removed then restored. // Importantly, this keeps the "+" chomp indicator from gaining an extra line. -function writeScalar(state, string, level, iskey, inblock) { +function writeScalar (state, string, level, iskey, inblock) { state.dump = (function () { if (string.length === 0) { - return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''"; + return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''" } if (!state.noCompatMode) { if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) { - return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'"); + return state.quotingType === QUOTING_TYPE_DOUBLE ? ('"' + string + '"') : ("'" + string + "'") } } - var indent = state.indent * Math.max(1, level); // no 0-indent scalars + var indent = state.indent * Math.max(1, level) // no 0-indent scalars // As indentation gets deeper, let the width decrease monotonically // to the lower bound min(state.lineWidth, 40). // Note that this implies @@ -410,219 +408,216 @@ function writeScalar(state, string, level, iskey, inblock) { // This behaves better than a constant minimum width which disallows narrower options, // or an indent threshold which causes the width to suddenly increase. var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent); + ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent) // Without knowing if keys are implicit/explicit, assume implicit for safety. var singleLineOnly = iskey // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel); - function testAmbiguity(string) { - return testImplicitResolving(state, string); + || (state.flowLevel > -1 && level >= state.flowLevel) + function testAmbiguity (string) { + return testImplicitResolving(state, string) } switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) { - case STYLE_PLAIN: - return string; + return string case STYLE_SINGLE: - return "'" + string.replace(/'/g, "''") + "'"; + return "'" + string.replace(/'/g, "''") + "'" case STYLE_LITERAL: return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)); + + dropEndingNewline(indentString(string, indent)) case STYLE_FOLDED: return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)) case STYLE_DOUBLE: - return '"' + escapeString(string, lineWidth) + '"'; + return '"' + escapeString(string, lineWidth) + '"' default: - throw new YAMLException('impossible error: invalid scalar style'); + throw new YAMLException('impossible error: invalid scalar style') } - }()); + }()) } // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. -function blockHeader(string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ''; +function blockHeader (string, indentPerLevel) { + var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '' // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n'; - var keep = clip && (string[string.length - 2] === '\n' || string === '\n'); - var chomp = keep ? '+' : (clip ? '' : '-'); + var clip = string[string.length - 1] === '\n' + var keep = clip && (string[string.length - 2] === '\n' || string === '\n') + var chomp = keep ? '+' : (clip ? '' : '-') - return indentIndicator + chomp + '\n'; + return indentIndicator + chomp + '\n' } // (See the note for writeScalar.) -function dropEndingNewline(string) { - return string[string.length - 1] === '\n' ? string.slice(0, -1) : string; +function dropEndingNewline (string) { + return string[string.length - 1] === '\n' ? string.slice(0, -1) : string } // Note: a long line without a suitable break point will exceed the width limit. // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0. -function foldString(string, width) { +function foldString (string, width) { // In folded style, $k$ consecutive newlines output as $k+1$ newlines— // unless they're before or after a more-indented line, or at the very // beginning or end, in which case $k$ maps to $k$. // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g; + var lineRe = /(\n+)([^\n]*)/g // first line (possibly an empty line) var result = (function () { - var nextLF = string.indexOf('\n'); - nextLF = nextLF !== -1 ? nextLF : string.length; - lineRe.lastIndex = nextLF; - return foldLine(string.slice(0, nextLF), width); - }()); + var nextLF = string.indexOf('\n') + nextLF = nextLF !== -1 ? nextLF : string.length + lineRe.lastIndex = nextLF + return foldLine(string.slice(0, nextLF), width) + }()) // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' '; - var moreIndented; + var prevMoreIndented = string[0] === '\n' || string[0] === ' ' + var moreIndented // rest of the lines - var match; + var match while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2]; - moreIndented = (line[0] === ' '); + var prefix = match[1], line = match[2] + moreIndented = (line[0] === ' ') result += prefix + (!prevMoreIndented && !moreIndented && line !== '' ? '\n' : '') - + foldLine(line, width); - prevMoreIndented = moreIndented; + + foldLine(line, width) + prevMoreIndented = moreIndented } - return result; + return result } // Greedy line breaking. // Picks the longest line under the limit each time, // otherwise settles for the shortest line over the limit. // NB. More-indented lines *cannot* be folded, as that would add an extra \n. -function foldLine(line, width) { - if (line === '' || line[0] === ' ') return line; +function foldLine (line, width) { + if (line === '' || line[0] === ' ') return line // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g; // note: the match index will always be <= length-2. - var match; + var breakRe = / [^ ]/g // note: the match index will always be <= length-2. + var match // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0; - var result = ''; + var start = 0, end, curr = 0, next = 0 + var result = '' // Invariants: 0 <= start <= length-1. // 0 <= curr <= next <= max(0, length-2). curr - start <= width. // Inside the loop: // A match implies length >= 2, so curr and next are <= length-2. while ((match = breakRe.exec(line))) { - next = match.index; + next = match.index // maintain invariant: curr - start <= width if (next - start > width) { - end = (curr > start) ? curr : next; // derive end <= length-2 - result += '\n' + line.slice(start, end); + end = (curr > start) ? curr : next // derive end <= length-2 + result += '\n' + line.slice(start, end) // skip the space that was output as \n - start = end + 1; // derive start <= length-1 + start = end + 1 // derive start <= length-1 } - curr = next; + curr = next } // By the invariants, start <= length-1, so there is something left over. // It is either the whole string or a part starting from non-whitespace. - result += '\n'; + result += '\n' // Insert a break if the remainder is too long and there is a break available. if (line.length - start > width && curr > start) { - result += line.slice(start, curr) + '\n' + line.slice(curr + 1); + result += line.slice(start, curr) + '\n' + line.slice(curr + 1) } else { - result += line.slice(start); + result += line.slice(start) } - return result.slice(1); // drop extra \n joiner + return result.slice(1) // drop extra \n joiner } // Escapes a double-quoted string. -function escapeString(string) { - var result = ''; - var char = 0; - var escapeSeq; +function escapeString (string) { + var result = '' + var char = 0 + var escapeSeq for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { - char = codePointAt(string, i); - escapeSeq = ESCAPE_SEQUENCES[char]; + char = codePointAt(string, i) + escapeSeq = ESCAPE_SEQUENCES[char] if (!escapeSeq && isPrintable(char)) { - result += string[i]; - if (char >= 0x10000) result += string[i + 1]; + result += string[i] + if (char >= 0x10000) result += string[i + 1] } else { - result += escapeSeq || encodeHex(char); + result += escapeSeq || encodeHex(char) } } - return result; + return result } -function writeFlowSequence(state, level, object) { +function writeFlowSequence (state, level, object) { var _result = '', _tag = state.tag, index, length, - value; + value for (index = 0, length = object.length; index < length; index += 1) { - value = object[index]; + value = object[index] if (state.replacer) { - value = state.replacer.call(object, String(index), value); + value = state.replacer.call(object, String(index), value) } // Write only valid elements, put null instead of invalid elements. if (writeNode(state, level, value, false, false) || (typeof value === 'undefined' && writeNode(state, level, null, false, false))) { - - if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : ''); - _result += state.dump; + if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '') + _result += state.dump } } - state.tag = _tag; - state.dump = '[' + _result + ']'; + state.tag = _tag + state.dump = '[' + _result + ']' } -function writeBlockSequence(state, level, object, compact) { +function writeBlockSequence (state, level, object, compact) { var _result = '', _tag = state.tag, index, length, - value; + value for (index = 0, length = object.length; index < length; index += 1) { - value = object[index]; + value = object[index] if (state.replacer) { - value = state.replacer.call(object, String(index), value); + value = state.replacer.call(object, String(index), value) } // Write only valid elements, put null instead of invalid elements. if (writeNode(state, level + 1, value, true, true, false, true) || (typeof value === 'undefined' && writeNode(state, level + 1, null, true, true, false, true))) { - if (!compact || _result !== '') { - _result += generateNextLine(state, level); + _result += generateNextLine(state, level) } if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - _result += '-'; + _result += '-' } else { - _result += '- '; + _result += '- ' } - _result += state.dump; + _result += state.dump } } - state.tag = _tag; - state.dump = _result || '[]'; // Empty sequence if no valid values. + state.tag = _tag + state.dump = _result || '[]' // Empty sequence if no valid values. } -function writeFlowMapping(state, level, object) { +function writeFlowMapping (state, level, object) { var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), @@ -630,45 +625,44 @@ function writeFlowMapping(state, level, object) { length, objectKey, objectValue, - pairBuffer; + pairBuffer for (index = 0, length = objectKeyList.length; index < length; index += 1) { + pairBuffer = '' + if (_result !== '') pairBuffer += ', ' - pairBuffer = ''; - if (_result !== '') pairBuffer += ', '; - - if (state.condenseFlow) pairBuffer += '"'; + if (state.condenseFlow) pairBuffer += '"' - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; + objectKey = objectKeyList[index] + objectValue = object[objectKey] if (state.replacer) { - objectValue = state.replacer.call(object, objectKey, objectValue); + objectValue = state.replacer.call(object, objectKey, objectValue) } if (!writeNode(state, level, objectKey, false, false)) { - continue; // Skip this pair because of invalid key; + continue // Skip this pair because of invalid key; } - if (state.dump.length > 1024) pairBuffer += '? '; + if (state.dump.length > 1024) pairBuffer += '? ' - pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' '); + pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ') if (!writeNode(state, level, objectValue, false, false)) { - continue; // Skip this pair because of invalid value. + continue // Skip this pair because of invalid value. } - pairBuffer += state.dump; + pairBuffer += state.dump // Both key and value are valid. - _result += pairBuffer; + _result += pairBuffer } - state.tag = _tag; - state.dump = '{' + _result + '}'; + state.tag = _tag + state.dump = '{' + _result + '}' } -function writeBlockMapping(state, level, object, compact) { +function writeBlockMapping (state, level, object, compact) { var _result = '', _tag = state.tag, objectKeyList = Object.keys(object), @@ -677,193 +671,192 @@ function writeBlockMapping(state, level, object, compact) { objectKey, objectValue, explicitPair, - pairBuffer; + pairBuffer // Allow sorting keys so that the output file is deterministic if (state.sortKeys === true) { // Default sorting - objectKeyList.sort(); + objectKeyList.sort() } else if (typeof state.sortKeys === 'function') { // Custom sort function - objectKeyList.sort(state.sortKeys); + objectKeyList.sort(state.sortKeys) } else if (state.sortKeys) { // Something is wrong - throw new YAMLException('sortKeys must be a boolean or a function'); + throw new YAMLException('sortKeys must be a boolean or a function') } for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = ''; + pairBuffer = '' if (!compact || _result !== '') { - pairBuffer += generateNextLine(state, level); + pairBuffer += generateNextLine(state, level) } - objectKey = objectKeyList[index]; - objectValue = object[objectKey]; + objectKey = objectKeyList[index] + objectValue = object[objectKey] if (state.replacer) { - objectValue = state.replacer.call(object, objectKey, objectValue); + objectValue = state.replacer.call(object, objectKey, objectValue) } if (!writeNode(state, level + 1, objectKey, true, true, true)) { - continue; // Skip this pair because of invalid key. + continue // Skip this pair because of invalid key. } explicitPair = (state.tag !== null && state.tag !== '?') || - (state.dump && state.dump.length > 1024); + (state.dump && state.dump.length > 1024) if (explicitPair) { if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += '?'; + pairBuffer += '?' } else { - pairBuffer += '? '; + pairBuffer += '? ' } } - pairBuffer += state.dump; + pairBuffer += state.dump if (explicitPair) { - pairBuffer += generateNextLine(state, level); + pairBuffer += generateNextLine(state, level) } if (!writeNode(state, level + 1, objectValue, true, explicitPair)) { - continue; // Skip this pair because of invalid value. + continue // Skip this pair because of invalid value. } if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) { - pairBuffer += ':'; + pairBuffer += ':' } else { - pairBuffer += ': '; + pairBuffer += ': ' } - pairBuffer += state.dump; + pairBuffer += state.dump // Both key and value are valid. - _result += pairBuffer; + _result += pairBuffer } - state.tag = _tag; - state.dump = _result || '{}'; // Empty mapping if no valid pairs. + state.tag = _tag + state.dump = _result || '{}' // Empty mapping if no valid pairs. } -function detectType(state, object, explicit) { - var _result, typeList, index, length, type, style; +function detectType (state, object, explicit) { + var _result, typeList, index, length, type, style - typeList = explicit ? state.explicitTypes : state.implicitTypes; + typeList = explicit ? state.explicitTypes : state.implicitTypes for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index]; + type = typeList[index] if ((type.instanceOf || type.predicate) && (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && (!type.predicate || type.predicate(object))) { - if (explicit) { if (type.multi && type.representName) { - state.tag = type.representName(object); + state.tag = type.representName(object) } else { - state.tag = type.tag; + state.tag = type.tag } } else { - state.tag = '?'; + state.tag = '?' } if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle; + style = state.styleMap[type.tag] || type.defaultStyle if (_toString.call(type.represent) === '[object Function]') { - _result = type.represent(object, style); + _result = type.represent(object, style) } else if (_hasOwnProperty.call(type.represent, style)) { - _result = type.represent[style](object, style); + _result = type.represent[style](object, style) } else { - throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style'); + throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style') } - state.dump = _result; + state.dump = _result } - return true; + return true } } - return false; + return false } // Serializes `object` and writes it to global `result`. // Returns true on success, or false on invalid object. // -function writeNode(state, level, object, block, compact, iskey, isblockseq) { - state.tag = null; - state.dump = object; +function writeNode (state, level, object, block, compact, iskey, isblockseq) { + state.tag = null + state.dump = object if (!detectType(state, object, false)) { - detectType(state, object, true); + detectType(state, object, true) } - var type = _toString.call(state.dump); - var inblock = block; - var tagStr; + var type = _toString.call(state.dump) + var inblock = block + var tagStr if (block) { - block = (state.flowLevel < 0 || state.flowLevel > level); + block = (state.flowLevel < 0 || state.flowLevel > level) } var objectOrArray = type === '[object Object]' || type === '[object Array]', duplicateIndex, - duplicate; + duplicate if (objectOrArray) { - duplicateIndex = state.duplicates.indexOf(object); - duplicate = duplicateIndex !== -1; + duplicateIndex = state.duplicates.indexOf(object) + duplicate = duplicateIndex !== -1 } if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) { - compact = false; + compact = false } if (duplicate && state.usedDuplicates[duplicateIndex]) { - state.dump = '*ref_' + duplicateIndex; + state.dump = '*ref_' + duplicateIndex } else { if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) { - state.usedDuplicates[duplicateIndex] = true; + state.usedDuplicates[duplicateIndex] = true } if (type === '[object Object]') { if (block && (Object.keys(state.dump).length !== 0)) { - writeBlockMapping(state, level, state.dump, compact); + writeBlockMapping(state, level, state.dump, compact) if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; + state.dump = '&ref_' + duplicateIndex + state.dump } } else { - writeFlowMapping(state, level, state.dump); + writeFlowMapping(state, level, state.dump) if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump } } } else if (type === '[object Array]') { if (block && (state.dump.length !== 0)) { if (state.noArrayIndent && !isblockseq && level > 0) { - writeBlockSequence(state, level - 1, state.dump, compact); + writeBlockSequence(state, level - 1, state.dump, compact) } else { - writeBlockSequence(state, level, state.dump, compact); + writeBlockSequence(state, level, state.dump, compact) } if (duplicate) { - state.dump = '&ref_' + duplicateIndex + state.dump; + state.dump = '&ref_' + duplicateIndex + state.dump } } else { - writeFlowSequence(state, level, state.dump); + writeFlowSequence(state, level, state.dump) if (duplicate) { - state.dump = '&ref_' + duplicateIndex + ' ' + state.dump; + state.dump = '&ref_' + duplicateIndex + ' ' + state.dump } } } else if (type === '[object String]') { if (state.tag !== '?') { - writeScalar(state, state.dump, level, iskey, inblock); + writeScalar(state, state.dump, level, iskey, inblock) } } else if (type === '[object Undefined]') { - return false; + return false } else { - if (state.skipInvalid) return false; - throw new YAMLException('unacceptable kind of an object to dump ' + type); + if (state.skipInvalid) return false + throw new YAMLException('unacceptable kind of an object to dump ' + type) } if (state.tag !== null && state.tag !== '?') { @@ -882,82 +875,82 @@ function writeNode(state, level, object, block, compact, iskey, isblockseq) { // tagStr = encodeURI( state.tag[0] === '!' ? state.tag.slice(1) : state.tag - ).replace(/!/g, '%21'); + ).replace(/!/g, '%21') if (state.tag[0] === '!') { - tagStr = '!' + tagStr; + tagStr = '!' + tagStr } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') { - tagStr = '!!' + tagStr.slice(18); + tagStr = '!!' + tagStr.slice(18) } else { - tagStr = '!<' + tagStr + '>'; + tagStr = '!<' + tagStr + '>' } - state.dump = tagStr + ' ' + state.dump; + state.dump = tagStr + ' ' + state.dump } } - return true; + return true } -function getDuplicateReferences(object, state) { +function getDuplicateReferences (object, state) { var objects = [], duplicatesIndexes = [], index, - length; + length - inspectNode(object, objects, duplicatesIndexes); + inspectNode(object, objects, duplicatesIndexes) for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { - state.duplicates.push(objects[duplicatesIndexes[index]]); + state.duplicates.push(objects[duplicatesIndexes[index]]) } - state.usedDuplicates = new Array(length); + state.usedDuplicates = new Array(length) } -function inspectNode(object, objects, duplicatesIndexes) { +function inspectNode (object, objects, duplicatesIndexes) { var objectKeyList, index, - length; + length if (object !== null && typeof object === 'object') { - index = objects.indexOf(object); + index = objects.indexOf(object) if (index !== -1) { if (duplicatesIndexes.indexOf(index) === -1) { - duplicatesIndexes.push(index); + duplicatesIndexes.push(index) } } else { - objects.push(object); + objects.push(object) if (Array.isArray(object)) { for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes); + inspectNode(object[index], objects, duplicatesIndexes) } } else { - objectKeyList = Object.keys(object); + objectKeyList = Object.keys(object) for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes); + inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes) } } } } } -function dump(input, options) { - options = options || {}; +function dump (input, options) { + options = options || {} - var state = new State(options); + var state = new State(options) - if (!state.noRefs) getDuplicateReferences(input, state); + if (!state.noRefs) getDuplicateReferences(input, state) - var value = input; + var value = input if (state.replacer) { - value = state.replacer.call({ '': value }, '', value); + value = state.replacer.call({ '': value }, '', value) } - if (writeNode(state, 0, value, true, true)) return state.dump + '\n'; + if (writeNode(state, 0, value, true, true)) return state.dump + '\n' - return ''; + return '' } -module.exports.dump = dump; +module.exports.dump = dump diff --git a/lib/exception.js b/lib/exception.js index 7f62daae..8f31e963 100644 --- a/lib/exception.js +++ b/lib/exception.js @@ -1,55 +1,50 @@ // YAML error class. http://stackoverflow.com/questions/8458984 // -'use strict'; +'use strict' +function formatError (exception, compact) { + var where = '', message = exception.reason || '(unknown reason)' -function formatError(exception, compact) { - var where = '', message = exception.reason || '(unknown reason)'; - - if (!exception.mark) return message; + if (!exception.mark) return message if (exception.mark.name) { - where += 'in "' + exception.mark.name + '" '; + where += 'in "' + exception.mark.name + '" ' } - where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'; + where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')' if (!compact && exception.mark.snippet) { - where += '\n\n' + exception.mark.snippet; + where += '\n\n' + exception.mark.snippet } - return message + ' ' + where; + return message + ' ' + where } - -function YAMLException(reason, mark) { +function YAMLException (reason, mark) { // Super constructor - Error.call(this); + Error.call(this) - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = formatError(this, false); + this.name = 'YAMLException' + this.reason = reason + this.mark = mark + this.message = formatError(this, false) // Include stack trace in error object if (Error.captureStackTrace) { // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); + Error.captureStackTrace(this, this.constructor) } else { // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = (new Error()).stack || ''; + this.stack = (new Error()).stack || '' } } - // Inherit from Error -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; - - -YAMLException.prototype.toString = function toString(compact) { - return this.name + ': ' + formatError(this, compact); -}; +YAMLException.prototype = Object.create(Error.prototype) +YAMLException.prototype.constructor = YAMLException +YAMLException.prototype.toString = function toString (compact) { + return this.name + ': ' + formatError(this, compact) +} -module.exports = YAMLException; +module.exports = YAMLException diff --git a/lib/loader.js b/lib/loader.js index 074c5fdf..aff5ba4d 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -1,89 +1,84 @@ -'use strict'; +'use strict' -var common = require('./common'); -var YAMLException = require('./exception'); -var makeSnippet = require('./snippet'); -var DEFAULT_SCHEMA = require('./schema/default'); +var common = require('./common') +var YAMLException = require('./exception') +var makeSnippet = require('./snippet') +var DEFAULT_SCHEMA = require('./schema/default') +var _hasOwnProperty = Object.prototype.hasOwnProperty -var _hasOwnProperty = Object.prototype.hasOwnProperty; +var CONTEXT_FLOW_IN = 1 +var CONTEXT_FLOW_OUT = 2 +var CONTEXT_BLOCK_IN = 3 +var CONTEXT_BLOCK_OUT = 4 +var CHOMPING_CLIP = 1 +var CHOMPING_STRIP = 2 +var CHOMPING_KEEP = 3 -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/ +var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/ +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/ +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i +function _class (obj) { return Object.prototype.toString.call(obj) } -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; - - -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - - -function _class(obj) { return Object.prototype.toString.call(obj); } - -function is_EOL(c) { - return (c === 0x0A/* LF */) || (c === 0x0D/* CR */); +function is_EOL (c) { + return (c === 0x0A/* LF */) || (c === 0x0D/* CR */) } -function is_WHITE_SPACE(c) { - return (c === 0x09/* Tab */) || (c === 0x20/* Space */); +function is_WHITE_SPACE (c) { + return (c === 0x09/* Tab */) || (c === 0x20/* Space */) } -function is_WS_OR_EOL(c) { +function is_WS_OR_EOL (c) { return (c === 0x09/* Tab */) || (c === 0x20/* Space */) || (c === 0x0A/* LF */) || - (c === 0x0D/* CR */); + (c === 0x0D/* CR */) } -function is_FLOW_INDICATOR(c) { +function is_FLOW_INDICATOR (c) { return c === 0x2C/* , */ || c === 0x5B/* [ */ || c === 0x5D/* ] */ || c === 0x7B/* { */ || - c === 0x7D/* } */; + c === 0x7D/* } */ } -function fromHexCode(c) { - var lc; +function fromHexCode (c) { + var lc if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; + return c - 0x30 } - lc = c | 0x20; + lc = c | 0x20 if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { - return lc - 0x61 + 10; + return lc - 0x61 + 10 } - return -1; + return -1 } -function escapedHexLen(c) { - if (c === 0x78/* x */) { return 2; } - if (c === 0x75/* u */) { return 4; } - if (c === 0x55/* U */) { return 8; } - return 0; +function escapedHexLen (c) { + if (c === 0x78/* x */) { return 2 } + if (c === 0x75/* u */) { return 4 } + if (c === 0x55/* U */) { return 8 } + return 0 } -function fromDecimalCode(c) { +function fromDecimalCode (c) { if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { - return c - 0x30; + return c - 0x30 } - return -1; + return -1 } -function simpleEscapeSequence(c) { +function simpleEscapeSequence (c) { return (c === 0x30/* 0 */) ? '\x00' : (c === 0x61/* a */) ? '\x07' : (c === 0x62/* b */) ? '\x08' : @@ -101,24 +96,24 @@ function simpleEscapeSequence(c) { (c === 0x4E/* N */) ? '\x85' : (c === 0x5F/* _ */) ? '\xA0' : (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : ''; + (c === 0x50/* P */) ? '\u2029' : '' } -function charFromCodepoint(c) { +function charFromCodepoint (c) { if (c <= 0xFFFF) { - return String.fromCharCode(c); + return String.fromCharCode(c) } // Encode UTF-16 surrogate pair // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF return String.fromCharCode( ((c - 0x010000) >> 10) + 0xD800, ((c - 0x010000) & 0x03FF) + 0xDC00 - ); + ) } // set a property of a literal object, while protecting against prototype pollution, // see https://github.com/nodeca/js-yaml/issues/164 for more details -function setProperty(object, key, value) { +function setProperty (object, key, value) { // used for this specific key only because Object.defineProperty is slow if (key === '__proto__') { Object.defineProperty(object, key, { @@ -126,47 +121,46 @@ function setProperty(object, key, value) { enumerable: true, writable: true, value: value - }); + }) } else { - object[key] = value; + object[key] = value } } -var simpleEscapeCheck = new Array(256); // integer, for fast access -var simpleEscapeMap = new Array(256); +var simpleEscapeCheck = new Array(256) // integer, for fast access +var simpleEscapeMap = new Array(256) for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); + simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0 + simpleEscapeMap[i] = simpleEscapeSequence(i) } +function State (input, options) { + this.input = input -function State(input, options) { - this.input = input; - - this.filename = options['filename'] || null; - this.schema = options['schema'] || DEFAULT_SCHEMA; - this.onWarning = options['onWarning'] || null; + this.filename = options['filename'] || null + this.schema = options['schema'] || DEFAULT_SCHEMA + this.onWarning = options['onWarning'] || null // (Hidden) Remove? makes the loader to expect YAML 1.1 documents // if such documents have no explicit %YAML directive - this.legacy = options['legacy'] || false; + this.legacy = options['legacy'] || false - this.json = options['json'] || false; - this.listener = options['listener'] || null; + this.json = options['json'] || false + this.listener = options['listener'] || null - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; + this.implicitTypes = this.schema.compiledImplicit + this.typeMap = this.schema.compiledTypeMap - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; + this.length = input.length + this.position = 0 + this.line = 0 + this.lineStart = 0 + this.lineIndent = 0 // position of first leading tab in the current line, // used to make sure there are no tabs in the indentation - this.firstTabInLine = -1; + this.firstTabInLine = -1 - this.documents = []; + this.documents = [] /* this.version; @@ -176,164 +170,157 @@ function State(input, options) { this.tag; this.anchor; this.kind; - this.result;*/ - + this.result; */ } - -function generateError(state, message) { +function generateError (state, message) { var mark = { name: state.filename, buffer: state.input.slice(0, -1), // omit trailing \0 position: state.position, line: state.line, column: state.position - state.lineStart - }; + } - mark.snippet = makeSnippet(mark); + mark.snippet = makeSnippet(mark) - return new YAMLException(message, mark); + return new YAMLException(message, mark) } -function throwError(state, message) { - throw generateError(state, message); +function throwError (state, message) { + throw generateError(state, message) } -function throwWarning(state, message) { +function throwWarning (state, message) { if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); + state.onWarning.call(null, generateError(state, message)) } } - var directiveHandlers = { - YAML: function handleYamlDirective(state, name, args) { - - var match, major, minor; + YAML: function handleYamlDirective (state, name, args) { + var match, major, minor if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); + throwError(state, 'duplication of %YAML directive') } if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); + throwError(state, 'YAML directive accepts exactly one argument') } - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); + match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]) if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); + throwError(state, 'ill-formed argument of the YAML directive') } - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); + major = parseInt(match[1], 10) + minor = parseInt(match[2], 10) if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); + throwError(state, 'unacceptable YAML version of the document') } - state.version = args[0]; - state.checkLineBreaks = (minor < 2); + state.version = args[0] + state.checkLineBreaks = (minor < 2) if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); + throwWarning(state, 'unsupported YAML version of the document') } }, - TAG: function handleTagDirective(state, name, args) { - - var handle, prefix; + TAG: function handleTagDirective (state, name, args) { + var handle, prefix if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); + throwError(state, 'TAG directive accepts exactly two arguments') } - handle = args[0]; - prefix = args[1]; + handle = args[0] + prefix = args[1] if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); + throwError(state, 'ill-formed tag handle (first argument) of the TAG directive') } if (_hasOwnProperty.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); + throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle') } if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); + throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive') } try { - prefix = decodeURIComponent(prefix); + prefix = decodeURIComponent(prefix) } catch (err) { - throwError(state, 'tag prefix is malformed: ' + prefix); + throwError(state, 'tag prefix is malformed: ' + prefix) } - state.tagMap[handle] = prefix; + state.tagMap[handle] = prefix } -}; - +} -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; +function captureSegment (state, start, end, checkJson) { + var _position, _length, _character, _result if (start < end) { - _result = state.input.slice(start, end); + _result = state.input.slice(start, end) if (checkJson) { for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); + _character = _result.charCodeAt(_position) if (!(_character === 0x09 || (0x20 <= _character && _character <= 0x10FFFF))) { - throwError(state, 'expected valid JSON character'); + throwError(state, 'expected valid JSON character') } } } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); + throwError(state, 'the stream contains non-printable characters') } - state.result += _result; + state.result += _result } } -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; +function mergeMappings (state, destination, source, overridableKeys) { + var sourceKeys, key, index, quantity if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); + throwError(state, 'cannot merge mappings; the provided source object is unacceptable') } - sourceKeys = Object.keys(source); + sourceKeys = Object.keys(source) for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; + key = sourceKeys[index] if (!_hasOwnProperty.call(destination, key)) { - setProperty(destination, key, source[key]); - overridableKeys[key] = true; + setProperty(destination, key, source[key]) + overridableKeys[key] = true } } } -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, +function storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) { - - var index, quantity; + var index, quantity // The output is a plain object here, so keys can only be strings. // We need to convert keyNode to a string, but doing so can hang the process // (deeply nested arrays that explode exponentially using aliases). if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); + keyNode = Array.prototype.slice.call(keyNode) for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); + throwError(state, 'nested arrays are not supported inside keys') } if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; + keyNode[index] = '[object Object]' } } } @@ -342,137 +329,134 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu // (still use its own toString for arrays, timestamps, // and whatever user schema extensions happen to have @@toStringTag) if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; + keyNode = '[object Object]' } - - keyNode = String(keyNode); + keyNode = String(keyNode) if (_result === null) { - _result = {}; + _result = {} } if (keyTag === 'tag:yaml.org,2002:merge') { if (Array.isArray(valueNode)) { for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); + mergeMappings(state, _result, valueNode[index], overridableKeys) } } else { - mergeMappings(state, _result, valueNode, overridableKeys); + mergeMappings(state, _result, valueNode, overridableKeys) } } else { if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) { - state.line = startLine || state.line; - state.lineStart = startLineStart || state.lineStart; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); + state.line = startLine || state.line + state.lineStart = startLineStart || state.lineStart + state.position = startPos || state.position + throwError(state, 'duplicated mapping key') } - setProperty(_result, keyNode, valueNode); - delete overridableKeys[keyNode]; + setProperty(_result, keyNode, valueNode) + delete overridableKeys[keyNode] } - return _result; + return _result } -function readLineBreak(state) { - var ch; +function readLineBreak (state) { + var ch - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (ch === 0x0A/* LF */) { - state.position++; + state.position++ } else if (ch === 0x0D/* CR */) { - state.position++; + state.position++ if (state.input.charCodeAt(state.position) === 0x0A/* LF */) { - state.position++; + state.position++ } } else { - throwError(state, 'a line break is expected'); + throwError(state, 'a line break is expected') } - state.line += 1; - state.lineStart = state.position; - state.firstTabInLine = -1; + state.line += 1 + state.lineStart = state.position + state.firstTabInLine = -1 } -function skipSeparationSpace(state, allowComments, checkIndent) { +function skipSeparationSpace (state, allowComments, checkIndent) { var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) while (ch !== 0) { while (is_WHITE_SPACE(ch)) { if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) { - state.firstTabInLine = state.position; + state.firstTabInLine = state.position } - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } if (allowComments && ch === 0x23/* # */) { do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0); + ch = state.input.charCodeAt(++state.position) + } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0) } if (is_EOL(ch)) { - readLineBreak(state); + readLineBreak(state) - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; + ch = state.input.charCodeAt(state.position) + lineBreaks++ + state.lineIndent = 0 while (ch === 0x20/* Space */) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); + state.lineIndent++ + ch = state.input.charCodeAt(++state.position) } } else { - break; + break } } if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); + throwWarning(state, 'deficient indentation') } - return lineBreaks; + return lineBreaks } -function testDocumentSeparator(state) { +function testDocumentSeparator (state) { var _position = state.position, - ch; + ch - ch = state.input.charCodeAt(_position); + ch = state.input.charCodeAt(_position) // Condition state.position === state.lineStart is tested // in parent on each call, for efficiency. No needs to test here again. if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) { + _position += 3 - _position += 3; - - ch = state.input.charCodeAt(_position); + ch = state.input.charCodeAt(_position) if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; + return true } } - return false; + return false } -function writeFoldedLines(state, count) { +function writeFoldedLines (state, count) { if (count === 1) { - state.result += ' '; + state.result += ' ' } else if (count > 1) { - state.result += common.repeat('\n', count - 1); + state.result += common.repeat('\n', count - 1) } } - -function readPlainScalar(state, nodeIndent, withinFlowCollection) { +function readPlainScalar (state, nodeIndent, withinFlowCollection) { var preceding, following, captureStart, @@ -483,9 +467,9 @@ function readPlainScalar(state, nodeIndent, withinFlowCollection) { _lineIndent, _kind = state.kind, _result = state.result, - ch; + ch - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || @@ -500,212 +484,199 @@ function readPlainScalar(state, nodeIndent, withinFlowCollection) { ch === 0x25/* % */ || ch === 0x40/* @ */ || ch === 0x60/* ` */) { - return false; + return false } if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1); + following = state.input.charCodeAt(state.position + 1) if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; + return false } } - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; + state.kind = 'scalar' + state.result = '' + captureStart = captureEnd = state.position + hasPendingContent = false while (ch !== 0) { if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1); + following = state.input.charCodeAt(state.position + 1) if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; + break } - } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1); + preceding = state.input.charCodeAt(state.position - 1) if (is_WS_OR_EOL(preceding)) { - break; + break } - } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - + break } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); + _line = state.line + _lineStart = state.lineStart + _lineIndent = state.lineIndent + skipSeparationSpace(state, false, -1) if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; + hasPendingContent = true + ch = state.input.charCodeAt(state.position) + continue } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; + state.position = captureEnd + state.line = _line + state.lineStart = _lineStart + state.lineIndent = _lineIndent + break } } if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; + captureSegment(state, captureStart, captureEnd, false) + writeFoldedLines(state, state.line - _line) + captureStart = captureEnd = state.position + hasPendingContent = false } if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; + captureEnd = state.position + 1 } - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } - captureSegment(state, captureStart, captureEnd, false); + captureSegment(state, captureStart, captureEnd, false) if (state.result) { - return true; + return true } - state.kind = _kind; - state.result = _result; - return false; + state.kind = _kind + state.result = _result + return false } -function readSingleQuotedScalar(state, nodeIndent) { +function readSingleQuotedScalar (state, nodeIndent) { var ch, - captureStart, captureEnd; + captureStart, captureEnd - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (ch !== 0x27/* ' */) { - return false; + return false } - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; + state.kind = 'scalar' + state.result = '' + state.position++ + captureStart = captureEnd = state.position while ((ch = state.input.charCodeAt(state.position)) !== 0) { if (ch === 0x27/* ' */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); + captureSegment(state, captureStart, state.position, true) + ch = state.input.charCodeAt(++state.position) if (ch === 0x27/* ' */) { - captureStart = state.position; - state.position++; - captureEnd = state.position; + captureStart = state.position + state.position++ + captureEnd = state.position } else { - return true; + return true } - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - + captureSegment(state, captureStart, captureEnd, true) + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)) + captureStart = captureEnd = state.position } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); - + throwError(state, 'unexpected end of the document within a single quoted scalar') } else { - state.position++; - captureEnd = state.position; + state.position++ + captureEnd = state.position } } - throwError(state, 'unexpected end of the stream within a single quoted scalar'); + throwError(state, 'unexpected end of the stream within a single quoted scalar') } -function readDoubleQuotedScalar(state, nodeIndent) { +function readDoubleQuotedScalar (state, nodeIndent) { var captureStart, captureEnd, hexLength, hexResult, tmp, - ch; + ch - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (ch !== 0x22/* " */) { - return false; + return false } - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; + state.kind = 'scalar' + state.result = '' + state.position++ + captureStart = captureEnd = state.position while ((ch = state.input.charCodeAt(state.position)) !== 0) { if (ch === 0x22/* " */) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - + captureSegment(state, captureStart, state.position, true) + state.position++ + return true } else if (ch === 0x5C/* \ */) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); + captureSegment(state, captureStart, state.position, true) + ch = state.input.charCodeAt(++state.position) if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); + skipSeparationSpace(state, false, nodeIndent) // TODO: rework to inline fn with no type cast? } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; - + state.result += simpleEscapeMap[ch] + state.position++ } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; + hexLength = tmp + hexResult = 0 for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; - + hexResult = (hexResult << 4) + tmp } else { - throwError(state, 'expected hexadecimal character'); + throwError(state, 'expected hexadecimal character') } } - state.result += charFromCodepoint(hexResult); - - state.position++; + state.result += charFromCodepoint(hexResult) + state.position++ } else { - throwError(state, 'unknown escape sequence'); + throwError(state, 'unknown escape sequence') } - captureStart = captureEnd = state.position; - + captureStart = captureEnd = state.position } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - + captureSegment(state, captureStart, captureEnd, true) + writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)) + captureStart = captureEnd = state.position } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); - + throwError(state, 'unexpected end of the document within a double quoted scalar') } else { - state.position++; - captureEnd = state.position; + state.position++ + captureEnd = state.position } } - throwError(state, 'unexpected end of the stream within a double quoted scalar'); + throwError(state, 'unexpected end of the stream within a double quoted scalar') } -function readFlowCollection(state, nodeIndent) { +function readFlowCollection (state, nodeIndent) { var readNext = true, _line, _lineStart, @@ -722,102 +693,102 @@ function readFlowCollection(state, nodeIndent) { keyNode, keyTag, valueNode, - ch; + ch - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (ch === 0x5B/* [ */) { - terminator = 0x5D;/* ] */ - isMapping = false; - _result = []; + terminator = 0x5D/* ] */ + isMapping = false + _result = [] } else if (ch === 0x7B/* { */) { - terminator = 0x7D;/* } */ - isMapping = true; - _result = {}; + terminator = 0x7D/* } */ + isMapping = true + _result = {} } else { - return false; + return false } if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; + state.anchorMap[state.anchor] = _result } - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); + skipSeparationSpace(state, true, nodeIndent) - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; + state.position++ + state.tag = _tag + state.anchor = _anchor + state.kind = isMapping ? 'mapping' : 'sequence' + state.result = _result + return true } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); + throwError(state, 'missed comma between flow collection entries') } else if (ch === 0x2C/* , */) { // "flow collection entries can never be completely empty", as per YAML 1.2, section 7.4 - throwError(state, "expected the node content, but found ','"); + throwError(state, "expected the node content, but found ','") } - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; + keyTag = keyNode = valueNode = null + isPair = isExplicitPair = false if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1); + following = state.input.charCodeAt(state.position + 1) if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); + isPair = isExplicitPair = true + state.position++ + skipSeparationSpace(state, true, nodeIndent) } } - _line = state.line; // Save the current line. - _lineStart = state.lineStart; - _pos = state.position; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); + _line = state.line // Save the current line. + _lineStart = state.lineStart + _pos = state.position + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true) + keyTag = state.tag + keyNode = state.result + skipSeparationSpace(state, true, nodeIndent) - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; + isPair = true + ch = state.input.charCodeAt(++state.position) + skipSeparationSpace(state, true, nodeIndent) + composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true) + valueNode = state.result } if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos); + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos) } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)); + _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos)) } else { - _result.push(keyNode); + _result.push(keyNode) } - skipSeparationSpace(state, true, nodeIndent); + skipSeparationSpace(state, true, nodeIndent) - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (ch === 0x2C/* , */) { - readNext = true; - ch = state.input.charCodeAt(++state.position); + readNext = true + ch = state.input.charCodeAt(++state.position) } else { - readNext = false; + readNext = false } } - throwError(state, 'unexpected end of the stream within a flow collection'); + throwError(state, 'unexpected end of the stream within a flow collection') } -function readBlockScalar(state, nodeIndent) { +function readBlockScalar (state, nodeIndent) { var captureStart, folding, chomping = CHOMPING_CLIP, @@ -827,210 +798,206 @@ function readBlockScalar(state, nodeIndent) { emptyLines = 0, atMoreIndented = false, tmp, - ch; + ch - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (ch === 0x7C/* | */) { - folding = false; + folding = false } else if (ch === 0x3E/* > */) { - folding = true; + folding = true } else { - return false; + return false } - state.kind = 'scalar'; - state.result = ''; + state.kind = 'scalar' + state.result = '' while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) if (ch === 0x2B/* + */ || ch === 0x2D/* - */) { if (CHOMPING_CLIP === chomping) { - chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP; + chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP } else { - throwError(state, 'repeat of a chomping mode identifier'); + throwError(state, 'repeat of a chomping mode identifier') } - } else if ((tmp = fromDecimalCode(ch)) >= 0) { if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); + throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one') } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; + textIndent = nodeIndent + tmp - 1 + detectedIndent = true } else { - throwError(state, 'repeat of an indentation width identifier'); + throwError(state, 'repeat of an indentation width identifier') } - } else { - break; + break } } if (is_WHITE_SPACE(ch)) { - do { ch = state.input.charCodeAt(++state.position); } - while (is_WHITE_SPACE(ch)); + do { ch = state.input.charCodeAt(++state.position) } + while (is_WHITE_SPACE(ch)) if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (!is_EOL(ch) && (ch !== 0)); + do { ch = state.input.charCodeAt(++state.position) } + while (!is_EOL(ch) && (ch !== 0)) } } while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; + readLineBreak(state) + state.lineIndent = 0 - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) while ((!detectedIndent || state.lineIndent < textIndent) && (ch === 0x20/* Space */)) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); + state.lineIndent++ + ch = state.input.charCodeAt(++state.position) } if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; + textIndent = state.lineIndent } if (is_EOL(ch)) { - emptyLines++; - continue; + emptyLines++ + continue } // End of the scalar. if (state.lineIndent < textIndent) { - // Perform the chomping. if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines) } else if (chomping === CHOMPING_CLIP) { if (didReadContent) { // i.e. only if the scalar is not empty. - state.result += '\n'; + state.result += '\n' } } // Break this `while` cycle and go to the funciton's epilogue. - break; + break } // Folded style: use fancy rules to handle line breaks. if (folding) { - // Lines starting with white space characters (more-indented lines) are not folded. if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; + atMoreIndented = true // except for the first content line (cf. Example 8.1) - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines) // End of more-indented block. } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); + atMoreIndented = false + state.result += common.repeat('\n', emptyLines + 1) // Just one line break - perceive as the same line. } else if (emptyLines === 0) { if (didReadContent) { // i.e. only if we have already read some scalar content. - state.result += ' '; + state.result += ' ' } // Several line breaks - perceive as different lines. } else { - state.result += common.repeat('\n', emptyLines); + state.result += common.repeat('\n', emptyLines) } // Literal style: just add exact number of line breaks between content lines. } else { // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); + state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines) } - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; + didReadContent = true + detectedIndent = true + emptyLines = 0 + captureStart = state.position while (!is_EOL(ch) && (ch !== 0)) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } - captureSegment(state, captureStart, state.position, false); + captureSegment(state, captureStart, state.position, false) } - return true; + return true } -function readBlockSequence(state, nodeIndent) { +function readBlockSequence (state, nodeIndent) { var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, - ch; + ch // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar - if (state.firstTabInLine !== -1) return false; + if (state.firstTabInLine !== -1) return false if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; + state.anchorMap[state.anchor] = _result } - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) while (ch !== 0) { if (state.firstTabInLine !== -1) { - state.position = state.firstTabInLine; - throwError(state, 'tab characters must not be used in indentation'); + state.position = state.firstTabInLine + throwError(state, 'tab characters must not be used in indentation') } if (ch !== 0x2D/* - */) { - break; + break } - following = state.input.charCodeAt(state.position + 1); + following = state.input.charCodeAt(state.position + 1) if (!is_WS_OR_EOL(following)) { - break; + break } - detected = true; - state.position++; + detected = true + state.position++ if (skipSeparationSpace(state, true, -1)) { if (state.lineIndent <= nodeIndent) { - _result.push(null); - ch = state.input.charCodeAt(state.position); - continue; + _result.push(null) + ch = state.input.charCodeAt(state.position) + continue } } - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - _result.push(state.result); - skipSeparationSpace(state, true, -1); + _line = state.line + composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true) + _result.push(state.result) + skipSeparationSpace(state, true, -1) - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a sequence entry'); + throwError(state, 'bad indentation of a sequence entry') } else if (state.lineIndent < nodeIndent) { - break; + break } } if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; + state.tag = _tag + state.anchor = _anchor + state.kind = 'sequence' + state.result = _result + return true } - return false; + return false } -function readBlockMapping(state, nodeIndent, flowIndent) { +function readBlockMapping (state, nodeIndent, flowIndent) { var following, allowCompact, _line, @@ -1046,110 +1013,103 @@ function readBlockMapping(state, nodeIndent, flowIndent) { valueNode = null, atExplicitKey = false, detected = false, - ch; + ch // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar - if (state.firstTabInLine !== -1) return false; + if (state.firstTabInLine !== -1) return false if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; + state.anchorMap[state.anchor] = _result } - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) while (ch !== 0) { if (!atExplicitKey && state.firstTabInLine !== -1) { - state.position = state.firstTabInLine; - throwError(state, 'tab characters must not be used in indentation'); + state.position = state.firstTabInLine + throwError(state, 'tab characters must not be used in indentation') } - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. + following = state.input.charCodeAt(state.position + 1) + _line = state.line // Save the current line. // // Explicit notation case. There are two separate blocks: // first for the key (denoted by "?") and second for the value (denoted by ":") // if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) { - if (ch === 0x3F/* ? */) { if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos) + keyTag = keyNode = valueNode = null } - detected = true; - atExplicitKey = true; - allowCompact = true; - + detected = true + atExplicitKey = true + allowCompact = true } else if (atExplicitKey) { // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; - + atExplicitKey = false + allowCompact = true } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); + throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line') } - state.position += 1; - ch = following; + state.position += 1 + ch = following // // Implicit notation case. Flow-style node as the key first, then ":", and the value. // } else { - _keyLine = state.line; - _keyLineStart = state.lineStart; - _keyPos = state.position; + _keyLine = state.line + _keyLineStart = state.lineStart + _keyPos = state.position if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { // Neither implicit nor explicit notation. // Reading is done. Go to the epilogue. - break; + break } if (state.line === _line) { - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } if (ch === 0x3A/* : */) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); + throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping') } if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos) + keyTag = keyNode = valueNode = null } - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - + detected = true + atExplicitKey = false + allowCompact = false + keyTag = state.tag + keyNode = state.result } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - + throwError(state, 'can not read an implicit mapping pair; a colon is missed') } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. + state.tag = _tag + state.anchor = _anchor + return true // Keep the result of `composeNode`. } - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - + throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key') } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. + state.tag = _tag + state.anchor = _anchor + return true // Keep the result of `composeNode`. } } @@ -1158,32 +1118,32 @@ function readBlockMapping(state, nodeIndent, flowIndent) { // if (state.line === _line || state.lineIndent > nodeIndent) { if (atExplicitKey) { - _keyLine = state.line; - _keyLineStart = state.lineStart; - _keyPos = state.position; + _keyLine = state.line + _keyLineStart = state.lineStart + _keyPos = state.position } if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { if (atExplicitKey) { - keyNode = state.result; + keyNode = state.result } else { - valueNode = state.result; + valueNode = state.result } } if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos); - keyTag = keyNode = valueNode = null; + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos) + keyTag = keyNode = valueNode = null } - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); + skipSeparationSpace(state, true, -1) + ch = state.input.charCodeAt(state.position) } if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) { - throwError(state, 'bad indentation of a mapping entry'); + throwError(state, 'bad indentation of a mapping entry') } else if (state.lineIndent < nodeIndent) { - break; + break } } @@ -1193,178 +1153,171 @@ function readBlockMapping(state, nodeIndent, flowIndent) { // Special case: last mapping's node contains only the key in explicit notation. if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos); + storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos) } // Expose the resulting mapping. if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; + state.tag = _tag + state.anchor = _anchor + state.kind = 'mapping' + state.result = _result } - return detected; + return detected } -function readTagProperty(state) { +function readTagProperty (state) { var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, - ch; + ch - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) - if (ch !== 0x21/* ! */) return false; + if (ch !== 0x21/* ! */) return false if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); + throwError(state, 'duplication of a tag property') } - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) if (ch === 0x3C/* < */) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); - + isVerbatim = true + ch = state.input.charCodeAt(++state.position) } else if (ch === 0x21/* ! */) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - + isNamed = true + tagHandle = '!!' + ch = state.input.charCodeAt(++state.position) } else { - tagHandle = '!'; + tagHandle = '!' } - _position = state.position; + _position = state.position if (isVerbatim) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && ch !== 0x3E/* > */); + do { ch = state.input.charCodeAt(++state.position) } + while (ch !== 0 && ch !== 0x3E/* > */) if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); + tagName = state.input.slice(_position, state.position) + ch = state.input.charCodeAt(++state.position) } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); + throwError(state, 'unexpected end of the stream within a verbatim tag') } } else { while (ch !== 0 && !is_WS_OR_EOL(ch)) { - if (ch === 0x21/* ! */) { if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); + tagHandle = state.input.slice(_position - 1, state.position + 1) if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); + throwError(state, 'named tag handle cannot contain such characters') } - isNamed = true; - _position = state.position + 1; + isNamed = true + _position = state.position + 1 } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); + throwError(state, 'tag suffix cannot contain exclamation marks') } } - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } - tagName = state.input.slice(_position, state.position); + tagName = state.input.slice(_position, state.position) if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); + throwError(state, 'tag suffix cannot contain flow indicator characters') } } if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); + throwError(state, 'tag name cannot contain such characters: ' + tagName) } try { - tagName = decodeURIComponent(tagName); + tagName = decodeURIComponent(tagName) } catch (err) { - throwError(state, 'tag name is malformed: ' + tagName); + throwError(state, 'tag name is malformed: ' + tagName) } if (isVerbatim) { - state.tag = tagName; - + state.tag = tagName } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - + state.tag = state.tagMap[tagHandle] + tagName } else if (tagHandle === '!') { - state.tag = '!' + tagName; - + state.tag = '!' + tagName } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; - + state.tag = 'tag:yaml.org,2002:' + tagName } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); + throwError(state, 'undeclared tag handle "' + tagHandle + '"') } - return true; + return true } -function readAnchorProperty(state) { +function readAnchorProperty (state) { var _position, - ch; + ch - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) - if (ch !== 0x26/* & */) return false; + if (ch !== 0x26/* & */) return false if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); + throwError(state, 'duplication of an anchor property') } - ch = state.input.charCodeAt(++state.position); - _position = state.position; + ch = state.input.charCodeAt(++state.position) + _position = state.position while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); + throwError(state, 'name of an anchor node must contain at least one character') } - state.anchor = state.input.slice(_position, state.position); - return true; + state.anchor = state.input.slice(_position, state.position) + return true } -function readAlias(state) { +function readAlias (state) { var _position, alias, - ch; + ch - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) - if (ch !== 0x2A/* * */) return false; + if (ch !== 0x2A/* * */) return false - ch = state.input.charCodeAt(++state.position); - _position = state.position; + ch = state.input.charCodeAt(++state.position) + _position = state.position while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); + throwError(state, 'name of an alias node must contain at least one character') } - alias = state.input.slice(_position, state.position); + alias = state.input.slice(_position, state.position) if (!_hasOwnProperty.call(state.anchorMap, alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); + throwError(state, 'unidentified alias "' + alias + '"') } - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; + state.result = state.anchorMap[alias] + skipSeparationSpace(state, true, -1) + return true } -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { +function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompact) { var allowBlockStyles, allowBlockScalars, allowBlockCollections, @@ -1376,31 +1329,31 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact typeList, type, flowIndent, - blockIndent; + blockIndent if (state.listener !== null) { - state.listener('open', state); + state.listener('open', state) } - state.tag = null; - state.anchor = null; - state.kind = null; - state.result = null; + state.tag = null + state.anchor = null + state.kind = null + state.result = null allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || - CONTEXT_BLOCK_IN === nodeContext; + CONTEXT_BLOCK_IN === nodeContext if (allowToSeek) { if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; + atNewLine = true if (state.lineIndent > parentIndent) { - indentStatus = 1; + indentStatus = 1 } else if (state.lineIndent === parentIndent) { - indentStatus = 0; + indentStatus = 0 } else if (state.lineIndent < parentIndent) { - indentStatus = -1; + indentStatus = -1 } } } @@ -1408,78 +1361,75 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact if (indentStatus === 1) { while (readTagProperty(state) || readAnchorProperty(state)) { if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; + atNewLine = true + allowBlockCollections = allowBlockStyles if (state.lineIndent > parentIndent) { - indentStatus = 1; + indentStatus = 1 } else if (state.lineIndent === parentIndent) { - indentStatus = 0; + indentStatus = 0 } else if (state.lineIndent < parentIndent) { - indentStatus = -1; + indentStatus = -1 } } else { - allowBlockCollections = false; + allowBlockCollections = false } } } if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; + allowBlockCollections = atNewLine || allowCompact } if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; + flowIndent = parentIndent } else { - flowIndent = parentIndent + 1; + flowIndent = parentIndent + 1 } - blockIndent = state.position - state.lineStart; + blockIndent = state.position - state.lineStart if (indentStatus === 1) { if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) { - hasContent = true; + hasContent = true } else { if ((allowBlockScalars && readBlockScalar(state, flowIndent)) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; - + hasContent = true } else if (readAlias(state)) { - hasContent = true; + hasContent = true if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); + throwError(state, 'alias node should not have any properties') } - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; + hasContent = true if (state.tag === null) { - state.tag = '?'; + state.tag = '?' } } if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; + state.anchorMap[state.anchor] = state.result } } } else if (indentStatus === 0) { // Special case: block sequences are allowed to have same indentation level as the parent. // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); + hasContent = allowBlockCollections && readBlockSequence(state, blockIndent) } } if (state.tag === null) { if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; + state.anchorMap[state.anchor] = state.result } - } else if (state.tag === '?') { // Implicit resolving is not allowed for non-scalar types, and '?' // non-specific tag is only automatically assigned to plain scalars. @@ -1488,241 +1438,234 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact // tag, for example like this: "! [0]" // if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); + throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"') } for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; + type = state.implicitTypes[typeIndex] if (type.resolve(state.result)) { // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; + state.result = type.construct(state.result) + state.tag = type.tag if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; + state.anchorMap[state.anchor] = state.result } - break; + break } } } else if (state.tag !== '!') { if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; + type = state.typeMap[state.kind || 'fallback'][state.tag] } else { // looking for multi type - type = null; - typeList = state.typeMap.multi[state.kind || 'fallback']; + type = null + typeList = state.typeMap.multi[state.kind || 'fallback'] for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { - type = typeList[typeIndex]; - break; + type = typeList[typeIndex] + break } } } if (!type) { - throwError(state, 'unknown tag !<' + state.tag + '>'); + throwError(state, 'unknown tag !<' + state.tag + '>') } if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); + throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"') } if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); + throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag') } else { - state.result = type.construct(state.result, state.tag); + state.result = type.construct(state.result, state.tag) if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; + state.anchorMap[state.anchor] = state.result } } } if (state.listener !== null) { - state.listener('close', state); + state.listener('close', state) } - return state.tag !== null || state.anchor !== null || hasContent; + return state.tag !== null || state.anchor !== null || hasContent } -function readDocument(state) { +function readDocument (state) { var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, - ch; + ch - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = Object.create(null); - state.anchorMap = Object.create(null); + state.version = null + state.checkLineBreaks = state.legacy + state.tagMap = Object.create(null) + state.anchorMap = Object.create(null) while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); + skipSeparationSpace(state, true, -1) - ch = state.input.charCodeAt(state.position); + ch = state.input.charCodeAt(state.position) if (state.lineIndent > 0 || ch !== 0x25/* % */) { - break; + break } - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; + hasDirectives = true + ch = state.input.charCodeAt(++state.position) + _position = state.position while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; + directiveName = state.input.slice(_position, state.position) + directiveArgs = [] if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); + throwError(state, 'directive name must not be less than one character in length') } while (ch !== 0) { while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } if (ch === 0x23/* # */) { - do { ch = state.input.charCodeAt(++state.position); } - while (ch !== 0 && !is_EOL(ch)); - break; + do { ch = state.input.charCodeAt(++state.position) } + while (ch !== 0 && !is_EOL(ch)) + break } - if (is_EOL(ch)) break; + if (is_EOL(ch)) break - _position = state.position; + _position = state.position while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); + ch = state.input.charCodeAt(++state.position) } - directiveArgs.push(state.input.slice(_position, state.position)); + directiveArgs.push(state.input.slice(_position, state.position)) } - if (ch !== 0) readLineBreak(state); + if (ch !== 0) readLineBreak(state) if (_hasOwnProperty.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); + directiveHandlers[directiveName](state, directiveName, directiveArgs) } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); + throwWarning(state, 'unknown document directive "' + directiveName + '"') } } - skipSeparationSpace(state, true, -1); + skipSeparationSpace(state, true, -1) if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 0x2D/* - */ && state.input.charCodeAt(state.position + 1) === 0x2D/* - */ && state.input.charCodeAt(state.position + 2) === 0x2D/* - */) { - state.position += 3; - skipSeparationSpace(state, true, -1); - + state.position += 3 + skipSeparationSpace(state, true, -1) } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); + throwError(state, 'directives end mark is expected') } - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); + composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true) + skipSeparationSpace(state, true, -1) if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); + throwWarning(state, 'non-ASCII line breaks are interpreted as content') } - state.documents.push(state.result); + state.documents.push(state.result) if (state.position === state.lineStart && testDocumentSeparator(state)) { - if (state.input.charCodeAt(state.position) === 0x2E/* . */) { - state.position += 3; - skipSeparationSpace(state, true, -1); + state.position += 3 + skipSeparationSpace(state, true, -1) } - return; + return } if (state.position < (state.length - 1)) { - throwError(state, 'end of the stream or a document separator is expected'); + throwError(state, 'end of the stream or a document separator is expected') } else { - return; + return } } - -function loadDocuments(input, options) { - input = String(input); - options = options || {}; +function loadDocuments (input, options) { + input = String(input) + options = options || {} if (input.length !== 0) { - // Add tailing `\n` if not exists if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ && input.charCodeAt(input.length - 1) !== 0x0D/* CR */) { - input += '\n'; + input += '\n' } // Strip BOM if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); + input = input.slice(1) } } - var state = new State(input, options); + var state = new State(input, options) - var nullpos = input.indexOf('\0'); + var nullpos = input.indexOf('\0') if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); + state.position = nullpos + throwError(state, 'null byte is not allowed in input') } // Use 0 as string terminator. That significantly simplifies bounds check. - state.input += '\0'; + state.input += '\0' while (state.input.charCodeAt(state.position) === 0x20/* Space */) { - state.lineIndent += 1; - state.position += 1; + state.lineIndent += 1 + state.position += 1 } while (state.position < (state.length - 1)) { - readDocument(state); + readDocument(state) } - return state.documents; + return state.documents } - -function loadAll(input, iterator, options) { +function loadAll (input, iterator, options) { if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; + options = iterator + iterator = null } - var documents = loadDocuments(input, options); + var documents = loadDocuments(input, options) if (typeof iterator !== 'function') { - return documents; + return documents } for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); + iterator(documents[index]) } } - -function load(input, options) { - var documents = loadDocuments(input, options); +function load (input, options) { + var documents = loadDocuments(input, options) if (documents.length === 0) { - return undefined; + return undefined } else if (documents.length === 1) { - return documents[0]; + return documents[0] } - throw new YAMLException('expected a single document in the stream, but found more'); + throw new YAMLException('expected a single document in the stream, but found more') } - -module.exports.loadAll = loadAll; -module.exports.load = load; +module.exports.loadAll = loadAll +module.exports.load = load diff --git a/lib/schema.js b/lib/schema.js index 536f4147..76829a44 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -1,32 +1,29 @@ -'use strict'; +'use strict' -var YAMLException = require('./exception'); -var Type = require('./type'); +var YAMLException = require('./exception') +var Type = require('./type') - -function compileList(schema, name) { - var result = []; +function compileList (schema, name) { + var result = [] schema[name].forEach(function (currentType) { - var newIndex = result.length; + var newIndex = result.length result.forEach(function (previousType, previousIndex) { if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) { - - newIndex = previousIndex; + newIndex = previousIndex } - }); + }) - result[newIndex] = currentType; - }); + result[newIndex] = currentType + }) - return result; + return result } - -function compileMap(/* lists... */) { +function compileMap (/* lists... */) { var result = { scalar: {}, sequence: {}, @@ -38,82 +35,76 @@ function compileMap(/* lists... */) { mapping: [], fallback: [] } - }, index, length; + }, index, length - function collectType(type) { + function collectType (type) { if (type.multi) { - result.multi[type.kind].push(type); - result.multi['fallback'].push(type); + result.multi[type.kind].push(type) + result.multi['fallback'].push(type) } else { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; + result[type.kind][type.tag] = result['fallback'][type.tag] = type } } for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); + arguments[index].forEach(collectType) } - return result; + return result } - -function Schema(definition) { - return this.extend(definition); +function Schema (definition) { + return this.extend(definition) } - -Schema.prototype.extend = function extend(definition) { - var implicit = []; - var explicit = []; +Schema.prototype.extend = function extend (definition) { + var implicit = [] + var explicit = [] if (definition instanceof Type) { // Schema.extend(type) - explicit.push(definition); - + explicit.push(definition) } else if (Array.isArray(definition)) { // Schema.extend([ type1, type2, ... ]) - explicit = explicit.concat(definition); - + explicit = explicit.concat(definition) } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) { // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] }) - if (definition.implicit) implicit = implicit.concat(definition.implicit); - if (definition.explicit) explicit = explicit.concat(definition.explicit); - + if (definition.implicit) implicit = implicit.concat(definition.implicit) + if (definition.explicit) explicit = explicit.concat(definition.explicit) } else { throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' + - 'or a schema definition ({ implicit: [...], explicit: [...] })'); + 'or a schema definition ({ implicit: [...], explicit: [...] })') } implicit.forEach(function (type) { if (!(type instanceof Type)) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.') } if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); + throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.') } if (type.multi) { - throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.'); + throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.') } - }); + }) explicit.forEach(function (type) { if (!(type instanceof Type)) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.') } - }); + }) - var result = Object.create(Schema.prototype); + var result = Object.create(Schema.prototype) - result.implicit = (this.implicit || []).concat(implicit); - result.explicit = (this.explicit || []).concat(explicit); + result.implicit = (this.implicit || []).concat(implicit) + result.explicit = (this.explicit || []).concat(explicit) - result.compiledImplicit = compileList(result, 'implicit'); - result.compiledExplicit = compileList(result, 'explicit'); - result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit); - - return result; -}; + result.compiledImplicit = compileList(result, 'implicit') + result.compiledExplicit = compileList(result, 'explicit') + result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit) + return result +} -module.exports = Schema; +module.exports = Schema diff --git a/lib/schema/core.js b/lib/schema/core.js index 608b26de..2660239d 100644 --- a/lib/schema/core.js +++ b/lib/schema/core.js @@ -4,8 +4,6 @@ // NOTE: JS-YAML does not support schema-specific tag resolution restrictions. // So, Core schema has no distinctions from JSON schema is JS-YAML. +'use strict' -'use strict'; - - -module.exports = require('./json'); +module.exports = require('./json') diff --git a/lib/schema/default.js b/lib/schema/default.js index 3af0520d..fb232d6d 100644 --- a/lib/schema/default.js +++ b/lib/schema/default.js @@ -4,9 +4,7 @@ // This schema is based on standard YAML's Core schema and includes most of // extra types described at YAML tag repository. (http://yaml.org/type/) - -'use strict'; - +'use strict' module.exports = require('./core').extend({ implicit: [ @@ -19,4 +17,4 @@ module.exports = require('./core').extend({ require('../type/pairs'), require('../type/set') ] -}); +}) diff --git a/lib/schema/failsafe.js b/lib/schema/failsafe.js index b7a33eb7..77578a61 100644 --- a/lib/schema/failsafe.js +++ b/lib/schema/failsafe.js @@ -1,12 +1,9 @@ // Standard YAML's Failsafe schema. // http://www.yaml.org/spec/1.2/spec.html#id2802346 +'use strict' -'use strict'; - - -var Schema = require('../schema'); - +var Schema = require('../schema') module.exports = new Schema({ explicit: [ @@ -14,4 +11,4 @@ module.exports = new Schema({ require('../type/seq'), require('../type/map') ] -}); +}) diff --git a/lib/schema/json.js b/lib/schema/json.js index b73df78e..ac75fa2b 100644 --- a/lib/schema/json.js +++ b/lib/schema/json.js @@ -5,9 +5,7 @@ // So, this schema is not such strict as defined in the YAML specification. // It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - -'use strict'; - +'use strict' module.exports = require('./failsafe').extend({ implicit: [ @@ -16,4 +14,4 @@ module.exports = require('./failsafe').extend({ require('../type/int'), require('../type/float') ] -}); +}) diff --git a/lib/snippet.js b/lib/snippet.js index 00e2133c..0ea4fdbe 100644 --- a/lib/snippet.js +++ b/lib/snippet.js @@ -1,101 +1,96 @@ -'use strict'; - - -var common = require('./common'); +'use strict' +var common = require('./common') // get snippet for a single line, respecting maxLength -function getLine(buffer, lineStart, lineEnd, position, maxLineLength) { - var head = ''; - var tail = ''; - var maxHalfLength = Math.floor(maxLineLength / 2) - 1; +function getLine (buffer, lineStart, lineEnd, position, maxLineLength) { + var head = '' + var tail = '' + var maxHalfLength = Math.floor(maxLineLength / 2) - 1 if (position - lineStart > maxHalfLength) { - head = ' ... '; - lineStart = position - maxHalfLength + head.length; + head = ' ... ' + lineStart = position - maxHalfLength + head.length } if (lineEnd - position > maxHalfLength) { - tail = ' ...'; - lineEnd = position + maxHalfLength - tail.length; + tail = ' ...' + lineEnd = position + maxHalfLength - tail.length } return { str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, '→') + tail, pos: position - lineStart + head.length // relative position - }; + } } - -function padStart(string, max) { - return common.repeat(' ', max - string.length) + string; +function padStart (string, max) { + return common.repeat(' ', max - string.length) + string } +function makeSnippet (mark, options) { + options = Object.create(options || null) -function makeSnippet(mark, options) { - options = Object.create(options || null); - - if (!mark.buffer) return null; + if (!mark.buffer) return null - if (!options.maxLength) options.maxLength = 79; - if (typeof options.indent !== 'number') options.indent = 1; - if (typeof options.linesBefore !== 'number') options.linesBefore = 3; - if (typeof options.linesAfter !== 'number') options.linesAfter = 2; + if (!options.maxLength) options.maxLength = 79 + if (typeof options.indent !== 'number') options.indent = 1 + if (typeof options.linesBefore !== 'number') options.linesBefore = 3 + if (typeof options.linesAfter !== 'number') options.linesAfter = 2 - var re = /\r?\n|\r|\0/g; - var lineStarts = [ 0 ]; - var lineEnds = []; - var match; - var foundLineNo = -1; + var re = /\r?\n|\r|\0/g + var lineStarts = [0] + var lineEnds = [] + var match + var foundLineNo = -1 while ((match = re.exec(mark.buffer))) { - lineEnds.push(match.index); - lineStarts.push(match.index + match[0].length); + lineEnds.push(match.index) + lineStarts.push(match.index + match[0].length) if (mark.position <= match.index && foundLineNo < 0) { - foundLineNo = lineStarts.length - 2; + foundLineNo = lineStarts.length - 2 } } - if (foundLineNo < 0) foundLineNo = lineStarts.length - 1; + if (foundLineNo < 0) foundLineNo = lineStarts.length - 1 - var result = '', i, line; - var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length; - var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3); + var result = '', i, line + var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length + var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3) for (i = 1; i <= options.linesBefore; i++) { - if (foundLineNo - i < 0) break; + if (foundLineNo - i < 0) break line = getLine( mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength - ); + ) result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n' + result; + ' | ' + line.str + '\n' + result } - line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength); + line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength) result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n'; - result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n'; + ' | ' + line.str + '\n' + result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n' for (i = 1; i <= options.linesAfter; i++) { - if (foundLineNo + i >= lineEnds.length) break; + if (foundLineNo + i >= lineEnds.length) break line = getLine( mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength - ); + ) result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + - ' | ' + line.str + '\n'; + ' | ' + line.str + '\n' } - return result.replace(/\n$/, ''); + return result.replace(/\n$/, '') } - -module.exports = makeSnippet; +module.exports = makeSnippet diff --git a/lib/type.js b/lib/type.js index 5e57877f..39e972b1 100644 --- a/lib/type.js +++ b/lib/type.js @@ -1,6 +1,6 @@ -'use strict'; +'use strict' -var YAMLException = require('./exception'); +var YAMLException = require('./exception') var TYPE_CONSTRUCTOR_OPTIONS = [ 'kind', @@ -13,54 +13,54 @@ var TYPE_CONSTRUCTOR_OPTIONS = [ 'representName', 'defaultStyle', 'styleAliases' -]; +] var YAML_NODE_KINDS = [ 'scalar', 'sequence', 'mapping' -]; +] -function compileStyleAliases(map) { - var result = {}; +function compileStyleAliases (map) { + var result = {} if (map !== null) { Object.keys(map).forEach(function (style) { map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); + result[String(alias)] = style + }) + }) } - return result; + return result } -function Type(tag, options) { - options = options || {}; +function Type (tag, options) { + options = options || {} Object.keys(options).forEach(function (name) { if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); + throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.') } - }); + }) // TODO: Add tag format check. - this.options = options; // keep original options in case user wants to extend this type later - this.tag = tag; - this.kind = options['kind'] || null; - this.resolve = options['resolve'] || function () { return true; }; - this.construct = options['construct'] || function (data) { return data; }; - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.representName = options['representName'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.multi = options['multi'] || false; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); + this.options = options // keep original options in case user wants to extend this type later + this.tag = tag + this.kind = options['kind'] || null + this.resolve = options['resolve'] || function () { return true } + this.construct = options['construct'] || function (data) { return data } + this.instanceOf = options['instanceOf'] || null + this.predicate = options['predicate'] || null + this.represent = options['represent'] || null + this.representName = options['representName'] || null + this.defaultStyle = options['defaultStyle'] || null + this.multi = options['multi'] || false + this.styleAliases = compileStyleAliases(options['styleAliases'] || null) if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); + throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.') } } -module.exports = Type; +module.exports = Type diff --git a/lib/type/binary.js b/lib/type/binary.js index 801e1804..f449df14 100644 --- a/lib/type/binary.js +++ b/lib/type/binary.js @@ -1,116 +1,114 @@ -'use strict'; - -var Type = require('../type'); +'use strict' +var Type = require('../type') // [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - +var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r' -function resolveYamlBinary(data) { - if (data === null) return false; +function resolveYamlBinary (data) { + if (data === null) return false - var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; + var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP // Convert one by one. for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); + code = map.indexOf(data.charAt(idx)) // Skip CR/LF - if (code > 64) continue; + if (code > 64) continue // Fail on illegal characters - if (code < 0) return false; + if (code < 0) return false - bitlen += 6; + bitlen += 6 } // If there are any bits left, source was corrupted - return (bitlen % 8) === 0; + return (bitlen % 8) === 0 } -function constructYamlBinary(data) { +function constructYamlBinary (data) { var idx, tailbits, input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan max = input.length, map = BASE64_MAP, bits = 0, - result = []; + result = [] // Collect by 6*4 bits (3 bytes) for (idx = 0; idx < max; idx++) { if ((idx % 4 === 0) && idx) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); + result.push((bits >> 16) & 0xFF) + result.push((bits >> 8) & 0xFF) + result.push(bits & 0xFF) } - bits = (bits << 6) | map.indexOf(input.charAt(idx)); + bits = (bits << 6) | map.indexOf(input.charAt(idx)) } // Dump tail - tailbits = (max % 4) * 6; + tailbits = (max % 4) * 6 if (tailbits === 0) { - result.push((bits >> 16) & 0xFF); - result.push((bits >> 8) & 0xFF); - result.push(bits & 0xFF); + result.push((bits >> 16) & 0xFF) + result.push((bits >> 8) & 0xFF) + result.push(bits & 0xFF) } else if (tailbits === 18) { - result.push((bits >> 10) & 0xFF); - result.push((bits >> 2) & 0xFF); + result.push((bits >> 10) & 0xFF) + result.push((bits >> 2) & 0xFF) } else if (tailbits === 12) { - result.push((bits >> 4) & 0xFF); + result.push((bits >> 4) & 0xFF) } - return new Uint8Array(result); + return new Uint8Array(result) } -function representYamlBinary(object /*, style*/) { +function representYamlBinary (object /*, style */) { var result = '', bits = 0, idx, tail, max = object.length, - map = BASE64_MAP; + map = BASE64_MAP // Convert every three bytes to 4 ASCII characters. for (idx = 0; idx < max; idx++) { if ((idx % 3 === 0) && idx) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; + result += map[(bits >> 18) & 0x3F] + result += map[(bits >> 12) & 0x3F] + result += map[(bits >> 6) & 0x3F] + result += map[bits & 0x3F] } - bits = (bits << 8) + object[idx]; + bits = (bits << 8) + object[idx] } // Dump tail - tail = max % 3; + tail = max % 3 if (tail === 0) { - result += map[(bits >> 18) & 0x3F]; - result += map[(bits >> 12) & 0x3F]; - result += map[(bits >> 6) & 0x3F]; - result += map[bits & 0x3F]; + result += map[(bits >> 18) & 0x3F] + result += map[(bits >> 12) & 0x3F] + result += map[(bits >> 6) & 0x3F] + result += map[bits & 0x3F] } else if (tail === 2) { - result += map[(bits >> 10) & 0x3F]; - result += map[(bits >> 4) & 0x3F]; - result += map[(bits << 2) & 0x3F]; - result += map[64]; + result += map[(bits >> 10) & 0x3F] + result += map[(bits >> 4) & 0x3F] + result += map[(bits << 2) & 0x3F] + result += map[64] } else if (tail === 1) { - result += map[(bits >> 2) & 0x3F]; - result += map[(bits << 4) & 0x3F]; - result += map[64]; - result += map[64]; + result += map[(bits >> 2) & 0x3F] + result += map[(bits << 4) & 0x3F] + result += map[64] + result += map[64] } - return result; + return result } -function isBinary(obj) { - return Object.prototype.toString.call(obj) === '[object Uint8Array]'; +function isBinary (obj) { + return Object.prototype.toString.call(obj) === '[object Uint8Array]' } module.exports = new Type('tag:yaml.org,2002:binary', { @@ -119,4 +117,4 @@ module.exports = new Type('tag:yaml.org,2002:binary', { construct: constructYamlBinary, predicate: isBinary, represent: representYamlBinary -}); +}) diff --git a/lib/type/bool.js b/lib/type/bool.js index cb774593..bac7a46d 100644 --- a/lib/type/bool.js +++ b/lib/type/bool.js @@ -1,24 +1,24 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') -function resolveYamlBoolean(data) { - if (data === null) return false; +function resolveYamlBoolean (data) { + if (data === null) return false - var max = data.length; + var max = data.length return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); + (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')) } -function constructYamlBoolean(data) { +function constructYamlBoolean (data) { return data === 'true' || data === 'True' || - data === 'TRUE'; + data === 'TRUE' } -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; +function isBoolean (object) { + return Object.prototype.toString.call(object) === '[object Boolean]' } module.exports = new Type('tag:yaml.org,2002:bool', { @@ -27,9 +27,9 @@ module.exports = new Type('tag:yaml.org,2002:bool', { construct: constructYamlBoolean, predicate: isBoolean, represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } + lowercase: function (object) { return object ? 'true' : 'false' }, + uppercase: function (object) { return object ? 'TRUE' : 'FALSE' }, + camelcase: function (object) { return object ? 'True' : 'False' } }, defaultStyle: 'lowercase' -}); +}) diff --git a/lib/type/float.js b/lib/type/float.js index 74d77ec2..341f87d5 100644 --- a/lib/type/float.js +++ b/lib/type/float.js @@ -1,7 +1,7 @@ -'use strict'; +'use strict' -var common = require('../common'); -var Type = require('../type'); +var common = require('../common') +var Type = require('../type') var YAML_FLOAT_PATTERN = new RegExp( // 2.5e4, 2.5 and integers @@ -12,79 +12,77 @@ var YAML_FLOAT_PATTERN = new RegExp( // .inf '|[-+]?\\.(?:inf|Inf|INF)' + // .nan - '|\\.(?:nan|NaN|NAN))$'); + '|\\.(?:nan|NaN|NAN))$') -function resolveYamlFloat(data) { - if (data === null) return false; +function resolveYamlFloat (data) { + if (data === null) return false if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_` // Probably should update regexp & check speed data[data.length - 1] === '_') { - return false; + return false } - return true; + return true } -function constructYamlFloat(data) { - var value, sign; +function constructYamlFloat (data) { + var value, sign - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; + value = data.replace(/_/g, '').toLowerCase() + sign = value[0] === '-' ? -1 : 1 if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); + value = value.slice(1) } if (value === '.inf') { - return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - + return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY } else if (value === '.nan') { - return NaN; + return NaN } - return sign * parseFloat(value, 10); + return sign * parseFloat(value, 10) } +var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/ -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - -function representYamlFloat(object, style) { - var res; +function representYamlFloat (object, style) { + var res if (isNaN(object)) { switch (style) { - case 'lowercase': return '.nan'; - case 'uppercase': return '.NAN'; - case 'camelcase': return '.NaN'; + case 'lowercase': return '.nan' + case 'uppercase': return '.NAN' + case 'camelcase': return '.NaN' } } else if (Number.POSITIVE_INFINITY === object) { switch (style) { - case 'lowercase': return '.inf'; - case 'uppercase': return '.INF'; - case 'camelcase': return '.Inf'; + case 'lowercase': return '.inf' + case 'uppercase': return '.INF' + case 'camelcase': return '.Inf' } } else if (Number.NEGATIVE_INFINITY === object) { switch (style) { - case 'lowercase': return '-.inf'; - case 'uppercase': return '-.INF'; - case 'camelcase': return '-.Inf'; + case 'lowercase': return '-.inf' + case 'uppercase': return '-.INF' + case 'camelcase': return '-.Inf' } } else if (common.isNegativeZero(object)) { - return '-0.0'; + return '-0.0' } - res = object.toString(10); + res = object.toString(10) // JS stringifier can build scientific format without dots: 5e-100, // while YAML requres dot: 5.e-100. Fix it with simple hack - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; + return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res } -function isFloat(object) { +function isFloat (object) { return (Object.prototype.toString.call(object) === '[object Number]') && - (object % 1 !== 0 || common.isNegativeZero(object)); + (object % 1 !== 0 || common.isNegativeZero(object)) } module.exports = new Type('tag:yaml.org,2002:float', { @@ -94,4 +92,4 @@ module.exports = new Type('tag:yaml.org,2002:float', { predicate: isFloat, represent: representYamlFloat, defaultStyle: 'lowercase' -}); +}) diff --git a/lib/type/int.js b/lib/type/int.js index e4271fc3..06e94050 100644 --- a/lib/type/int.js +++ b/lib/type/int.js @@ -1,137 +1,135 @@ -'use strict'; +'use strict' -var common = require('../common'); -var Type = require('../type'); +var common = require('../common') +var Type = require('../type') -function isHexCode(c) { +function isHexCode (c) { return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); + ((0x61/* a */ <= c) && (c <= 0x66/* f */)) } -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); +function isOctCode (c) { + return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)) } -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); +function isDecCode (c) { + return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) } -function resolveYamlInteger(data) { - if (data === null) return false; +function resolveYamlInteger (data) { + if (data === null) return false var max = data.length, index = 0, hasDigits = false, - ch; + ch - if (!max) return false; + if (!max) return false - ch = data[index]; + ch = data[index] // sign if (ch === '-' || ch === '+') { - ch = data[++index]; + ch = data[++index] } if (ch === '0') { // 0 - if (index + 1 === max) return true; - ch = data[++index]; + if (index + 1 === max) return true + ch = data[++index] // base 2, base 8, base 16 if (ch === 'b') { // base 2 - index++; + index++ for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; + ch = data[index] + if (ch === '_') continue + if (ch !== '0' && ch !== '1') return false + hasDigits = true } - return hasDigits && ch !== '_'; + return hasDigits && ch !== '_' } - if (ch === 'x') { // base 16 - index++; + index++ for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; + ch = data[index] + if (ch === '_') continue + if (!isHexCode(data.charCodeAt(index))) return false + hasDigits = true } - return hasDigits && ch !== '_'; + return hasDigits && ch !== '_' } - if (ch === 'o') { // base 8 - index++; + index++ for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; + ch = data[index] + if (ch === '_') continue + if (!isOctCode(data.charCodeAt(index))) return false + hasDigits = true } - return hasDigits && ch !== '_'; + return hasDigits && ch !== '_' } } // base 10 (except 0) // value should not start with `_`; - if (ch === '_') return false; + if (ch === '_') return false for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; + ch = data[index] + if (ch === '_') continue if (!isDecCode(data.charCodeAt(index))) { - return false; + return false } - hasDigits = true; + hasDigits = true } // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; + if (!hasDigits || ch === '_') return false - return true; + return true } -function constructYamlInteger(data) { - var value = data, sign = 1, ch; +function constructYamlInteger (data) { + var value = data, sign = 1, ch if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); + value = value.replace(/_/g, '') } - ch = value[0]; + ch = value[0] if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; + if (ch === '-') sign = -1 + value = value.slice(1) + ch = value[0] } - if (value === '0') return 0; + if (value === '0') return 0 if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value.slice(2), 16); - if (value[1] === 'o') return sign * parseInt(value.slice(2), 8); + if (value[1] === 'b') return sign * parseInt(value.slice(2), 2) + if (value[1] === 'x') return sign * parseInt(value.slice(2), 16) + if (value[1] === 'o') return sign * parseInt(value.slice(2), 8) } - return sign * parseInt(value, 10); + return sign * parseInt(value, 10) } -function isInteger(object) { +function isInteger (object) { return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); + (object % 1 === 0 && !common.isNegativeZero(object)) } module.exports = new Type('tag:yaml.org,2002:int', { @@ -140,16 +138,16 @@ module.exports = new Type('tag:yaml.org,2002:int', { construct: constructYamlInteger, predicate: isInteger, represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } + binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1) }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1) }, + decimal: function (obj) { return obj.toString(10) }, + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1) } }, defaultStyle: 'decimal', styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] + binary: [2, 'bin'], + octal: [8, 'oct'], + decimal: [10, 'dec'], + hexadecimal: [16, 'hex'] } -}); +}) diff --git a/lib/type/map.js b/lib/type/map.js index f327beeb..5be7c724 100644 --- a/lib/type/map.js +++ b/lib/type/map.js @@ -1,8 +1,8 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') module.exports = new Type('tag:yaml.org,2002:map', { kind: 'mapping', - construct: function (data) { return data !== null ? data : {}; } -}); + construct: function (data) { return data !== null ? data : {} } +}) diff --git a/lib/type/merge.js b/lib/type/merge.js index ae08a864..b42b81d9 100644 --- a/lib/type/merge.js +++ b/lib/type/merge.js @@ -1,12 +1,12 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') -function resolveYamlMerge(data) { - return data === '<<' || data === null; +function resolveYamlMerge (data) { + return data === '<<' || data === null } module.exports = new Type('tag:yaml.org,2002:merge', { kind: 'scalar', resolve: resolveYamlMerge -}); +}) diff --git a/lib/type/null.js b/lib/type/null.js index 315ca4e2..72b524c5 100644 --- a/lib/type/null.js +++ b/lib/type/null.js @@ -1,22 +1,22 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') -function resolveYamlNull(data) { - if (data === null) return true; +function resolveYamlNull (data) { + if (data === null) return true - var max = data.length; + var max = data.length return (max === 1 && data === '~') || - (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')); + (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')) } -function constructYamlNull() { - return null; +function constructYamlNull () { + return null } -function isNull(object) { - return object === null; +function isNull (object) { + return object === null } module.exports = new Type('tag:yaml.org,2002:null', { @@ -25,11 +25,11 @@ module.exports = new Type('tag:yaml.org,2002:null', { construct: constructYamlNull, predicate: isNull, represent: { - canonical: function () { return '~'; }, - lowercase: function () { return 'null'; }, - uppercase: function () { return 'NULL'; }, - camelcase: function () { return 'Null'; }, - empty: function () { return ''; } + canonical: function () { return '~' }, + lowercase: function () { return 'null' }, + uppercase: function () { return 'NULL' }, + camelcase: function () { return 'Null' }, + empty: function () { return '' } }, defaultStyle: 'lowercase' -}); +}) diff --git a/lib/type/omap.js b/lib/type/omap.js index b2b5323b..6b56af45 100644 --- a/lib/type/omap.js +++ b/lib/type/omap.js @@ -1,44 +1,44 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var _toString = Object.prototype.toString; +var _hasOwnProperty = Object.prototype.hasOwnProperty +var _toString = Object.prototype.toString -function resolveYamlOmap(data) { - if (data === null) return true; +function resolveYamlOmap (data) { + if (data === null) return true var objectKeys = [], index, length, pair, pairKey, pairHasKey, - object = data; + object = data for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; + pair = object[index] + pairHasKey = false - if (_toString.call(pair) !== '[object Object]') return false; + if (_toString.call(pair) !== '[object Object]') return false for (pairKey in pair) { if (_hasOwnProperty.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true; - else return false; + if (!pairHasKey) pairHasKey = true + else return false } } - if (!pairHasKey) return false; + if (!pairHasKey) return false - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); - else return false; + if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey) + else return false } - return true; + return true } -function constructYamlOmap(data) { - return data !== null ? data : []; +function constructYamlOmap (data) { + return data !== null ? data : [] } module.exports = new Type('tag:yaml.org,2002:omap', { kind: 'sequence', resolve: resolveYamlOmap, construct: constructYamlOmap -}); +}) diff --git a/lib/type/pairs.js b/lib/type/pairs.js index 74b52403..98c24c5c 100644 --- a/lib/type/pairs.js +++ b/lib/type/pairs.js @@ -1,53 +1,53 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') -var _toString = Object.prototype.toString; +var _toString = Object.prototype.toString -function resolveYamlPairs(data) { - if (data === null) return true; +function resolveYamlPairs (data) { + if (data === null) return true var index, length, pair, keys, result, - object = data; + object = data - result = new Array(object.length); + result = new Array(object.length) for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; + pair = object[index] - if (_toString.call(pair) !== '[object Object]') return false; + if (_toString.call(pair) !== '[object Object]') return false - keys = Object.keys(pair); + keys = Object.keys(pair) - if (keys.length !== 1) return false; + if (keys.length !== 1) return false - result[index] = [ keys[0], pair[keys[0]] ]; + result[index] = [keys[0], pair[keys[0]]] } - return true; + return true } -function constructYamlPairs(data) { - if (data === null) return []; +function constructYamlPairs (data) { + if (data === null) return [] var index, length, pair, keys, result, - object = data; + object = data - result = new Array(object.length); + result = new Array(object.length) for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; + pair = object[index] - keys = Object.keys(pair); + keys = Object.keys(pair) - result[index] = [ keys[0], pair[keys[0]] ]; + result[index] = [keys[0], pair[keys[0]]] } - return result; + return result } module.exports = new Type('tag:yaml.org,2002:pairs', { kind: 'sequence', resolve: resolveYamlPairs, construct: constructYamlPairs -}); +}) diff --git a/lib/type/seq.js b/lib/type/seq.js index be8f77f2..eeb72425 100644 --- a/lib/type/seq.js +++ b/lib/type/seq.js @@ -1,8 +1,8 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') module.exports = new Type('tag:yaml.org,2002:seq', { kind: 'sequence', - construct: function (data) { return data !== null ? data : []; } -}); + construct: function (data) { return data !== null ? data : [] } +}) diff --git a/lib/type/set.js b/lib/type/set.js index f885a329..00602d9d 100644 --- a/lib/type/set.js +++ b/lib/type/set.js @@ -1,29 +1,29 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') -var _hasOwnProperty = Object.prototype.hasOwnProperty; +var _hasOwnProperty = Object.prototype.hasOwnProperty -function resolveYamlSet(data) { - if (data === null) return true; +function resolveYamlSet (data) { + if (data === null) return true - var key, object = data; + var key, object = data for (key in object) { if (_hasOwnProperty.call(object, key)) { - if (object[key] !== null) return false; + if (object[key] !== null) return false } } - return true; + return true } -function constructYamlSet(data) { - return data !== null ? data : {}; +function constructYamlSet (data) { + return data !== null ? data : {} } module.exports = new Type('tag:yaml.org,2002:set', { kind: 'mapping', resolve: resolveYamlSet, construct: constructYamlSet -}); +}) diff --git a/lib/type/str.js b/lib/type/str.js index 27acc106..128d90d7 100644 --- a/lib/type/str.js +++ b/lib/type/str.js @@ -1,8 +1,8 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') module.exports = new Type('tag:yaml.org,2002:str', { kind: 'scalar', - construct: function (data) { return data !== null ? data : ''; } -}); + construct: function (data) { return data !== null ? data : '' } +}) diff --git a/lib/type/timestamp.js b/lib/type/timestamp.js index 8fa9c586..75ca0705 100644 --- a/lib/type/timestamp.js +++ b/lib/type/timestamp.js @@ -1,11 +1,11 @@ -'use strict'; +'use strict' -var Type = require('../type'); +var Type = require('../type') var YAML_DATE_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day + '-([0-9][0-9])$') // [3] day var YAML_TIMESTAMP_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year @@ -17,66 +17,66 @@ var YAML_TIMESTAMP_REGEXP = new RegExp( ':([0-9][0-9])' + // [6] second '(?:\\.([0-9]*))?' + // [7] fraction '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute + '(?::([0-9][0-9]))?))?$') // [11] tz_minute -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; +function resolveYamlTimestamp (data) { + if (data === null) return false + if (YAML_DATE_REGEXP.exec(data) !== null) return true + if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true + return false } -function constructYamlTimestamp(data) { +function constructYamlTimestamp (data) { var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; + delta = null, tz_hour, tz_minute, date - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); + match = YAML_DATE_REGEXP.exec(data) + if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data) - if (match === null) throw new Error('Date resolve error'); + if (match === null) throw new Error('Date resolve error') // match: [1] year [2] month [3] day - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); + year = +(match[1]) + month = +(match[2]) - 1 // JS month starts with 0 + day = +(match[3]) if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); + return new Date(Date.UTC(year, month, day)) } // match: [4] hour [5] minute [6] second [7] fraction - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); + hour = +(match[4]) + minute = +(match[5]) + second = +(match[6]) if (match[7]) { - fraction = match[7].slice(0, 3); + fraction = match[7].slice(0, 3) while (fraction.length < 3) { // milli-seconds - fraction += '0'; + fraction += '0' } - fraction = +fraction; + fraction = +fraction } // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; + tz_hour = +(match[10]) + tz_minute = +(match[11] || 0) + delta = (tz_hour * 60 + tz_minute) * 60000 // delta in mili-seconds + if (match[9] === '-') delta = -delta } - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)) - if (delta) date.setTime(date.getTime() - delta); + if (delta) date.setTime(date.getTime() - delta) - return date; + return date } -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); +function representYamlTimestamp (object /*, style */) { + return object.toISOString() } module.exports = new Type('tag:yaml.org,2002:timestamp', { @@ -85,4 +85,4 @@ module.exports = new Type('tag:yaml.org,2002:timestamp', { construct: constructYamlTimestamp, instanceOf: Date, represent: representYamlTimestamp -}); +}) diff --git a/support/build-dist.mjs b/support/build-dist.mjs index 2405355a..73fa5435 100644 --- a/support/build-dist.mjs +++ b/support/build-dist.mjs @@ -28,7 +28,7 @@ await build({ lib: { entry: 'lib/index_vite_proxy.tmp.mjs', name: 'jsyaml', - formats: [ 'umd' ], + formats: ['umd'], fileName: () => 'js-yaml.js' }, rollupOptions: { @@ -48,7 +48,7 @@ await build({ lib: { entry: 'lib/index_vite_proxy.tmp.mjs', name: 'jsyaml', - formats: [ 'umd' ], + formats: ['umd'], fileName: () => 'js-yaml.min.js' }, rollupOptions: { @@ -67,7 +67,7 @@ await build({ minify: false, lib: { entry: 'lib/index_vite_proxy.tmp.mjs', - formats: [ 'es' ], + formats: ['es'], fileName: () => 'js-yaml.mjs' }, rollupOptions: { diff --git a/support/build_demo.mjs b/support/build_demo.mjs index 41a018c2..345c35fa 100644 --- a/support/build_demo.mjs +++ b/support/build_demo.mjs @@ -8,7 +8,7 @@ await build({ root: 'support/demo_template', configFile: false, plugins: [ - nodePolyfills({ include: [ 'util' ] }), + nodePolyfills({ include: ['util'] }), viteSingleFile({ removeViteModuleLoader: true }) ], build: { diff --git a/support/demo_template/index.mjs b/support/demo_template/index.mjs index 9415f17d..e028a82e 100644 --- a/support/demo_template/index.mjs +++ b/support/demo_template/index.mjs @@ -8,81 +8,81 @@ import 'codemirror/mode/yaml/yaml.js' import 'codemirror/mode/javascript/javascript.js' import './demo.css' -var source, result, permalink, clear; +var source, result, permalink, clear -function encodeBase64(str) { - return btoa(String.fromCharCode(...new TextEncoder().encode(str))); +function encodeBase64 (str) { + return btoa(String.fromCharCode(...new TextEncoder().encode(str))) } -function decodeBase64(str) { +function decodeBase64 (str) { return new TextDecoder().decode(Uint8Array.from(atob(str), function (char) { - return char.charCodeAt(0); - })); + return char.charCodeAt(0) + })) } var SexyYamlType = new jsyaml.Type('!sexy', { kind: 'sequence', // See node kinds in YAML spec: http://www.yaml.org/spec/1.2/spec.html#kind// construct: function (data) { - return data.map(function (string) { return 'sexy ' + string; }); + return data.map(function (string) { return 'sexy ' + string }) } -}); +}) -var SEXY_SCHEMA = jsyaml.DEFAULT_SCHEMA.extend([ SexyYamlType ]); +var SEXY_SCHEMA = jsyaml.DEFAULT_SCHEMA.extend([SexyYamlType]) -function parse() { - var str, obj; +function parse () { + var str, obj - str = source.getValue(); - permalink.href = '#yaml=' + encodeBase64(str); + str = source.getValue() + permalink.href = '#yaml=' + encodeBase64(str) try { - obj = jsyaml.load(str, { schema: SEXY_SCHEMA }); + obj = jsyaml.load(str, { schema: SEXY_SCHEMA }) - result.setOption('mode', 'javascript'); - result.setValue(inspect(obj, false, 10)); + result.setOption('mode', 'javascript') + result.setValue(inspect(obj, false, 10)) } catch (err) { - result.setOption('mode', 'text/plain'); - result.setValue(err.message || String(err)); + result.setOption('mode', 'text/plain') + result.setValue(err.message || String(err)) } } -function updateSource() { - var yaml; +function updateSource () { + var yaml if (location.hash && location.hash.toString().slice(0, 6) === '#yaml=') { - yaml = decodeBase64(location.hash.slice(6)); + yaml = decodeBase64(location.hash.slice(6)) } - source.setValue(yaml || default_text); - parse(); + source.setValue(yaml || default_text) + parse() } window.onload = function () { - permalink = document.getElementById('permalink'); - clear = document.getElementById('clear'); + permalink = document.getElementById('permalink') + clear = document.getElementById('clear') source = codemirror.fromTextArea(document.getElementById('source'), { mode: 'yaml', lineNumbers: true - }); + }) - var timer; + var timer source.on('change', function () { - clearTimeout(timer); - timer = setTimeout(parse, 500); - }); + clearTimeout(timer) + timer = setTimeout(parse, 500) + }) result = codemirror.fromTextArea(document.getElementById('result'), { readOnly: true - }); + }) clear.addEventListener('click', function (event) { - event.preventDefault(); - source.setValue(''); - parse(); - }); + event.preventDefault() + source.setValue('') + parse() + }) // initial source - updateSource(); -}; + updateSource() +} diff --git a/test/build/dist.test.js b/test/build/dist.test.js index 8bb86bff..40d1238e 100644 --- a/test/build/dist.test.js +++ b/test/build/dist.test.js @@ -1,14 +1,13 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -const assert = require('assert'); -const fs = require('fs'); -const path = require('path'); -const vm = require('vm'); +const assert = require('assert') +const fs = require('fs') +const path = require('path') +const vm = require('vm') - -const distDir = path.resolve(__dirname, '../../dist'); +const distDir = path.resolve(__dirname, '../../dist') const expectedKeys = [ 'CORE_SCHEMA', @@ -26,61 +25,58 @@ const expectedKeys = [ 'safeLoad', 'safeLoadAll', 'types' -]; - +] -function checkExports(yaml, options) { - assert.deepStrictEqual(Object.keys(yaml).sort(), expectedKeys.slice().sort()); - assert.strictEqual(yaml.default.load, yaml.load); - assert.strictEqual(yaml.load('a: 1').a, 1); - assert.strictEqual(typeof yaml.dump, 'function'); - assert.strictEqual(typeof yaml.types.binary, 'object'); +function checkExports (yaml, options) { + assert.deepStrictEqual(Object.keys(yaml).sort(), expectedKeys.slice().sort()) + assert.strictEqual(yaml.default.load, yaml.load) + assert.strictEqual(yaml.load('a: 1').a, 1) + assert.strictEqual(typeof yaml.dump, 'function') + assert.strictEqual(typeof yaml.types.binary, 'object') if (options && options.checkEsModule) { - assert.strictEqual(yaml.__esModule, true); + assert.strictEqual(yaml.__esModule, true) } } +function loadGlobal (filename) { + const context = {} -function loadGlobal(filename) { - const context = {}; + vm.runInNewContext(fs.readFileSync(path.join(distDir, filename), 'utf8'), context) - vm.runInNewContext(fs.readFileSync(path.join(distDir, filename), 'utf8'), context); - - return context.jsyaml; + return context.jsyaml } - describe('dist build', function () { it('keeps Vite proxy exports in sync with the CommonJS entry', async function () { - const yaml = require('../../index.js'); - const proxy = await import('../../lib/index_vite_proxy.tmp.mjs'); + const yaml = require('../../index.js') + const proxy = await import('../../lib/index_vite_proxy.tmp.mjs') - assert.deepStrictEqual(Object.keys(proxy).sort(), Object.keys(yaml).concat('default').sort()); - assert.strictEqual(proxy.default, yaml); + assert.deepStrictEqual(Object.keys(proxy).sort(), Object.keys(yaml).concat('default').sort()) + assert.strictEqual(proxy.default, yaml) Object.keys(yaml).forEach(function (key) { - assert.strictEqual(proxy[key], yaml[key]); - }); - }); + assert.strictEqual(proxy[key], yaml[key]) + }) + }) it('exports the expected UMD API from js-yaml.js', function () { - checkExports(require('../../dist/js-yaml.js'), { checkEsModule: true }); - }); + checkExports(require('../../dist/js-yaml.js'), { checkEsModule: true }) + }) it('exports the expected UMD API from js-yaml.min.js', function () { - checkExports(require('../../dist/js-yaml.min.js'), { checkEsModule: true }); - }); + checkExports(require('../../dist/js-yaml.min.js'), { checkEsModule: true }) + }) it('exports the expected ESM API from js-yaml.mjs', async function () { - checkExports(await import('../../dist/js-yaml.mjs')); - }); + checkExports(await import('../../dist/js-yaml.mjs')) + }) it('exposes the expected browser global from js-yaml.js', function () { - checkExports(loadGlobal('js-yaml.js')); - }); + checkExports(loadGlobal('js-yaml.js')) + }) it('exposes the expected browser global from js-yaml.min.js', function () { - checkExports(loadGlobal('js-yaml.min.js')); - }); -}); + checkExports(loadGlobal('js-yaml.min.js')) + }) +}) diff --git a/test/core/00-units.test.js b/test/core/00-units.test.js index a8cb6896..a4590f2e 100644 --- a/test/core/00-units.test.js +++ b/test/core/00-units.test.js @@ -1,17 +1,16 @@ -'use strict'; +'use strict' -const { describe } = require('node:test'); - -var path = require('path'); -var fs = require('fs'); +const { describe } = require('node:test') +var path = require('path') +var fs = require('fs') describe('Units', function () { - var directory = path.resolve(__dirname, 'units'); + var directory = path.resolve(__dirname, 'units') fs.readdirSync(directory).forEach(function (file) { if (path.extname(file) === '.js') { - require(path.resolve(directory, file)); + require(path.resolve(directory, file)) } - }); -}); + }) +}) diff --git a/test/core/10-loader.test.js b/test/core/10-loader.test.js index 49a521e5..529b00ca 100644 --- a/test/core/10-loader.test.js +++ b/test/core/10-loader.test.js @@ -1,39 +1,38 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -var assert = require('assert'); -var path = require('path'); -var fs = require('fs'); -var yaml = require('js-yaml'); - -var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA; +var assert = require('assert') +var path = require('path') +var fs = require('fs') +var yaml = require('js-yaml') +var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA describe('Loader', function () { - var samplesDir = path.resolve(__dirname, 'samples-common'); + var samplesDir = path.resolve(__dirname, 'samples-common') fs.readdirSync(samplesDir).forEach(function (jsFile) { - if (path.extname(jsFile) !== '.js') return; // continue + if (path.extname(jsFile) !== '.js') return // continue - var yamlFile = path.resolve(samplesDir, path.basename(jsFile, '.js') + '.yml'); + var yamlFile = path.resolve(samplesDir, path.basename(jsFile, '.js') + '.yml') it(path.basename(jsFile, '.js'), function () { - var expected = require(path.resolve(samplesDir, jsFile)); - var actual = []; + var expected = require(path.resolve(samplesDir, jsFile)) + var actual = [] - yaml.loadAll(fs.readFileSync(yamlFile, { encoding: 'utf8' }), function (doc) { actual.push(doc); }, { + yaml.loadAll(fs.readFileSync(yamlFile, { encoding: 'utf8' }), function (doc) { actual.push(doc) }, { filename: yamlFile, schema: TEST_SCHEMA - }); + }) - if (actual.length === 1) actual = actual[0]; + if (actual.length === 1) actual = actual[0] if (typeof expected === 'function') { - expected.call(this, actual); + expected.call(this, actual) } else { - assert.deepStrictEqual(actual, expected); + assert.deepStrictEqual(actual, expected) } - }); - }); -}); + }) + }) +}) diff --git a/test/core/11-load-errors.test.js b/test/core/11-load-errors.test.js index 615c995e..1034e955 100644 --- a/test/core/11-load-errors.test.js +++ b/test/core/11-load-errors.test.js @@ -1,23 +1,22 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -var assert = require('assert'); -var path = require('path'); -var fs = require('fs'); -var yaml = require('js-yaml'); - -var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA; +var assert = require('assert') +var path = require('path') +var fs = require('fs') +var yaml = require('js-yaml') +var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA describe('Load errors', function () { - var samplesDir = path.resolve(__dirname, 'samples-load-errors'); + var samplesDir = path.resolve(__dirname, 'samples-load-errors') fs.readdirSync(samplesDir).forEach(function (sampleName) { - var yamlFile = path.resolve(samplesDir, sampleName); + var yamlFile = path.resolve(samplesDir, sampleName) it(path.basename(sampleName, '.yml'), function () { - var yamlSource = fs.readFileSync(yamlFile, { encoding: 'utf8' }); + var yamlSource = fs.readFileSync(yamlFile, { encoding: 'utf8' }) assert.throws(function () { yaml.loadAll( @@ -26,10 +25,10 @@ describe('Load errors', function () { { filename: yamlFile, schema: TEST_SCHEMA, - onWarning: function (e) { throw e; } + onWarning: function (e) { throw e } } - ); - }, yaml.YAMLException, yamlFile); - }); - }); -}); + ) + }, yaml.YAMLException, yamlFile) + }) + }) +}) diff --git a/test/core/20-dumper.test.js b/test/core/20-dumper.test.js index 188b9dd1..55c0a27e 100644 --- a/test/core/20-dumper.test.js +++ b/test/core/20-dumper.test.js @@ -1,32 +1,31 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -var assert = require('assert'); -var path = require('path'); -var fs = require('fs'); -var yaml = require('js-yaml'); - -var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA; +var assert = require('assert') +var path = require('path') +var fs = require('fs') +var yaml = require('js-yaml') +var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA describe('Dumper', function () { - var samplesDir = path.resolve(__dirname, 'samples-common'); + var samplesDir = path.resolve(__dirname, 'samples-common') fs.readdirSync(samplesDir).forEach(function (jsFile) { - if (path.extname(jsFile) !== '.js') return; // continue + if (path.extname(jsFile) !== '.js') return // continue it(path.basename(jsFile, '.js'), function () { - var sample = require(path.resolve(samplesDir, jsFile)); + var sample = require(path.resolve(samplesDir, jsFile)) var data = typeof sample === 'function' ? sample.expected : sample, serialized = yaml.dump(data, { schema: TEST_SCHEMA }), - deserialized = yaml.load(serialized, { schema: TEST_SCHEMA }); + deserialized = yaml.load(serialized, { schema: TEST_SCHEMA }) if (typeof sample === 'function') { - sample.call(this, deserialized); + sample.call(this, deserialized) } else { - assert.deepStrictEqual(deserialized, sample); + assert.deepStrictEqual(deserialized, sample) } - }); - }); -}); + }) + }) +}) diff --git a/test/core/25-dumper-fuzzy.test.js b/test/core/25-dumper-fuzzy.test.js index 5fcb53b8..307d5205 100644 --- a/test/core/25-dumper-fuzzy.test.js +++ b/test/core/25-dumper-fuzzy.test.js @@ -1,18 +1,18 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -var assert = require('assert'); -var fc = require('fast-check'); -var yaml = require('js-yaml'); +var assert = require('assert') +var fc = require('fast-check') +var yaml = require('js-yaml') // Generate valid YAML instances for yaml.safeDump -var key = fc.string({ unit: fc.nat({ max: 0xffff }).map(n => String.fromCharCode(n)) }); +var key = fc.string({ unit: fc.nat({ max: 0xffff }).map(n => String.fromCharCode(n)) }) var values = [ key, fc.boolean(), fc.integer(), fc.double(), fc.constantFrom(null, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) -]; -var yamlArbitrary = fc.object({ key: key, values: values }); +] +var yamlArbitrary = fc.object({ key: key, values: values }) // Generate valid options for yaml.safeDump configuration var dumpOptionsArbitrary = fc.record({ @@ -31,9 +31,9 @@ var dumpOptionsArbitrary = fc.record({ }, { requiredKeys: [] }) }, { requiredKeys: [] }) .map(function (instance) { - if (instance.condenseFlow === true && instance.flowLevel !== undefined) { instance.flowLevel = -1; } - return instance; - }); + if (instance.condenseFlow === true && instance.flowLevel !== undefined) { instance.flowLevel = -1 } + return instance + }) describe('Properties', function () { it('Load from dumped should be the original object', function () { @@ -41,9 +41,9 @@ describe('Properties', function () { yamlArbitrary, dumpOptionsArbitrary, function (obj, dumpOptions) { - var yamlContent = yaml.dump(obj, dumpOptions); - assert.ok(typeof yamlContent === 'string'); - assert.deepStrictEqual(yaml.load(yamlContent), obj); - })); - }); -}); + var yamlContent = yaml.dump(obj, dumpOptions) + assert.ok(typeof yamlContent === 'string') + assert.deepStrictEqual(yaml.load(yamlContent), obj) + })) + }) +}) diff --git a/test/core/30-issues.test.js b/test/core/30-issues.test.js index be903cf5..29a3e3fa 100644 --- a/test/core/30-issues.test.js +++ b/test/core/30-issues.test.js @@ -1,17 +1,16 @@ -'use strict'; +'use strict' -const { describe } = require('node:test'); - -var path = require('path'); -var fs = require('fs'); +const { describe } = require('node:test') +var path = require('path') +var fs = require('fs') describe('Issues', function () { - var issues = path.resolve(__dirname, 'issues'); + var issues = path.resolve(__dirname, 'issues') fs.readdirSync(issues).forEach(function (file) { if (path.extname(file) === '.js') { - require(path.resolve(issues, file)); + require(path.resolve(issues, file)) } - }); -}); + }) +}) diff --git a/test/core/issues/0008.js b/test/core/issues/0008.js index a74632fa..54f75901 100644 --- a/test/core/issues/0008.js +++ b/test/core/issues/0008.js @@ -1,15 +1,14 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Parse failed when no document start present', function () { assert.doesNotThrow(function () { yaml.load(` foo: !!str bar -`); - }, TypeError); -}); +`) + }, TypeError) +}) diff --git a/test/core/issues/0017.js b/test/core/issues/0017.js index e8856016..39b8230c 100644 --- a/test/core/issues/0017.js +++ b/test/core/issues/0017.js @@ -1,15 +1,14 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Non-specific "!" tags should resolve to !!str', function () { var data = yaml.load(` ! 12 -`); +`) - assert.strictEqual(typeof data, 'string'); -}); + assert.strictEqual(typeof data, 'string') +}) diff --git a/test/core/issues/0019.js b/test/core/issues/0019.js index e54237fb..7cbc4a36 100644 --- a/test/core/issues/0019.js +++ b/test/core/issues/0019.js @@ -1,18 +1,17 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Timestamp parsing is one month off', function () { var data = yaml.load(` --- xmas: 2011-12-24 ... -`); +`) // JS month starts with 0 (0 => Jan, 1 => Feb, ...) - assert.strictEqual(data.xmas.getTime(), Date.UTC(2011, 11, 24)); -}); + assert.strictEqual(data.xmas.getTime(), Date.UTC(2011, 11, 24)) +}) diff --git a/test/core/issues/0026.js b/test/core/issues/0026.js index 9e9aa6a3..c3485007 100644 --- a/test/core/issues/0026.js +++ b/test/core/issues/0026.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('should convert new line into white space', function () { var data = yaml.load(` @@ -12,7 +11,7 @@ test: > a b c -`); +`) - assert.strictEqual(data.test, 'a b c\n'); -}); + assert.strictEqual(data.test, 'a b c\n') +}) diff --git a/test/core/issues/0027.js b/test/core/issues/0027.js index a83414a4..50be946e 100644 --- a/test/core/issues/0027.js +++ b/test/core/issues/0027.js @@ -1,57 +1,55 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { describe, it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') describe('Should load numbers in YAML 1.2 format', function () { it('should not parse base60', function () { // previously parsed as int - assert.strictEqual(yaml.load('1:23'), '1:23'); + assert.strictEqual(yaml.load('1:23'), '1:23') // previously parsed as float - assert.strictEqual(yaml.load('1:23.45'), '1:23.45'); - }); + assert.strictEqual(yaml.load('1:23.45'), '1:23.45') + }) it('should allow leading zero in int and float', function () { - assert.strictEqual(yaml.load('01234'), 1234); - assert.strictEqual(yaml.load('00999'), 999); - assert.strictEqual(yaml.load('-00999'), -999); - assert.strictEqual(yaml.load('001234.56'), 1234.56); - assert.strictEqual(yaml.load('001234e4'), 12340000); - assert.strictEqual(yaml.load('-001234.56'), -1234.56); - assert.strictEqual(yaml.load('-001234e4'), -12340000); - }); + assert.strictEqual(yaml.load('01234'), 1234) + assert.strictEqual(yaml.load('00999'), 999) + assert.strictEqual(yaml.load('-00999'), -999) + assert.strictEqual(yaml.load('001234.56'), 1234.56) + assert.strictEqual(yaml.load('001234e4'), 12340000) + assert.strictEqual(yaml.load('-001234.56'), -1234.56) + assert.strictEqual(yaml.load('-001234e4'), -12340000) + }) it('should parse 0o prefix as octal', function () { - assert.strictEqual(yaml.load('0o1234'), 668); + assert.strictEqual(yaml.load('0o1234'), 668) // not valid octal - assert.strictEqual(yaml.load('0o1289'), '0o1289'); - }); -}); - + assert.strictEqual(yaml.load('0o1289'), '0o1289') + }) +}) describe('Should dump numbers in YAML 1.2 format', function () { it('should dump in different styles', function () { - assert.strictEqual(yaml.dump(123, { styles: { '!!int': 'binary' } }), '0b1111011\n'); - assert.strictEqual(yaml.dump(123, { styles: { '!!int': 'octal' } }), '0o173\n'); - assert.strictEqual(yaml.dump(123, { styles: { '!!int': 'hex' } }), '0x7B\n'); - }); + assert.strictEqual(yaml.dump(123, { styles: { '!!int': 'binary' } }), '0b1111011\n') + assert.strictEqual(yaml.dump(123, { styles: { '!!int': 'octal' } }), '0o173\n') + assert.strictEqual(yaml.dump(123, { styles: { '!!int': 'hex' } }), '0x7B\n') + }) it('should quote all potential numbers', function () { - var tests = '1:23 1:23.45 01234 0999 -01234 01234e4 01234.56 -01234.56 0x123 0o123'; + var tests = '1:23 1:23.45 01234 0999 -01234 01234e4 01234.56 -01234.56 0x123 0o123' tests.split(' ').forEach(function (sample) { - assert.strictEqual(yaml.dump(sample, { noCompatMode: false }), "'" + sample + "'\n"); - }); - }); + assert.strictEqual(yaml.dump(sample, { noCompatMode: false }), "'" + sample + "'\n") + }) + }) it('should not quote base60 in noCompatMode', function () { - var tests = '1:23 1:23.45'; + var tests = '1:23 1:23.45' tests.split(' ').forEach(function (sample) { - assert.strictEqual(yaml.dump(sample, { noCompatMode: true }), sample + '\n'); - }); - }); -}); + assert.strictEqual(yaml.dump(sample, { noCompatMode: true }), sample + '\n') + }) + }) +}) diff --git a/test/core/issues/0033.js b/test/core/issues/0033.js index be7a2947..7a227af9 100644 --- a/test/core/issues/0033.js +++ b/test/core/issues/0033.js @@ -1,17 +1,16 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('refactor compact variant of MarkedYAMLError.toString', function () { var source = ` foo: {bar} baz -`; +` assert.throws(function () { - yaml.load(source); - }, "require('issue-33.yml') should throw, but it does not"); -}); + yaml.load(source) + }, "require('issue-33.yml') should throw, but it does not") +}) diff --git a/test/core/issues/0046.js b/test/core/issues/0046.js index a6317f12..fd8f7e93 100644 --- a/test/core/issues/0046.js +++ b/test/core/issues/0046.js @@ -1,32 +1,31 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Timestamps are incorrectly parsed in local time', function () { var src = ` date1: 2010-10-20T20:45:00Z date2: 2010-10-20T20:45:00+01:00 -`; +` var data = yaml.load(src), - date1, date2; + date1, date2 - date1 = data.date1; // date1: 2010-10-20T20:45:00Z - assert.strictEqual(date1.getUTCFullYear(), 2010, 'year'); - assert.strictEqual(date1.getUTCMonth(), 9, 'month'); - assert.strictEqual(date1.getUTCDate(), 20, 'date'); - assert.strictEqual(date1.getUTCHours(), 20); - assert.strictEqual(date1.getUTCMinutes(), 45); - assert.strictEqual(date1.getUTCSeconds(), 0); + date1 = data.date1 // date1: 2010-10-20T20:45:00Z + assert.strictEqual(date1.getUTCFullYear(), 2010, 'year') + assert.strictEqual(date1.getUTCMonth(), 9, 'month') + assert.strictEqual(date1.getUTCDate(), 20, 'date') + assert.strictEqual(date1.getUTCHours(), 20) + assert.strictEqual(date1.getUTCMinutes(), 45) + assert.strictEqual(date1.getUTCSeconds(), 0) - date2 = data.date2; // date2: 2010-10-20T20:45:00+0100 - assert.strictEqual(date2.getUTCFullYear(), 2010, 'year'); - assert.strictEqual(date2.getUTCMonth(), 9, 'month'); - assert.strictEqual(date2.getUTCDate(), 20, 'date'); - assert.strictEqual(date2.getUTCHours(), 19); - assert.strictEqual(date2.getUTCMinutes(), 45); - assert.strictEqual(date2.getUTCSeconds(), 0); -}); + date2 = data.date2 // date2: 2010-10-20T20:45:00+0100 + assert.strictEqual(date2.getUTCFullYear(), 2010, 'year') + assert.strictEqual(date2.getUTCMonth(), 9, 'month') + assert.strictEqual(date2.getUTCDate(), 20, 'date') + assert.strictEqual(date2.getUTCHours(), 19) + assert.strictEqual(date2.getUTCMinutes(), 45) + assert.strictEqual(date2.getUTCSeconds(), 0) +}) diff --git a/test/core/issues/0054.js b/test/core/issues/0054.js index ef10d42c..8c3ad12a 100644 --- a/test/core/issues/0054.js +++ b/test/core/issues/0054.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it("Incorrect utf-8 handling on require('file.yaml')", function () { var data = yaml.load(` @@ -49,22 +48,22 @@ it("Incorrect utf-8 handling on require('file.yaml')", function () { - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу -`); +`) var expected = '', - index; + index // // document is an array of 40 elements // each element is a string of 100 `у` (Russian letter) chars // for (index = 0; index <= 100; index += 1) { - expected += 'у'; + expected += 'у' } // // make sure none of the strings were corrupted. // for (index = 0; index < 40; index += 1) { - assert.strictEqual(data[index], expected, ('Line ' + index + ' is corrupted')); + assert.strictEqual(data[index], expected, ('Line ' + index + ' is corrupted')) } -}); +}) diff --git a/test/core/issues/0063.js b/test/core/issues/0063.js index 4d1cccff..8d3c229c 100644 --- a/test/core/issues/0063.js +++ b/test/core/issues/0063.js @@ -1,24 +1,23 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Invalid errors/warnings of invalid indentation on flow scalars', function () { var sources = [ 'text:\n hello\n world', // plain style "text:\n 'hello\n world'", // single-quoted style 'text:\n "hello\n world"' // double-quoted style - ]; - var expected = { text: 'hello world' }; + ] + var expected = { text: 'hello world' } - assert.doesNotThrow(function () { yaml.load(sources[0]); }, 'Throws on plain style'); - assert.doesNotThrow(function () { yaml.load(sources[1]); }, 'Throws on single-quoted style'); - assert.doesNotThrow(function () { yaml.load(sources[2]); }, 'Throws on double-quoted style'); + assert.doesNotThrow(function () { yaml.load(sources[0]) }, 'Throws on plain style') + assert.doesNotThrow(function () { yaml.load(sources[1]) }, 'Throws on single-quoted style') + assert.doesNotThrow(function () { yaml.load(sources[2]) }, 'Throws on double-quoted style') - assert.deepStrictEqual(yaml.load(sources[0]), expected); - assert.deepStrictEqual(yaml.load(sources[1]), expected); - assert.deepStrictEqual(yaml.load(sources[2]), expected); -}); + assert.deepStrictEqual(yaml.load(sources[0]), expected) + assert.deepStrictEqual(yaml.load(sources[1]), expected) + assert.deepStrictEqual(yaml.load(sources[2]), expected) +}) diff --git a/test/core/issues/0064.js b/test/core/issues/0064.js index ecfc10d9..b4ee4814 100644 --- a/test/core/issues/0064.js +++ b/test/core/issues/0064.js @@ -1,14 +1,13 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); -var readFileSync = require('fs').readFileSync; +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') +var readFileSync = require('fs').readFileSync it('Wrong error message when yaml file contains tabs', function () { assert.doesNotThrow( - function () { yaml.load(readFileSync(require('path').join(__dirname, '/0064.yml'), 'utf8')); }, - yaml.YAMLException); -}); + function () { yaml.load(readFileSync(require('path').join(__dirname, '/0064.yml'), 'utf8')) }, + yaml.YAMLException) +}) diff --git a/test/core/issues/0068.js b/test/core/issues/0068.js index d2af9023..19947256 100644 --- a/test/core/issues/0068.js +++ b/test/core/issues/0068.js @@ -1,12 +1,11 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Prevent adding unnecessary space character to end of a line within block collections', function () { - assert.strictEqual(yaml.dump({ data: [ 'foo', 'bar', 'baz' ] }), 'data:\n - foo\n - bar\n - baz\n'); - assert.strictEqual(yaml.dump({ foo: { bar: [ 'baz' ] } }), 'foo:\n bar:\n - baz\n'); -}); + assert.strictEqual(yaml.dump({ data: ['foo', 'bar', 'baz'] }), 'data:\n - foo\n - bar\n - baz\n') + assert.strictEqual(yaml.dump({ foo: { bar: ['baz'] } }), 'foo:\n bar:\n - baz\n') +}) diff --git a/test/core/issues/0080.js b/test/core/issues/0080.js index 7a922b40..cf320d42 100644 --- a/test/core/issues/0080.js +++ b/test/core/issues/0080.js @@ -1,74 +1,71 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('should throw when tabs are used as indentation', function () { assert.throws(() => yaml.load(` \tfoo: 1 bar: 2 -`), /end of the stream or a document separator is expected/); +`), /end of the stream or a document separator is expected/) assert.throws(() => yaml.load(` foo: 1 \tbar: 2 -`), /tab characters must not be used/); +`), /tab characters must not be used/) assert.throws(() => yaml.load(` \t- foo - bar -`), /end of the stream or a document separator is expected/); +`), /end of the stream or a document separator is expected/) assert.throws(() => yaml.load(` - foo \t- bar -`), /tab characters must not be used/); -}); - +`), /tab characters must not be used/) +}) it('should allow tabs inside separation spaces', function () { assert.deepStrictEqual(yaml.load(` foo\t \t:\t \t1\t \t \t \t \t bar \t : \t 2 \t -`), { foo: 1, bar: 2 }); +`), { foo: 1, bar: 2 }) assert.deepStrictEqual(yaml.load(` -\t \tfoo\t \t \t \t \t - \t bar \t -`), [ 'foo', 'bar' ]); +`), ['foo', 'bar']) assert.deepStrictEqual(yaml.load(` \t{\tfoo\t:\t1\t,\tbar\t:\t2\t}\t -`), { foo: 1, bar: 2 }); +`), { foo: 1, bar: 2 }) assert.deepStrictEqual(yaml.load(` \t[\tfoo\t,\tbar\t]\t -`), [ 'foo', 'bar' ]); +`), ['foo', 'bar']) assert.deepStrictEqual(yaml.load(` foo: # string indent = 1 \t \t1 \t 2 \t \t3 -`), { foo: '1 2 3' }); -}); - +`), { foo: '1 2 3' }) +}) it('should throw when tabs are used as indentation in strings', function () { assert.throws(() => yaml.load(` foo: bar: | \tbaz -`), /tab characters must not be used/); +`), /tab characters must not be used/) assert.deepStrictEqual(yaml.load(` foo: bar: | \tbaz -`), { foo: { bar: '\tbaz\n' } }); -}); +`), { foo: { bar: '\tbaz\n' } }) +}) diff --git a/test/core/issues/0085.js b/test/core/issues/0085.js index 57916fb6..93817644 100644 --- a/test/core/issues/0085.js +++ b/test/core/issues/0085.js @@ -1,25 +1,22 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') var DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; - +] it('Dumper should take into account booleans syntax from YAML 1.0/1.1', function () { DEPRECATED_BOOLEANS_SYNTAX.forEach(function (string) { - var dump = yaml.dump(string).trim(); + var dump = yaml.dump(string).trim() assert( ((dump === "'" + string + "'") || (dump === '"' + string + '"')), ('"' + string + '" string is dumped without quoting; actual dump: ' + dump) - ); - }); -}); - + ) + }) +}) diff --git a/test/core/issues/0092.js b/test/core/issues/0092.js index c5401a95..e919d50e 100644 --- a/test/core/issues/0092.js +++ b/test/core/issues/0092.js @@ -1,13 +1,12 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Invalid parse error on whitespace between quoted scalar keys and ":" symbol in mappings', function () { assert.doesNotThrow(function () { - yaml.load('{ "field1" : "v1", "field2": "v2" }'); - }); -}); + yaml.load('{ "field1" : "v1", "field2": "v2" }') + }) +}) diff --git a/test/core/issues/0093.js b/test/core/issues/0093.js index 64a5ceac..ca2b77d5 100644 --- a/test/core/issues/0093.js +++ b/test/core/issues/0093.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Unwanted line breaks in folded scalars', function () { var data = yaml.load(` @@ -33,9 +32,9 @@ third: > d e f -`); +`) - assert.strictEqual(data.first, 'a b\n c\n d\ne f\n'); - assert.strictEqual(data.second, 'a b\n c\n\n d\ne f\n'); - assert.strictEqual(data.third, 'a b\n\n c\n d\ne f\n'); -}); + assert.strictEqual(data.first, 'a b\n c\n d\ne f\n') + assert.strictEqual(data.second, 'a b\n c\n\n d\ne f\n') + assert.strictEqual(data.third, 'a b\n\n c\n d\ne f\n') +}) diff --git a/test/core/issues/0095.js b/test/core/issues/0095.js index e2ac3d14..1ca93efa 100644 --- a/test/core/issues/0095.js +++ b/test/core/issues/0095.js @@ -1,25 +1,24 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Empty block scalars loaded wrong', function () { - assert.deepStrictEqual(yaml.load('a: |\nb: .'), { a: '', b: '.' }); - assert.deepStrictEqual(yaml.load('a: |+\nb: .'), { a: '', b: '.' }); - assert.deepStrictEqual(yaml.load('a: |-\nb: .'), { a: '', b: '.' }); + assert.deepStrictEqual(yaml.load('a: |\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: |+\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: |-\nb: .'), { a: '', b: '.' }) - assert.deepStrictEqual(yaml.load('a: >\nb: .'), { a: '', b: '.' }); - assert.deepStrictEqual(yaml.load('a: >+\nb: .'), { a: '', b: '.' }); - assert.deepStrictEqual(yaml.load('a: >-\nb: .'), { a: '', b: '.' }); + assert.deepStrictEqual(yaml.load('a: >\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: >+\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: >-\nb: .'), { a: '', b: '.' }) - assert.deepStrictEqual(yaml.load('a: |\n\nb: .'), { a: '', b: '.' }); - assert.deepStrictEqual(yaml.load('a: |+\n\nb: .'), { a: '\n', b: '.' }); - assert.deepStrictEqual(yaml.load('a: |-\n\nb: .'), { a: '', b: '.' }); + assert.deepStrictEqual(yaml.load('a: |\n\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: |+\n\nb: .'), { a: '\n', b: '.' }) + assert.deepStrictEqual(yaml.load('a: |-\n\nb: .'), { a: '', b: '.' }) - assert.deepStrictEqual(yaml.load('a: >\n\nb: .'), { a: '', b: '.' }); - assert.deepStrictEqual(yaml.load('a: >+\n\nb: .'), { a: '\n', b: '.' }); - assert.deepStrictEqual(yaml.load('a: >-\n\nb: .'), { a: '', b: '.' }); -}); + assert.deepStrictEqual(yaml.load('a: >\n\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: >+\n\nb: .'), { a: '\n', b: '.' }) + assert.deepStrictEqual(yaml.load('a: >-\n\nb: .'), { a: '', b: '.' }) +}) diff --git a/test/core/issues/0108.js b/test/core/issues/0108.js index 028762fc..8f8584c3 100644 --- a/test/core/issues/0108.js +++ b/test/core/issues/0108.js @@ -1,13 +1,12 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Literal scalars have an unwanted leading line break', function () { - assert.strictEqual(yaml.load('|\n foobar\n'), 'foobar\n'); - assert.strictEqual(yaml.load('|\n hello\n world\n'), 'hello\nworld\n'); - assert.strictEqual(yaml.load('|\n war never changes\n'), 'war never changes\n'); -}); + assert.strictEqual(yaml.load('|\n foobar\n'), 'foobar\n') + assert.strictEqual(yaml.load('|\n hello\n world\n'), 'hello\nworld\n') + assert.strictEqual(yaml.load('|\n war never changes\n'), 'war never changes\n') +}) diff --git a/test/core/issues/0110.js b/test/core/issues/0110.js index 2348f927..3dc6e9e0 100644 --- a/test/core/issues/0110.js +++ b/test/core/issues/0110.js @@ -1,29 +1,28 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Circular and cross references', function () { var source = { a: { a: 1 }, - b: [ 1, 2 ], + b: [1, 2], c: {}, d: [] - }; - source.crossObject = source.a; - source.crossArray = source.b; - source.c.circularObject = source; - source.d.push(source.d); - source.d.push(source); + } + source.crossObject = source.a + source.crossArray = source.b + source.c.circularObject = source + source.d.push(source.d) + source.d.push(source) - var obtained = yaml.load(yaml.dump(source)); + var obtained = yaml.load(yaml.dump(source)) - assert.strictEqual(obtained.crossObject, obtained.a); - assert.strictEqual(obtained.crossArray, obtained.b); - assert.strictEqual(obtained.c.circularObject, obtained); - assert.strictEqual(obtained.d[0], obtained.d); - assert.strictEqual(obtained.d[1], obtained); -}); + assert.strictEqual(obtained.crossObject, obtained.a) + assert.strictEqual(obtained.crossArray, obtained.b) + assert.strictEqual(obtained.c.circularObject, obtained) + assert.strictEqual(obtained.d[0], obtained.d) + assert.strictEqual(obtained.d[1], obtained) +}) diff --git a/test/core/issues/0112.js b/test/core/issues/0112.js index 95a26387..9da8b10f 100644 --- a/test/core/issues/0112.js +++ b/test/core/issues/0112.js @@ -1,15 +1,14 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Plain scalar "constructor" parsed as `null`', function () { - assert.strictEqual(yaml.load('constructor'), 'constructor'); - assert.deepStrictEqual(yaml.load('constructor: value'), { constructor: 'value' }); - assert.deepStrictEqual(yaml.load('key: constructor'), { key: 'constructor' }); - assert.deepStrictEqual(yaml.load('{ constructor: value }'), { constructor: 'value' }); - assert.deepStrictEqual(yaml.load('{ key: constructor }'), { key: 'constructor' }); -}); + assert.strictEqual(yaml.load('constructor'), 'constructor') + assert.deepStrictEqual(yaml.load('constructor: value'), { constructor: 'value' }) + assert.deepStrictEqual(yaml.load('key: constructor'), { key: 'constructor' }) + assert.deepStrictEqual(yaml.load('{ constructor: value }'), { constructor: 'value' }) + assert.deepStrictEqual(yaml.load('{ key: constructor }'), { key: 'constructor' }) +}) diff --git a/test/core/issues/0117.js b/test/core/issues/0117.js index 1b580d75..cb12c660 100644 --- a/test/core/issues/0117.js +++ b/test/core/issues/0117.js @@ -1,11 +1,10 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Negative zero loses the sign after dump', function () { - assert.strictEqual(yaml.dump(-0), '-0.0\n'); -}); + assert.strictEqual(yaml.dump(-0), '-0.0\n') +}) diff --git a/test/core/issues/0144.js b/test/core/issues/0144.js index cd3c1468..3a6fc96f 100644 --- a/test/core/issues/0144.js +++ b/test/core/issues/0144.js @@ -1,11 +1,10 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Infinite loop when attempting to parse multi-line scalar document that is not indented', function () { - assert.strictEqual(yaml.load('--- |\nfoo\n'), 'foo\n'); -}); + assert.strictEqual(yaml.load('--- |\nfoo\n'), 'foo\n') +}) diff --git a/test/core/issues/0154.js b/test/core/issues/0154.js index 7a21aebc..5665571f 100644 --- a/test/core/issues/0154.js +++ b/test/core/issues/0154.js @@ -1,14 +1,13 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Indentation warning on empty lines within quoted scalars and flow collections', function () { - assert.doesNotThrow(function () { yaml.load("- 'hello\n\n world'"); }); - assert.doesNotThrow(function () { yaml.load('- "hello\n\n world"'); }); - assert.doesNotThrow(function () { yaml.load('- [hello,\n\n world]'); }); - assert.doesNotThrow(function () { yaml.load('- {hello: world,\n\n foo: bar}'); }); -}); + assert.doesNotThrow(function () { yaml.load("- 'hello\n\n world'") }) + assert.doesNotThrow(function () { yaml.load('- "hello\n\n world"') }) + assert.doesNotThrow(function () { yaml.load('- [hello,\n\n world]') }) + assert.doesNotThrow(function () { yaml.load('- {hello: world,\n\n foo: bar}') }) +}) diff --git a/test/core/issues/0155.js b/test/core/issues/0155.js index 16797e8e..829e36f1 100644 --- a/test/core/issues/0155.js +++ b/test/core/issues/0155.js @@ -1,11 +1,10 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Named null', function () { - assert.deepStrictEqual(yaml.load('---\ntest: !!null \nfoo: bar'), { test: null, foo: 'bar' }); -}); + assert.deepStrictEqual(yaml.load('---\ntest: !!null \nfoo: bar'), { test: null, foo: 'bar' }) +}) diff --git a/test/core/issues/0156.js b/test/core/issues/0156.js index f6517ad2..c5cd06c1 100644 --- a/test/core/issues/0156.js +++ b/test/core/issues/0156.js @@ -1,21 +1,19 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') - -function SuccessSignal() {} +function SuccessSignal () {} var TestClassYaml = new yaml.Type('!test', { kind: 'scalar', - resolve: function () { throw new SuccessSignal(); } -}); - -var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ TestClassYaml ]); + resolve: function () { throw new SuccessSignal() } +}) +var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([TestClassYaml]) it('Resolving of empty nodes are skipped in some cases', function () { - assert.throws(function () { yaml.load('- foo: !test\n- bar: baz', { schema: TEST_SCHEMA }); }, SuccessSignal); -}); + assert.throws(function () { yaml.load('- foo: !test\n- bar: baz', { schema: TEST_SCHEMA }) }, SuccessSignal) +}) diff --git a/test/core/issues/0160.js b/test/core/issues/0160.js index e36450ff..ad47750b 100644 --- a/test/core/issues/0160.js +++ b/test/core/issues/0160.js @@ -1,11 +1,10 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Correct encoding of UTF-16 surrogate pairs', function () { - assert.strictEqual(yaml.load('"\\U0001F431"'), '🐱'); -}); + assert.strictEqual(yaml.load('"\\U0001F431"'), '🐱') +}) diff --git a/test/core/issues/0164.js b/test/core/issues/0164.js index 742fb788..017480d2 100644 --- a/test/core/issues/0164.js +++ b/test/core/issues/0164.js @@ -1,19 +1,17 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('should define __proto__ as a value (not invoke setter)', function () { - let object = yaml.load('{ __proto__: {polluted: bar} }'); - - assert.strictEqual(({}).hasOwnProperty.call(yaml.load('{}'), '__proto__'), false); - assert.strictEqual(({}).hasOwnProperty.call(object, '__proto__'), true); - assert(!object.polluted); -}); + let object = yaml.load('{ __proto__: {polluted: bar} }') + assert.strictEqual(({}).hasOwnProperty.call(yaml.load('{}'), '__proto__'), false) + assert.strictEqual(({}).hasOwnProperty.call(object, '__proto__'), true) + assert(!object.polluted) +}) it('should merge __proto__ as a value with << operator', function () { let object = yaml.load(` @@ -23,9 +21,9 @@ payload: &ref foo: <<: __proto__: *ref - `); + `) - assert.strictEqual(({}).hasOwnProperty.call(yaml.load('{}'), '__proto__'), false); - assert.strictEqual(({}).hasOwnProperty.call(object.foo, '__proto__'), true); - assert(!object.foo.polluted); -}); + assert.strictEqual(({}).hasOwnProperty.call(yaml.load('{}'), '__proto__'), false) + assert.strictEqual(({}).hasOwnProperty.call(object.foo, '__proto__'), true) + assert(!object.foo.polluted) +}) diff --git a/test/core/issues/0194.js b/test/core/issues/0194.js index 426fec88..80173309 100644 --- a/test/core/issues/0194.js +++ b/test/core/issues/0194.js @@ -1,25 +1,24 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Don\'t throw on warning', function () { var src = ` foo: { bar: true } -`; +` var warnings = [], - data; + data - data = yaml.load(src); + data = yaml.load(src) - assert.deepStrictEqual(data, { foo: { bar: true } }); + assert.deepStrictEqual(data, { foo: { bar: true } }) - yaml.load(src, { onWarning: function (e) { warnings.push(e); } }); + yaml.load(src, { onWarning: function (e) { warnings.push(e) } }) - assert.strictEqual(warnings.length, 1); -}); + assert.strictEqual(warnings.length, 1) +}) diff --git a/test/core/issues/0203.js b/test/core/issues/0203.js index e3c1e481..281eb8d9 100644 --- a/test/core/issues/0203.js +++ b/test/core/issues/0203.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Don\'t throw on warning', function () { var src = ` @@ -13,7 +12,7 @@ test: |- Hello world -`; +` - assert.deepStrictEqual(yaml.load(src), { test: '\n\nHello\nworld' }); -}); + assert.deepStrictEqual(yaml.load(src), { test: '\n\nHello\nworld' }) +}) diff --git a/test/core/issues/0205.js b/test/core/issues/0205.js index decfde41..3b285f42 100644 --- a/test/core/issues/0205.js +++ b/test/core/issues/0205.js @@ -1,28 +1,27 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Duplicated objects within array', function () { - var obj = { test: 'canary' }; - var arrayWithRefs = [ obj, obj ]; + var obj = { test: 'canary' } + var arrayWithRefs = [obj, obj] - var obtained = yaml.load(yaml.dump(arrayWithRefs)); + var obtained = yaml.load(yaml.dump(arrayWithRefs)) - assert.strictEqual(obtained[0].test, 'canary'); - assert.strictEqual(obtained[0], obtained[1]); -}); + assert.strictEqual(obtained[0].test, 'canary') + assert.strictEqual(obtained[0], obtained[1]) +}) it('Duplicated arrays within array', function () { - var array = [ 0, 1 ]; - var arrayWithRefs = [ array, array ]; + var array = [0, 1] + var arrayWithRefs = [array, array] - var obtained = yaml.load(yaml.dump(arrayWithRefs)); + var obtained = yaml.load(yaml.dump(arrayWithRefs)) - assert.strictEqual(obtained[0][0], 0); - assert.strictEqual(obtained[0][1], 1); - assert.strictEqual(obtained[0], obtained[1]); -}); + assert.strictEqual(obtained[0][0], 0) + assert.strictEqual(obtained[0][1], 1) + assert.strictEqual(obtained[0], obtained[1]) +}) diff --git a/test/core/issues/0220.js b/test/core/issues/0220.js index ba3dd7fb..f4bb2a17 100644 --- a/test/core/issues/0220.js +++ b/test/core/issues/0220.js @@ -1,15 +1,14 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Float type dumper should not miss dot', function () { - assert.strictEqual(5e-100.toString(10), '5e-100'); - assert.strictEqual(0.5e-100.toString(10), '5e-101'); + assert.strictEqual(5e-100.toString(10), '5e-100') + assert.strictEqual(0.5e-100.toString(10), '5e-101') - assert.strictEqual(yaml.dump(0.5e-100), '5.e-101\n'); - assert.strictEqual(yaml.load(yaml.dump(5e-100)), 5e-100); -}); + assert.strictEqual(yaml.dump(0.5e-100), '5.e-101\n') + assert.strictEqual(yaml.load(yaml.dump(5e-100)), 5e-100) +}) diff --git a/test/core/issues/0221.js b/test/core/issues/0221.js index 3a890463..6f994f52 100644 --- a/test/core/issues/0221.js +++ b/test/core/issues/0221.js @@ -1,12 +1,11 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it.skip('Block scalar chomping does not work on zero indent', function () { - assert.throws(function () { yaml.load('|-\nfoo\nbar'); }, yaml.YAMLException); - assert.deepStrictEqual(yaml.dump('foo\nbar'), '|-\n foo\nbar'); -}); + assert.throws(function () { yaml.load('|-\nfoo\nbar') }, yaml.YAMLException) + assert.deepStrictEqual(yaml.dump('foo\nbar'), '|-\n foo\nbar') +}) diff --git a/test/core/issues/0235.js b/test/core/issues/0235.js index c82de73b..e0c7450b 100644 --- a/test/core/issues/0235.js +++ b/test/core/issues/0235.js @@ -1,15 +1,15 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') it('Flow style does not dump with block literals.', function () { - assert.strictEqual(yaml.dump({ a: '\n' }, { flowLevel: 0 }), '{a: "\\n"}\n'); -}); + assert.strictEqual(yaml.dump({ a: '\n' }, { flowLevel: 0 }), '{a: "\\n"}\n') +}) it('Ok to dump block-style literals when not yet flowing.', function () { // cf. example 8.6 from the YAML 1.2 spec - assert.strictEqual(yaml.dump({ a: '\n' }, { flowLevel: 2 }), 'a: |+\n\n'); -}); + assert.strictEqual(yaml.dump({ a: '\n' }, { flowLevel: 2 }), 'a: |+\n\n') +}) diff --git a/test/core/issues/0243.js b/test/core/issues/0243.js index 5c9f6b7e..3414a839 100644 --- a/test/core/issues/0243.js +++ b/test/core/issues/0243.js @@ -1,54 +1,53 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); -var readFileSync = require('fs').readFileSync; +const { describe, it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') +var readFileSync = require('fs').readFileSync describe('Duplicated mapping key errors throw at beginning of key', function () { it('on top level', function () { - var src = readFileSync(require('path').join(__dirname, '/0243-basic.yml'), 'utf8'); - var lines = src.split('\n'); + var src = readFileSync(require('path').join(__dirname, '/0243-basic.yml'), 'utf8') + var lines = src.split('\n') try { - yaml.load(src); + yaml.load(src) } catch (e) { - assert.strictEqual(lines[e.mark.line], 'duplicate: # 2'); - assert.strictEqual(e.mark.line, 9); - assert.strictEqual(e.mark.column, 0); + assert.strictEqual(lines[e.mark.line], 'duplicate: # 2') + assert.strictEqual(e.mark.line, 9) + assert.strictEqual(e.mark.column, 0) } - }); + }) it('inside of mapping values', function () { - var src = readFileSync(require('path').join(__dirname, '/0243-nested.yml'), 'utf8'); - var lines = src.split('\n'); + var src = readFileSync(require('path').join(__dirname, '/0243-nested.yml'), 'utf8') + var lines = src.split('\n') try { - yaml.load(src); + yaml.load(src) } catch (e) { - assert.strictEqual(lines[e.mark.line], ' duplicate: # 2'); - assert.strictEqual(e.mark.line, 9); - assert.strictEqual(e.mark.column, 2); + assert.strictEqual(lines[e.mark.line], ' duplicate: # 2') + assert.strictEqual(e.mark.line, 9) + assert.strictEqual(e.mark.column, 2) } - }); + }) it('inside flow collection', function () { try { - yaml.load('{ foo: 123, foo: 456 }'); + yaml.load('{ foo: 123, foo: 456 }') } catch (e) { - assert.strictEqual(e.mark.line, 0); - assert.strictEqual(e.mark.column, 12); + assert.strictEqual(e.mark.line, 0) + assert.strictEqual(e.mark.column, 12) } - }); + }) it('inside a set', function () { try { - yaml.load(' ? foo\n ? foo\n ? bar'); + yaml.load(' ? foo\n ? foo\n ? bar') } catch (e) { - assert.strictEqual(e.mark.line, 1); - assert.strictEqual(e.mark.column, 4); + assert.strictEqual(e.mark.line, 1) + assert.strictEqual(e.mark.column, 4) } - }); -}); + }) +}) diff --git a/test/core/issues/0248-listener.js b/test/core/issues/0248-listener.js index ff21b7ef..53804b12 100644 --- a/test/core/issues/0248-listener.js +++ b/test/core/issues/0248-listener.js @@ -1,64 +1,64 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') it('Listener informed on a very simple scalar.', function () { - var history = []; - function l(eventType, state) { - history.push([ eventType, state.position ]); + var history = [] + function l (eventType, state) { + history.push([eventType, state.position]) } - yaml.load('a_simple_scalar', { listener: l }); + yaml.load('a_simple_scalar', { listener: l }) // 2 open events then 2 close events - assert.strictEqual(history.length, 4); - assert.strictEqual(history[0][0], 'open'); - assert.strictEqual(history[1][0], 'open'); - assert.strictEqual(history[2][0], 'close'); - assert.strictEqual(history[3][0], 'close'); - assert.strictEqual(history[0][1], 0); - assert.strictEqual(history[3][1], 16); -}); + assert.strictEqual(history.length, 4) + assert.strictEqual(history[0][0], 'open') + assert.strictEqual(history[1][0], 'open') + assert.strictEqual(history[2][0], 'close') + assert.strictEqual(history[3][0], 'close') + assert.strictEqual(history[0][1], 0) + assert.strictEqual(history[3][1], 16) +}) it('Listener informed on a map with a list.', function () { - var history = []; - function l(eventType, state) { - history.push([ eventType, state.position, state.result ]); + var history = [] + function l (eventType, state) { + history.push([eventType, state.position, state.result]) } - yaml.load('{ a: 1, b: [ 0, xyz ] }', { listener: l }); + yaml.load('{ a: 1, b: [ 0, xyz ] }', { listener: l }) - var i = -1; - assert.strictEqual(history[++i][0], 'open'); // doc - assert.strictEqual(history[++i][0], 'open'); // map + var i = -1 + assert.strictEqual(history[++i][0], 'open') // doc + assert.strictEqual(history[++i][0], 'open') // map - assert.strictEqual(history[++i][0], 'open'); // key - assert.strictEqual(history[++i][0], 'close'); - assert.strictEqual(history[i][2], 'a'); + assert.strictEqual(history[++i][0], 'open') // key + assert.strictEqual(history[++i][0], 'close') + assert.strictEqual(history[i][2], 'a') - assert.strictEqual(history[++i][0], 'open'); // a value - assert.strictEqual(history[++i][0], 'close'); - assert.strictEqual(history[i][2], 1); + assert.strictEqual(history[++i][0], 'open') // a value + assert.strictEqual(history[++i][0], 'close') + assert.strictEqual(history[i][2], 1) - assert.strictEqual(history[++i][0], 'open'); // key - assert.strictEqual(history[++i][0], 'close'); - assert.strictEqual(history[i][2], 'b'); + assert.strictEqual(history[++i][0], 'open') // key + assert.strictEqual(history[++i][0], 'close') + assert.strictEqual(history[i][2], 'b') - assert.strictEqual(history[++i][0], 'open'); // b value (list) - assert.strictEqual(history[++i][0], 'open'); // item in list - assert.strictEqual(history[++i][0], 'close'); - assert.strictEqual(history[i][2], 0); - assert.strictEqual(history[++i][0], 'open'); // item in list - assert.strictEqual(history[++i][0], 'close'); + assert.strictEqual(history[++i][0], 'open') // b value (list) + assert.strictEqual(history[++i][0], 'open') // item in list + assert.strictEqual(history[++i][0], 'close') + assert.strictEqual(history[i][2], 0) + assert.strictEqual(history[++i][0], 'open') // item in list + assert.strictEqual(history[++i][0], 'close') - assert.strictEqual(history[++i][0], 'close'); // b value (list) end - assert.deepStrictEqual(history[i][2], [ 0, 'xyz' ]); + assert.strictEqual(history[++i][0], 'close') // b value (list) end + assert.deepStrictEqual(history[i][2], [0, 'xyz']) - assert.strictEqual(history[++i][0], 'close'); // map end - assert.strictEqual(history[++i][0], 'close'); // doc end + assert.strictEqual(history[++i][0], 'close') // map end + assert.strictEqual(history[++i][0], 'close') // doc end - assert.strictEqual(history.length, ++i); -}); + assert.strictEqual(history.length, ++i) +}) diff --git a/test/core/issues/0258.js b/test/core/issues/0258.js index 25d89a3c..603973c0 100644 --- a/test/core/issues/0258.js +++ b/test/core/issues/0258.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('should shorthand tags with !! whenever possible', function () { let regexp = new yaml.Type('tag:yaml.org,2002:js/regexp', { @@ -13,15 +12,15 @@ it('should shorthand tags with !! whenever possible', function () { construct: str => new RegExp(str), instanceOf: RegExp, represent: object => object.source - }); + }) - let schema = yaml.DEFAULT_SCHEMA.extend(regexp); + let schema = yaml.DEFAULT_SCHEMA.extend(regexp) - let source = 're: !!js/regexp .*\n'; + let source = 're: !!js/regexp .*\n' - let object = yaml.load(source, { schema }); - assert(object.re instanceof RegExp); + let object = yaml.load(source, { schema }) + assert(object.re instanceof RegExp) - let str = yaml.dump(object, { schema }); - assert.strictEqual(str, source); -}); + let str = yaml.dump(object, { schema }) + assert.strictEqual(str, source) +}) diff --git a/test/core/issues/0266.js b/test/core/issues/0266.js index 50aa3beb..6bd414c5 100644 --- a/test/core/issues/0266.js +++ b/test/core/issues/0266.js @@ -1,24 +1,22 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') var DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' -]; - +] it('Dumper should not take into account booleans syntax from YAML 1.0/1.1 in noCompatMode', function () { DEPRECATED_BOOLEANS_SYNTAX.forEach(function (string) { - var dump = yaml.dump(string, { noCompatMode: true }).trim(); + var dump = yaml.dump(string, { noCompatMode: true }).trim() assert( (dump === string), ('"' + string + '" string is not dumped as-is; actual dump: ' + dump) - ); - }); -}); + ) + }) +}) diff --git a/test/core/issues/0301.js b/test/core/issues/0301.js index 6831e396..bed08dde 100644 --- a/test/core/issues/0301.js +++ b/test/core/issues/0301.js @@ -1,29 +1,28 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('should assign anchor to an empty node', function () { assert.deepStrictEqual( yaml.load('foo: &a\nbar: *a\n'), { foo: null, bar: null } - ); + ) assert.deepStrictEqual( yaml.load('{ foo: &a, bar: *a }'), { foo: null, bar: null } - ); + ) assert.deepStrictEqual( yaml.load('- &a\n- *a\n'), - [ null, null ] - ); + [null, null] + ) assert.deepStrictEqual( yaml.load('[ &a, *a ]'), - [ null, null ] - ); -}); + [null, null] + ) +}) diff --git a/test/core/issues/0303.js b/test/core/issues/0303.js index d11aff8c..fc76fa60 100644 --- a/test/core/issues/0303.js +++ b/test/core/issues/0303.js @@ -1,13 +1,13 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') it('Loader should not strip quotes before newlines', function () { - var with_space = yaml.load("'''foo'' '"); - var with_newline = yaml.load("'''foo''\n'"); - assert.strictEqual(with_space, "'foo' "); - assert.strictEqual(with_newline, "'foo' "); -}); + var with_space = yaml.load("'''foo'' '") + var with_newline = yaml.load("'''foo''\n'") + assert.strictEqual(with_space, "'foo' ") + assert.strictEqual(with_newline, "'foo' ") +}) diff --git a/test/core/issues/0321.js b/test/core/issues/0321.js index b2fca629..8d0194ea 100644 --- a/test/core/issues/0321.js +++ b/test/core/issues/0321.js @@ -1,20 +1,19 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('Should throw exception on extra comma in flow mappings', function () { assert.throws(function () { - yaml.load('[foo, bar,, baz]'); - }, /expected the node content, but found ','/); + yaml.load('[foo, bar,, baz]') + }, /expected the node content, but found ','/) assert.throws(function () { - yaml.load('{foo, bar,, baz}'); - }, /expected the node content, but found ','/); + yaml.load('{foo, bar,, baz}') + }, /expected the node content, but found ','/) // empty key is allowed here - assert.deepStrictEqual(yaml.load('{foo,: bar}'), { foo: null, null: 'bar' }); -}); + assert.deepStrictEqual(yaml.load('{foo,: bar}'), { foo: null, null: 'bar' }) +}) diff --git a/test/core/issues/0332.js b/test/core/issues/0332.js index aef3764a..55858002 100644 --- a/test/core/issues/0332.js +++ b/test/core/issues/0332.js @@ -1,33 +1,32 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('Should format errors', function () { try { - yaml.load('"foo\u0001bar"'); + yaml.load('"foo\u0001bar"') } catch (err) { - assert.strictEqual(err.toString(true), 'YAMLException: expected valid JSON character (1:9)'); + assert.strictEqual(err.toString(true), 'YAMLException: expected valid JSON character (1:9)') assert.strictEqual(err.toString(false), `YAMLException: expected valid JSON character (1:9) 1 | "foo\u0001bar" --------------^`); +-------------^`) } try { - yaml.load('*'); + yaml.load('*') } catch (err) { assert.strictEqual(err.toString(), `YAMLException: name of an alias node must contain at least one character (1:2) 1 | * -------^`); +------^`) } try { - yaml.load('foo:\n bar: 1\na'); + yaml.load('foo:\n bar: 1\na') } catch (err) { assert.strictEqual(err.toString(), `YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key (4:1) @@ -35,6 +34,6 @@ it('Should format errors', function () { 2 | bar: 1 3 | a 4 | ------^`); +-----^`) } -}); +}) diff --git a/test/core/issues/0333.js b/test/core/issues/0333.js index 1b50e1df..b9f7d75e 100644 --- a/test/core/issues/0333.js +++ b/test/core/issues/0333.js @@ -1,21 +1,20 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('should allow cast integers as !!float', function () { var data = yaml.load(` negative: !!float -1 zero: !!float 0 positive: !!float 2.3e4 -`); +`) assert.deepStrictEqual(data, { negative: -1, zero: 0, positive: 23000 - }); -}); + }) +}) diff --git a/test/core/issues/0335.js b/test/core/issues/0335.js index c3d10206..4777210f 100644 --- a/test/core/issues/0335.js +++ b/test/core/issues/0335.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Don\'t throw on warning', function () { var src = ` @@ -14,7 +13,7 @@ not_num_3: 123_ not_num_4: 0b00_ not_num_5: 0x00_ not_num_6: 011_ -`; +` assert.deepStrictEqual(yaml.load(src), { not_num_1: '-_123', @@ -23,5 +22,5 @@ not_num_6: 011_ not_num_4: '0b00_', not_num_5: '0x00_', not_num_6: '011_' - }); -}); + }) +}) diff --git a/test/core/issues/0342.js b/test/core/issues/0342.js index 6741e88b..e145526c 100644 --- a/test/core/issues/0342.js +++ b/test/core/issues/0342.js @@ -1,62 +1,61 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); -var simpleArray = [ 'a', 'b' ]; -var arrayOfSimpleObj = [ { a: 1 }, { b: 2 } ]; -var arrayOfObj = [ { a: 1, b: 'abc' }, { c: 'def', d: 2 } ]; +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') +var simpleArray = ['a', 'b'] +var arrayOfSimpleObj = [{ a: 1 }, { b: 2 }] +var arrayOfObj = [{ a: 1, b: 'abc' }, { c: 'def', d: 2 }] it('space should be added for array, regardless of indent', function () { assert.deepStrictEqual( yaml.dump(simpleArray, { indent: 1 }), '- a\n- b\n' - ); + ) assert.deepStrictEqual( yaml.dump(simpleArray, { indent: 2 }), '- a\n- b\n' - ); + ) assert.deepStrictEqual( yaml.dump(simpleArray, { indent: 3 }), '- a\n- b\n' - ); + ) assert.deepStrictEqual( yaml.dump(simpleArray, { indent: 4 }), '- a\n- b\n' - ); -}); + ) +}) it('array of objects should not wrap at indentation of 2', function () { assert.deepStrictEqual( yaml.dump(arrayOfSimpleObj, { indent: 2 }), '- a: 1\n- b: 2\n' - ); + ) assert.deepStrictEqual( yaml.dump(arrayOfObj, { indent: 2 }), '- a: 1\n b: abc\n- c: def\n d: 2\n' - ); -}); + ) +}) it('EOL space should not be added on array of objects at indentation of 3', function () { assert.deepStrictEqual( yaml.dump(arrayOfSimpleObj, { indent: 3 }), '-\n a: 1\n-\n b: 2\n' - ); + ) assert.deepStrictEqual( yaml.dump(arrayOfObj, { indent: 3 }), '-\n a: 1\n b: abc\n-\n c: def\n d: 2\n' - ); -}); + ) +}) it('EOL space should not be added on array of objects at indentation of 4', function () { assert.deepStrictEqual( yaml.dump(arrayOfSimpleObj, { indent: 4 }), '-\n a: 1\n-\n b: 2\n' - ); + ) assert.deepStrictEqual( yaml.dump(arrayOfObj, { indent: 4 }), '-\n a: 1\n b: abc\n-\n c: def\n d: 2\n' - ); -}); + ) +}) diff --git a/test/core/issues/0346.js b/test/core/issues/0346.js index b24ec684..e447f5f2 100644 --- a/test/core/issues/0346.js +++ b/test/core/issues/0346.js @@ -1,27 +1,26 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('should not emit spaces in arrays in flow mode between entries using condenseFlow: true', function () { - var array = [ 'a', 'b' ]; - var dumpedArray = yaml.dump(array, { flowLevel: 0, indent: 0, condenseFlow: true }); + var array = ['a', 'b'] + var dumpedArray = yaml.dump(array, { flowLevel: 0, indent: 0, condenseFlow: true }) assert.strictEqual( dumpedArray, '[a,b]\n' - ); - assert.deepStrictEqual(yaml.load(dumpedArray), array); -}); + ) + assert.deepStrictEqual(yaml.load(dumpedArray), array) +}) it('should not emit spaces between key: value and quote keys using condenseFlow: true', function () { - var object = { a: { b: 'c', d: 'e' } }; - var objectDump = yaml.dump(object, { flowLevel: 0, indent: 0, condenseFlow: true }); + var object = { a: { b: 'c', d: 'e' } } + var objectDump = yaml.dump(object, { flowLevel: 0, indent: 0, condenseFlow: true }) assert.strictEqual( objectDump, '{"a":{"b":c, "d":e}}\n' - ); - assert.deepStrictEqual(yaml.load(objectDump), object); -}); + ) + assert.deepStrictEqual(yaml.load(objectDump), object) +}) diff --git a/test/core/issues/0350.js b/test/core/issues/0350.js index a7b53548..c1c3a7c0 100644 --- a/test/core/issues/0350.js +++ b/test/core/issues/0350.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('should return parse docs from loadAll', function () { var data = yaml.loadAll(` @@ -12,7 +11,7 @@ it('should return parse docs from loadAll', function () { a: 1 --- b: 2 -`); +`) - assert.deepStrictEqual(data, [ { a: 1 }, { b: 2 } ]); -}); + assert.deepStrictEqual(data, [{ a: 1 }, { b: 2 }]) +}) diff --git a/test/core/issues/0351.js b/test/core/issues/0351.js index 3f8682d0..eb954ab5 100644 --- a/test/core/issues/0351.js +++ b/test/core/issues/0351.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('should include the error message in the error stack', function () { try { @@ -13,10 +12,10 @@ it('should include the error message in the error stack', function () { foo: bar baz: qux -`); +`) } catch (err) { - assert(err.stack.startsWith('YAMLException: end of the stream or a document separator is expected')); - return; + assert(err.stack.startsWith('YAMLException: end of the stream or a document separator is expected')) + return } - assert.fail(null, null, 'Expected an error to be thrown'); -}); + assert.fail(null, null, 'Expected an error to be thrown') +}) diff --git a/test/core/issues/0385.js b/test/core/issues/0385.js index 8d16d053..027e50bc 100644 --- a/test/core/issues/0385.js +++ b/test/core/issues/0385.js @@ -1,27 +1,26 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { describe, it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') describe('Multi tag', function () { it('should process multi tags', function () { - let tags = [ 'scalar', 'mapping', 'sequence' ].map(kind => + let tags = ['scalar', 'mapping', 'sequence'].map(kind => new yaml.Type('!', { kind, multi: true, resolve: function () { - return true; + return true }, construct: function (value, tag) { - return { kind, tag, value }; + return { kind, tag, value } } }) - ); + ) - let schema = yaml.DEFAULT_SCHEMA.extend(tags); + let schema = yaml.DEFAULT_SCHEMA.extend(tags) let expected = [ { @@ -32,14 +31,14 @@ describe('Multi tag', function () { { kind: 'sequence', tag: '!t2', - value: [ 1, 2, 3 ] + value: [1, 2, 3] }, { kind: 'mapping', tag: '!t3', value: { a: 1, b: 2 } } - ]; + ] assert.deepStrictEqual(yaml.load(` - !t1 123 @@ -47,37 +46,36 @@ describe('Multi tag', function () { - !t3 { a: 1, b: 2 } `, { schema: schema - }), expected); - }); - + }), expected) + }) it('should process tags depending on prefix', function () { - let tags = [ '!foo', '!bar', '!' ].map(prefix => + let tags = ['!foo', '!bar', '!'].map(prefix => new yaml.Type(prefix, { kind: 'scalar', multi: true, resolve: function () { - return true; + return true }, construct: function (value, tag) { - return { prefix, tag, value }; + return { prefix, tag, value } } }) - ); + ) tags.push( new yaml.Type('!bar', { kind: 'scalar', resolve: function () { - return true; + return true }, construct: function (value) { - return { single: true, value }; + return { single: true, value } } }) - ); + ) - let schema = yaml.DEFAULT_SCHEMA.extend(tags); + let schema = yaml.DEFAULT_SCHEMA.extend(tags) let expected = [ { prefix: '!foo', tag: '!foo', value: '1' }, @@ -85,7 +83,7 @@ describe('Multi tag', function () { { single: true, value: '3' }, { prefix: '!bar', tag: '!bar2', value: '4' }, { prefix: '!', tag: '!baz', value: '5' } - ]; + ] assert.deepStrictEqual(yaml.load(` - !foo 1 @@ -95,9 +93,8 @@ describe('Multi tag', function () { - !baz 5 `, { schema: schema - }), expected); - }); - + }), expected) + }) it('should dump multi types with custom tag', function () { let tags = [ @@ -105,21 +102,21 @@ describe('Multi tag', function () { kind: 'scalar', multi: true, predicate: function (obj) { - return !!obj.tag; + return !!obj.tag }, representName: function (obj) { - return obj.tag; + return obj.tag }, represent: function (obj) { - return obj.value; + return obj.value } }) - ]; + ] - let schema = yaml.DEFAULT_SCHEMA.extend(tags); + let schema = yaml.DEFAULT_SCHEMA.extend(tags) assert.strictEqual(yaml.dump({ test: { tag: 'foo', value: 'bar' } }, { schema: schema - }), 'test: ! bar\n'); - }); -}); + }), 'test: ! bar\n') + }) +}) diff --git a/test/core/issues/0399.js b/test/core/issues/0399.js index ee344f06..54da225d 100644 --- a/test/core/issues/0399.js +++ b/test/core/issues/0399.js @@ -1,20 +1,19 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('should properly dump negative ints in different styles', function () { - var dump, src = { integer: -100 }; + var dump, src = { integer: -100 } - dump = yaml.dump(src, { styles: { '!!int': 'binary' } }); - assert.deepStrictEqual(yaml.load(dump), src); + dump = yaml.dump(src, { styles: { '!!int': 'binary' } }) + assert.deepStrictEqual(yaml.load(dump), src) - dump = yaml.dump(src, { styles: { '!!int': 'octal' } }); - assert.deepStrictEqual(yaml.load(dump), src); + dump = yaml.dump(src, { styles: { '!!int': 'octal' } }) + assert.deepStrictEqual(yaml.load(dump), src) - dump = yaml.dump(src, { styles: { '!!int': 'hex' } }); - assert.deepStrictEqual(yaml.load(dump), src); -}); + dump = yaml.dump(src, { styles: { '!!int': 'hex' } }) + assert.deepStrictEqual(yaml.load(dump), src) +}) diff --git a/test/core/issues/0403.js b/test/core/issues/0403.js index b55421c5..1143c84f 100644 --- a/test/core/issues/0403.js +++ b/test/core/issues/0403.js @@ -1,23 +1,22 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('should properly dump leading newlines and spaces', function () { - var dump, src; + var dump, src - src = { str: '\n a\nb' }; - dump = yaml.dump(src); - assert.deepStrictEqual(yaml.load(dump), src); + src = { str: '\n a\nb' } + dump = yaml.dump(src) + assert.deepStrictEqual(yaml.load(dump), src) - src = { str: '\n\n a\nb' }; - dump = yaml.dump(src); - assert.deepStrictEqual(yaml.load(dump), src); + src = { str: '\n\n a\nb' } + dump = yaml.dump(src) + assert.deepStrictEqual(yaml.load(dump), src) - src = { str: '\n a\nb' }; - dump = yaml.dump(src, { indent: 10 }); - assert.deepStrictEqual(yaml.load(dump), src); -}); + src = { str: '\n a\nb' } + dump = yaml.dump(src, { indent: 10 }) + assert.deepStrictEqual(yaml.load(dump), src) +}) diff --git a/test/core/issues/0418.js b/test/core/issues/0418.js index 27de5071..7e721680 100644 --- a/test/core/issues/0418.js +++ b/test/core/issues/0418.js @@ -1,12 +1,11 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('should error on invalid indentation in mappings', function () { - assert.throws(() => yaml.load('foo: "1" bar: "2"'), /bad indentation of a mapping entry/); - assert.throws(() => yaml.load('- "foo" - "bar"'), /bad indentation of a sequence entry/); -}); + assert.throws(() => yaml.load('foo: "1" bar: "2"'), /bad indentation of a mapping entry/) + assert.throws(() => yaml.load('- "foo" - "bar"'), /bad indentation of a sequence entry/) +}) diff --git a/test/core/issues/0432.js b/test/core/issues/0432.js index d2a1eadf..4904c88e 100644 --- a/test/core/issues/0432.js +++ b/test/core/issues/0432.js @@ -1,25 +1,24 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('should indent arrays an extra level by default', function () { - var output = yaml.dump({ array: [ 'a', 'b' ] }); - var expected = 'array:\n - a\n - b\n'; - assert.strictEqual(output, expected); -}); + var output = yaml.dump({ array: ['a', 'b'] }) + var expected = 'array:\n - a\n - b\n' + assert.strictEqual(output, expected) +}) it('should not indent arrays an extra level when disabled', function () { - var output = yaml.dump({ array: [ 'a', 'b' ] }, { noArrayIndent: true }); - var expected = 'array:\n- a\n- b\n'; - assert.strictEqual(output, expected); -}); + var output = yaml.dump({ array: ['a', 'b'] }, { noArrayIndent: true }) + var expected = 'array:\n- a\n- b\n' + assert.strictEqual(output, expected) +}) it('should always indent nested arrays', function () { - var output = yaml.dump({ array: [ 'a', [ 'b', 'c' ], 'd' ] }, { noArrayIndent: true }); - var expected = 'array:\n- a\n- - b\n - c\n- d\n'; - assert.strictEqual(output, expected); -}); + var output = yaml.dump({ array: ['a', ['b', 'c'], 'd'] }, { noArrayIndent: true }) + var expected = 'array:\n- a\n- - b\n - c\n- d\n' + assert.strictEqual(output, expected) +}) diff --git a/test/core/issues/0468.js b/test/core/issues/0468.js index f4c1e963..953f5122 100644 --- a/test/core/issues/0468.js +++ b/test/core/issues/0468.js @@ -1,9 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') it('should not indent arrays an extra level when disabled', function () { var output = yaml.dump( @@ -23,7 +23,7 @@ it('should not indent arrays an extra level when disabled', function () { } ], { noArrayIndent: true } - ); - var expected = '- a: a_val\n b: b_val\n- a: a2_val\n items:\n - a: a_a_val\n b: a_b_val\n'; - assert.strictEqual(output, expected); -}); + ) + var expected = '- a: a_val\n b: b_val\n- a: a2_val\n items:\n - a: a_a_val\n b: a_b_val\n' + assert.strictEqual(output, expected) +}) diff --git a/test/core/issues/0470.js b/test/core/issues/0470.js index 061d32f5..11af9542 100644 --- a/test/core/issues/0470.js +++ b/test/core/issues/0470.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Don\'t quote strings with : without need', function () { var data = { @@ -13,14 +12,14 @@ it('Don\'t quote strings with : without need', function () { // quotes required 'foo: bar': 'foo: bar', 'foo:': 'foo:' - }; + } var expected = ` http://example.com: http://example.com 'foo: bar': 'foo: bar' 'foo:': 'foo:' -`.replace(/^\n/, ''); +`.replace(/^\n/, '') - assert.strictEqual(yaml.dump(data), expected); - assert.deepStrictEqual(yaml.load(expected), data); -}); + assert.strictEqual(yaml.dump(data), expected) + assert.deepStrictEqual(yaml.load(expected), data) +}) diff --git a/test/core/issues/0475.js b/test/core/issues/0475.js index 97334f2f..ce0aec5a 100644 --- a/test/core/issues/0475.js +++ b/test/core/issues/0475.js @@ -1,28 +1,27 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); -var readFileSync = require('fs').readFileSync; +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') +var readFileSync = require('fs').readFileSync it('Should not allow nested arrays in map keys (explicit syntax)', function () { try { - yaml.load(readFileSync(require('path').join(__dirname, '/0475-case1.yml'), 'utf8')); + yaml.load(readFileSync(require('path').join(__dirname, '/0475-case1.yml'), 'utf8')) } catch (err) { - assert(err.stack.startsWith('YAMLException: nested arrays are not supported inside keys')); - return; + assert(err.stack.startsWith('YAMLException: nested arrays are not supported inside keys')) + return } - assert.fail(null, null, 'Expected an error to be thrown'); -}); + assert.fail(null, null, 'Expected an error to be thrown') +}) it('Should not allow nested arrays in map keys (implicit syntax)', function () { try { - yaml.load(readFileSync(require('path').join(__dirname, '/0475-case2.yml'), 'utf8')); + yaml.load(readFileSync(require('path').join(__dirname, '/0475-case2.yml'), 'utf8')) } catch (err) { - assert(err.stack.startsWith('YAMLException: nested arrays are not supported inside keys')); - return; + assert(err.stack.startsWith('YAMLException: nested arrays are not supported inside keys')) + return } - assert.fail(null, null, 'Expected an error to be thrown'); -}); + assert.fail(null, null, 'Expected an error to be thrown') +}) diff --git a/test/core/issues/0519.js b/test/core/issues/0519.js index 4a1d8896..c594ace3 100644 --- a/test/core/issues/0519.js +++ b/test/core/issues/0519.js @@ -1,13 +1,13 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') it('Dumper should add quotes around equals sign', function () { // pyyaml fails with unquoted `=` // https://yaml-online-parser.appspot.com/?yaml=%3D%0A&type=json - assert.strictEqual(yaml.load(yaml.dump('=')), '='); - assert.strictEqual(yaml.dump('='), "'='\n"); -}); + assert.strictEqual(yaml.load(yaml.dump('=')), '=') + assert.strictEqual(yaml.dump('='), "'='\n") +}) diff --git a/test/core/issues/0521.js b/test/core/issues/0521.js index d98b692c..aeb1bf55 100644 --- a/test/core/issues/0521.js +++ b/test/core/issues/0521.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Don\'t quote strings with # without need', function () { var required = ` @@ -12,21 +11,20 @@ http://example.com/page#anchor: no:quotes#required parameter#fallback: 'quotes #required' 'quotes: required': Visit [link](http://example.com/foo#bar) 'foo #bar': key is quoted -`.replace(/^\n/, ''); +`.replace(/^\n/, '') var sample = { 'http://example.com/page#anchor': 'no:quotes#required', 'parameter#fallback': 'quotes #required', 'quotes: required': 'Visit [link](http://example.com/foo#bar)', 'foo #bar': 'key is quoted' - }; + } assert.strictEqual( yaml.dump(sample), required - ); -}); - + ) +}) it('Quote []{} in block-level scalars, but not in flow', function () { var required = ` @@ -36,7 +34,7 @@ nested: key1: a[]b key2: a{}b nested: {key1: 'a[]b', key2: 'a{}b', nested: {key1: 'a[]b', key2: 'a{}b'}} -`.replace(/^\n/, ''); +`.replace(/^\n/, '') var sample = { key1: 'a[]b', @@ -53,10 +51,10 @@ nested: } } } - }; + } assert.strictEqual( yaml.dump(sample, { flowLevel: 2 }), required - ); -}); + ) +}) diff --git a/test/core/issues/0525-1.js b/test/core/issues/0525-1.js index 30faafc7..4c216be2 100644 --- a/test/core/issues/0525-1.js +++ b/test/core/issues/0525-1.js @@ -1,17 +1,16 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Should throw if there is a null-byte in input', function () { try { - yaml.load('foo\0bar'); + yaml.load('foo\0bar') } catch (err) { - assert(err.stack.startsWith('YAMLException: null byte is not allowed in input')); - return; + assert(err.stack.startsWith('YAMLException: null byte is not allowed in input')) + return } - assert.fail(null, null, 'Expected an error to be thrown'); -}); + assert.fail(null, null, 'Expected an error to be thrown') +}) diff --git a/test/core/issues/0525-2.js b/test/core/issues/0525-2.js index e656cbe7..7c62aa1b 100644 --- a/test/core/issues/0525-2.js +++ b/test/core/issues/0525-2.js @@ -1,17 +1,16 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Should check kind type when resolving ! tag', function () { try { - yaml.load('! [0]'); + yaml.load('! [0]') } catch (err) { - assert(err.stack.startsWith('YAMLException: unacceptable node kind for ! tag')); - return; + assert(err.stack.startsWith('YAMLException: unacceptable node kind for ! tag')) + return } - assert.fail(null, null, 'Expected an error to be thrown'); -}); + assert.fail(null, null, 'Expected an error to be thrown') +}) diff --git a/test/core/issues/0529.js b/test/core/issues/0529.js index 588c330d..bc913fd4 100644 --- a/test/core/issues/0529.js +++ b/test/core/issues/0529.js @@ -1,9 +1,9 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -const assert = require('assert'); -const yaml = require('js-yaml'); +const assert = require('assert') +const yaml = require('js-yaml') const sample = { // normal key-value pair @@ -55,8 +55,7 @@ const sample = { // bool compat yes: 'yes' -}; - +} describe('should format strings with specified quoting type', function () { it('quotingType=\', forceQuotes=false', function () { @@ -90,11 +89,10 @@ nonprintable2: "foo\\vbar test test test test test test test test test test test nonprintable3: "foo\\vbar foo\\nbar\\nbaz" empty: '' 'yes': 'yes' -`.replace(/^\n/, ''); - - assert.strictEqual(yaml.dump(sample, { quotingType: "'", forceQuotes: false }), expected); - }); +`.replace(/^\n/, '') + assert.strictEqual(yaml.dump(sample, { quotingType: "'", forceQuotes: false }), expected) + }) it('quotingType=\", forceQuotes=false', function () { const expected = ` @@ -127,11 +125,10 @@ nonprintable2: "foo\\vbar test test test test test test test test test test test nonprintable3: "foo\\vbar foo\\nbar\\nbaz" empty: "" "yes": "yes" -`.replace(/^\n/, ''); - - assert.strictEqual(yaml.dump(sample, { quotingType: '"', forceQuotes: false }), expected); - }); +`.replace(/^\n/, '') + assert.strictEqual(yaml.dump(sample, { quotingType: '"', forceQuotes: false }), expected) + }) it('quotingType=\', forceQuotes=true', function () { const expected = ` @@ -157,11 +154,10 @@ nonprintable2: "foo\\vbar test test test test test test test test test test test nonprintable3: "foo\\vbar foo\\nbar\\nbaz" empty: '' 'yes': 'yes' -`.replace(/^\n/, ''); - - assert.strictEqual(yaml.dump(sample, { quotingType: "'", forceQuotes: true }), expected); - }); +`.replace(/^\n/, '') + assert.strictEqual(yaml.dump(sample, { quotingType: "'", forceQuotes: true }), expected) + }) it('quotingType=\", forceQuotes=true', function () { const expected = ` @@ -187,8 +183,8 @@ nonprintable2: "foo\\vbar test test test test test test test test test test test nonprintable3: "foo\\vbar foo\\nbar\\nbaz" empty: "" "yes": "yes" -`.replace(/^\n/, ''); +`.replace(/^\n/, '') - assert.strictEqual(yaml.dump(sample, { quotingType: '"', forceQuotes: true }), expected); - }); -}); + assert.strictEqual(yaml.dump(sample, { quotingType: '"', forceQuotes: true }), expected) + }) +}) diff --git a/test/core/issues/0570.js b/test/core/issues/0570.js index 5b0ce667..bc2f5792 100644 --- a/test/core/issues/0570.js +++ b/test/core/issues/0570.js @@ -1,13 +1,12 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('should dump null in different styles', function () { - let dump, src = { foo: null, bar: 1 }; + let dump, src = { foo: null, bar: 1 } let tests = { lowercase: 'null', @@ -15,11 +14,11 @@ it('should dump null in different styles', function () { camelcase: 'Null', canonical: '~', empty: '' - }; + } - for (let [ name, value ] of Object.entries(tests)) { - dump = yaml.dump(src, { styles: { '!!null': name } }); - assert.strictEqual(dump, 'foo: ' + value + '\nbar: 1\n'); - assert.deepStrictEqual(yaml.load(dump), src); + for (let [name, value] of Object.entries(tests)) { + dump = yaml.dump(src, { styles: { '!!null': name } }) + assert.strictEqual(dump, 'foo: ' + value + '\nbar: 1\n') + assert.deepStrictEqual(yaml.load(dump), src) } -}); +}) diff --git a/test/core/issues/0571.js b/test/core/issues/0571.js index 1e33e2d3..7fcbb57b 100644 --- a/test/core/issues/0571.js +++ b/test/core/issues/0571.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { describe, it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') describe('Undefined', function () { let undef = new yaml.Type('!undefined', { @@ -13,62 +12,58 @@ describe('Undefined', function () { construct: () => {}, predicate: object => typeof object === 'undefined', represent: () => '' - }); - - let undef_schema = yaml.DEFAULT_SCHEMA.extend(undef); + }) + let undef_schema = yaml.DEFAULT_SCHEMA.extend(undef) it('Should replace undefined with null in collections', function () { - let str; + let str - str = yaml.dump([ undefined, 1, undefined, null, 2 ], { flowLevel: 0 }); - assert(str.match(/^\[/)); + str = yaml.dump([undefined, 1, undefined, null, 2], { flowLevel: 0 }) + assert(str.match(/^\[/)) assert.deepStrictEqual( yaml.load(str), - [ null, 1, null, null, 2 ] - ); + [null, 1, null, null, 2] + ) - str = yaml.dump([ undefined, 1, undefined, null, 2 ], { flowLevel: -1 }); - assert(str.match(/^- /)); + str = yaml.dump([undefined, 1, undefined, null, 2], { flowLevel: -1 }) + assert(str.match(/^- /)) assert.deepStrictEqual( yaml.load(str), - [ null, 1, null, null, 2 ] - ); - }); - + [null, 1, null, null, 2] + ) + }) it('Should remove keys with undefined in mappings', function () { - let str; + let str - str = yaml.dump({ t: undefined, foo: 1, bar: undefined, baz: null }, { flowLevel: 0 }); - assert(str.match(/^\{/)); + str = yaml.dump({ t: undefined, foo: 1, bar: undefined, baz: null }, { flowLevel: 0 }) + assert(str.match(/^\{/)) assert.deepStrictEqual( yaml.load(str), { foo: 1, baz: null } - ); + ) - str = yaml.dump({ t: undefined, foo: 1, bar: undefined, baz: null }, { flowLevel: -1 }); - assert(str.match(/^foo:/)); + str = yaml.dump({ t: undefined, foo: 1, bar: undefined, baz: null }, { flowLevel: -1 }) + assert(str.match(/^foo:/)) assert.deepStrictEqual( yaml.load(str), { foo: 1, baz: null } - ); - }); - + ) + }) it("Should serialize top-level undefined to ''", function () { - assert.strictEqual(yaml.dump(undefined), ''); - }); - + assert.strictEqual(yaml.dump(undefined), '') + }) it('Should serialize undefined if schema is available', function () { assert.deepStrictEqual( yaml.load( - yaml.dump([ 1, undefined, null, 2 ], { schema: undef_schema }), + yaml.dump([1, undefined, null, 2], { schema: undef_schema }), { schema: undef_schema } ), - [ 1, undefined, null, 2 ] - ); + [1, undefined, null, 2] + ) assert.deepStrictEqual( yaml.load( @@ -76,40 +71,37 @@ describe('Undefined', function () { { schema: undef_schema } ), { foo: 1, bar: undefined, baz: null } - ); - }); - + ) + }) it('Should respect null formatting', function () { assert.strictEqual( - yaml.dump([ undefined ], { styles: { '!!null': 'uppercase' } }), + yaml.dump([undefined], { styles: { '!!null': 'uppercase' } }), '- NULL\n' - ); - }); - + ) + }) it('Should return an error if neither null nor undefined schemas are available', function () { assert.throws(() => { - yaml.dump([ 'foo', undefined, 'bar' ], { schema: yaml.FAILSAFE_SCHEMA }); - }, /unacceptable kind of an object to dump/); - }); - + yaml.dump(['foo', undefined, 'bar'], { schema: yaml.FAILSAFE_SCHEMA }) + }, /unacceptable kind of an object to dump/) + }) it('Should skip leading values correctly', function () { assert.strictEqual( - yaml.dump([ () => {}, 'a' ], { flowLevel: 0, skipInvalid: true }), - '[a]\n'); + yaml.dump([() => {}, 'a'], { flowLevel: 0, skipInvalid: true }), + '[a]\n') assert.strictEqual( - yaml.dump([ () => {}, 'a' ], { flowLevel: -1, skipInvalid: true }), - '- a\n'); + yaml.dump([() => {}, 'a'], { flowLevel: -1, skipInvalid: true }), + '- a\n') assert.strictEqual( yaml.dump({ a: () => {}, b: 'a' }, { flowLevel: 0, skipInvalid: true }), - '{b: a}\n'); + '{b: a}\n') assert.strictEqual( yaml.dump({ a: () => {}, b: 'a' }, { flowLevel: -1, skipInvalid: true }), - 'b: a\n'); - }); -}); + 'b: a\n') + }) +}) diff --git a/test/core/issues/0576.js b/test/core/issues/0576.js index 7866a021..b3e7164e 100644 --- a/test/core/issues/0576.js +++ b/test/core/issues/0576.js @@ -1,54 +1,49 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { describe, it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') describe('Custom tags', function () { - let tag_names = [ 'tag', '!tag', '!!tag', '!', 'tag*-!< >{\n}', '!tagαβγ' ]; - let encoded = [ '!', '!tag', '!%21tag', '!%3C%21tag%3E', - '!', '!tag%CE%B1%CE%B2%CE%B3' ]; + let tag_names = ['tag', '!tag', '!!tag', '!', 'tag*-!< >{\n}', '!tagαβγ'] + let encoded = ['!', '!tag', '!%21tag', '!%3C%21tag%3E', + '!', '!tag%CE%B1%CE%B2%CE%B3'] let tags = tag_names.map(tag => new yaml.Type(tag, { kind: 'scalar', resolve: () => true, - construct: object => [ tag, object ], + construct: object => [tag, object], predicate: object => object.tag === tag, represent: () => 'value' }) - ); - - let schema = yaml.DEFAULT_SCHEMA.extend(tags); + ) + let schema = yaml.DEFAULT_SCHEMA.extend(tags) it('Should dump tags with proper encoding', function () { tag_names.forEach(function (tag, idx) { - assert.strictEqual(yaml.dump({ tag }, { schema }), encoded[idx] + ' value\n'); - }); - }); - + assert.strictEqual(yaml.dump({ tag }, { schema }), encoded[idx] + ' value\n') + }) + }) it('Should decode tags when loading', function () { encoded.forEach(function (tag, idx) { - assert.deepStrictEqual(yaml.load(tag + ' value', { schema }), [ tag_names[idx], 'value' ]); - }); - }); - + assert.deepStrictEqual(yaml.load(tag + ' value', { schema }), [tag_names[idx], 'value']) + }) + }) it('Should url-decode built-in tags', function () { - assert.strictEqual(yaml.load('!!%69nt 123'), 123); - assert.strictEqual(yaml.load('!!%73tr 123'), '123'); - }); - + assert.strictEqual(yaml.load('!!%69nt 123'), 123) + assert.strictEqual(yaml.load('!!%73tr 123'), '123') + }) it('Should url-decode %TAG prefix', function () { assert.deepStrictEqual(yaml.load(` %TAG !xx! %74a --- !xx!g 123 -`, { schema }), [ 'tag', '123' ]); - }); -}); +`, { schema }), ['tag', '123']) + }) +}) diff --git a/test/core/issues/0586.js b/test/core/issues/0586.js index 7444834e..c0737b78 100644 --- a/test/core/issues/0586.js +++ b/test/core/issues/0586.js @@ -1,48 +1,45 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') it('Should allow custom formatting through implicit custom tags', function () { - function CustomDump(data, opts) { - if (!(this instanceof CustomDump)) return new CustomDump(data, opts); - this.data = data; - this.opts = opts; + function CustomDump (data, opts) { + if (!(this instanceof CustomDump)) return new CustomDump(data, opts) + this.data = data + this.opts = opts } CustomDump.prototype.represent = function () { - let result = yaml.dump(this.data, Object.assign({ replacer, schema }, this.opts)); - result = result.trim(); - if (result.includes('\n')) result = '\n' + result; - return result; - }; - + let result = yaml.dump(this.data, Object.assign({ replacer, schema }, this.opts)) + result = result.trim() + if (result.includes('\n')) result = '\n' + result + return result + } let CustomDumpType = new yaml.Type('!format', { kind: 'scalar', resolve: () => false, instanceOf: CustomDump, represent: d => d.represent() - }); - + }) - let schema = yaml.DEFAULT_SCHEMA.extend({ implicit: [ CustomDumpType ] }); + let schema = yaml.DEFAULT_SCHEMA.extend({ implicit: [CustomDumpType] }) - function replacer(key, value) { - if (key === '') return value; // top-level, don't change this - if (key === 'flow_choices') return CustomDump(value, { flowLevel: 0 }); - if (key === 'block_choices') return CustomDump(value, { flowLevel: Infinity }); - return value; // default + function replacer (key, value) { + if (key === '') return value // top-level, don't change this + if (key === 'flow_choices') return CustomDump(value, { flowLevel: 0 }) + if (key === 'block_choices') return CustomDump(value, { flowLevel: Infinity }) + return value // default } - let result = CustomDump({ flow_choices : [ 1, 2 ], block_choices: [ 4, 5 ] }).represent().trim(); + let result = CustomDump({ flow_choices : [1, 2], block_choices: [4, 5] }).represent().trim() assert.strictEqual(result, ` flow_choices: [1, 2] block_choices: - 4 -- 5`.replace(/^\n/, '')); -}); +- 5`.replace(/^\n/, '')) +}) diff --git a/test/core/issues/0587.js b/test/core/issues/0587.js index 29408cde..8493ddb5 100644 --- a/test/core/issues/0587.js +++ b/test/core/issues/0587.js @@ -1,11 +1,10 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Should not encode astral characters', function () { - assert.strictEqual(yaml.dump('😃😊'), '😃😊\n'); -}); + assert.strictEqual(yaml.dump('😃😊'), '😃😊\n') +}) diff --git a/test/core/issues/0614.js b/test/core/issues/0614.js index 6e6bc87b..1495f255 100644 --- a/test/core/issues/0614.js +++ b/test/core/issues/0614.js @@ -1,49 +1,46 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') /* global BigInt */ - -const assert = require('assert'); -const yaml = require('js-yaml'); - +const assert = require('assert') +const yaml = require('js-yaml') it('Should allow int override', function () { - let options = Object.assign({}, yaml.types.int.options); + let options = Object.assign({}, yaml.types.int.options) options.construct = data => { - let value = data, sign = 1n, ch; + let value = data, sign = 1n, ch if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); + value = value.replace(/_/g, '') } - ch = value[0]; + ch = value[0] if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1n; - value = value.slice(1); - ch = value[0]; + if (ch === '-') sign = -1n + value = value.slice(1) + ch = value[0] } - return sign * BigInt(value); - }; - + return sign * BigInt(value) + } - let BigIntType = new yaml.Type('tag:yaml.org,2002:int', options); + let BigIntType = new yaml.Type('tag:yaml.org,2002:int', options) - const SCHEMA = yaml.DEFAULT_SCHEMA.extend({ implicit: [ BigIntType ] }); + const SCHEMA = yaml.DEFAULT_SCHEMA.extend({ implicit: [BigIntType] }) const data = ` int: -123_456_789 bigint: -12_345_678_901_234_567_890 float: -12_345_678_901_234_567_890.1234 -`; +` assert.deepStrictEqual(yaml.load(data, { schema: SCHEMA }), { int: -123456789n, bigint: -12345678901234567890n, float: -12345678901234567000 // precision loss expected - }); -}); + }) +}) diff --git a/test/core/samples-common/construct-binary.js b/test/core/samples-common/construct-binary.js index afda0649..b79b6db4 100644 --- a/test/core/samples-common/construct-binary.js +++ b/test/core/samples-common/construct-binary.js @@ -1,7 +1,7 @@ -'use strict'; +'use strict' -function toTyped(data, encoding) { - return new Uint8Array(Buffer.from(data, encoding)); +function toTyped (data, encoding) { + return new Uint8Array(Buffer.from(data, encoding)) } module.exports = { @@ -10,4 +10,4 @@ module.exports = { generic: toTyped("GIF89a\x0c\x00\x0c\x00\x84\x00\x00\xff\xff\xf7\xf5\xf5\xee\xe9\xe9\xe5fff\x00\x00\x00\xe7\xe7\xe7^^^\xf3\xf3\xed\x8e\x8e\x8e\xe0\xe0\xe0\x9f\x9f\x9f\x93\x93\x93\xa7\xa7\xa7\x9e\x9e\x9eiiiccc\xa3\xa3\xa3\x84\x84\x84\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9\xff\xfe\xf9!\xfe\x0eMade with GIMP\x00,\x00\x00\x00\x00\x0c\x00\x0c\x00\x00\x05, \x8e\x810\x9e\xe3@\x14\xe8i\x10\xc4\xd1\x8a\x08\x1c\xcf\x80M$z\xef\xff0\x85p\xb8\xb01f\r\x1b\xce\x01\xc3\x01\x1e\x10' \x82\n\x01\x00;", 'binary'), description: 'The binary value above is a tiny arrow encoded as a gif image.' -}; +} diff --git a/test/core/samples-common/construct-bool.js b/test/core/samples-common/construct-bool.js index a2e7ba57..fbbf1726 100644 --- a/test/core/samples-common/construct-bool.js +++ b/test/core/samples-common/construct-bool.js @@ -1,8 +1,8 @@ -'use strict'; +'use strict' module.exports = { - valid_true: [ true, true, true ], - valid_false: [ false, false, false ], - deprecated_true: [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON' ], - deprecated_false: [ 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' ] -}; + valid_true: [true, true, true], + valid_false: [false, false, false], + deprecated_true: ['y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON'], + deprecated_false: ['n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'] +} diff --git a/test/core/samples-common/construct-custom.js b/test/core/samples-common/construct-custom.js index a2b8768f..239a96c6 100644 --- a/test/core/samples-common/construct-custom.js +++ b/test/core/samples-common/construct-custom.js @@ -1,7 +1,7 @@ -'use strict'; +'use strict' -var assert = require('assert'); -var schema = require('../support/schema'); +var assert = require('assert') +var schema = require('../support/schema') var expected = [ new schema.Tag1({ x: 1 }), @@ -10,35 +10,35 @@ var expected = [ new schema.Tag3({ x: 1 }), new schema.Tag3({ x: 1, y: 2, z: 3 }), new schema.Tag3({ x: 1, y: 2, z: 3 }), - new schema.Foo({ myParameter: 'foo', myAnotherParameter: [ 1, 2, 3 ] }) -]; + new schema.Foo({ myParameter: 'foo', myAnotherParameter: [1, 2, 3] }) +] -function testHandler(actual) { - assert.strictEqual(Object.prototype.toString.call(actual), '[object Array]'); - assert.strictEqual(actual.length, 7); +function testHandler (actual) { + assert.strictEqual(Object.prototype.toString.call(actual), '[object Array]') + assert.strictEqual(actual.length, 7) - assert.deepStrictEqual(actual[0], expected[0]); - assert.strictEqual(Object.getPrototypeOf(actual[0]), Object.getPrototypeOf(expected[0])); + assert.deepStrictEqual(actual[0], expected[0]) + assert.strictEqual(Object.getPrototypeOf(actual[0]), Object.getPrototypeOf(expected[0])) - assert.deepStrictEqual(actual[1], expected[1]); - assert.strictEqual(Object.getPrototypeOf(actual[1]), Object.getPrototypeOf(expected[1])); + assert.deepStrictEqual(actual[1], expected[1]) + assert.strictEqual(Object.getPrototypeOf(actual[1]), Object.getPrototypeOf(expected[1])) - assert.deepStrictEqual(actual[2], expected[2]); - assert.strictEqual(Object.getPrototypeOf(actual[2]), Object.getPrototypeOf(expected[2])); + assert.deepStrictEqual(actual[2], expected[2]) + assert.strictEqual(Object.getPrototypeOf(actual[2]), Object.getPrototypeOf(expected[2])) - assert.deepStrictEqual(actual[3], expected[3]); - assert.strictEqual(Object.getPrototypeOf(actual[3]), Object.getPrototypeOf(expected[3])); + assert.deepStrictEqual(actual[3], expected[3]) + assert.strictEqual(Object.getPrototypeOf(actual[3]), Object.getPrototypeOf(expected[3])) - assert.deepStrictEqual(actual[4], expected[4]); - assert.strictEqual(Object.getPrototypeOf(actual[4]), Object.getPrototypeOf(expected[4])); + assert.deepStrictEqual(actual[4], expected[4]) + assert.strictEqual(Object.getPrototypeOf(actual[4]), Object.getPrototypeOf(expected[4])) - assert.deepStrictEqual(actual[5], expected[5]); - assert.strictEqual(Object.getPrototypeOf(actual[5]), Object.getPrototypeOf(expected[5])); + assert.deepStrictEqual(actual[5], expected[5]) + assert.strictEqual(Object.getPrototypeOf(actual[5]), Object.getPrototypeOf(expected[5])) - assert.deepStrictEqual(actual[6], expected[6]); - assert.strictEqual(Object.getPrototypeOf(actual[6]), Object.getPrototypeOf(expected[6])); + assert.deepStrictEqual(actual[6], expected[6]) + assert.strictEqual(Object.getPrototypeOf(actual[6]), Object.getPrototypeOf(expected[6])) } -testHandler.expected = expected; +testHandler.expected = expected -module.exports = testHandler; +module.exports = testHandler diff --git a/test/core/samples-common/construct-float.js b/test/core/samples-common/construct-float.js index ec76008b..44152aef 100644 --- a/test/core/samples-common/construct-float.js +++ b/test/core/samples-common/construct-float.js @@ -1,6 +1,6 @@ -'use strict'; +'use strict' -var assert = require('assert'); +var assert = require('assert') var expected = { canonical: 685230.15, @@ -8,20 +8,20 @@ var expected = { fixed: 685230.15, 'negative infinity': Number.NEGATIVE_INFINITY, 'not a number': NaN -}; +} -function testHandler(actual) { - assert.strictEqual(Object.prototype.toString.call(actual), '[object Object]'); - assert.strictEqual(Object.keys(actual).sort().join(','), Object.keys(expected).sort().join(',')); +function testHandler (actual) { + assert.strictEqual(Object.prototype.toString.call(actual), '[object Object]') + assert.strictEqual(Object.keys(actual).sort().join(','), Object.keys(expected).sort().join(',')) - assert.strictEqual(actual['canonical'], expected['canonical']); - assert.strictEqual(actual['exponential'], expected['exponential']); - assert.strictEqual(actual['fixed'], expected['fixed']); - assert.strictEqual(actual['negative infinity'], expected['negative infinity']); + assert.strictEqual(actual['canonical'], expected['canonical']) + assert.strictEqual(actual['exponential'], expected['exponential']) + assert.strictEqual(actual['fixed'], expected['fixed']) + assert.strictEqual(actual['negative infinity'], expected['negative infinity']) - assert(Number.isNaN(actual['not a number'])); + assert(Number.isNaN(actual['not a number'])) } -testHandler.expected = expected; +testHandler.expected = expected -module.exports = testHandler; +module.exports = testHandler diff --git a/test/core/samples-common/construct-int.js b/test/core/samples-common/construct-int.js index beee5309..57478820 100644 --- a/test/core/samples-common/construct-int.js +++ b/test/core/samples-common/construct-int.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = { canonical: 685230, @@ -6,4 +6,4 @@ module.exports = { octal: 685230, hexadecimal: 685230, binary: 685230 -}; +} diff --git a/test/core/samples-common/construct-map.js b/test/core/samples-common/construct-map.js index 195680d9..b91ec0a6 100644 --- a/test/core/samples-common/construct-map.js +++ b/test/core/samples-common/construct-map.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = { 'Block style': { @@ -12,4 +12,4 @@ module.exports = { Oren: 'Ben-Kiki' }, 'foo,bar': 'baz' -}; +} diff --git a/test/core/samples-common/construct-merge.js b/test/core/samples-common/construct-merge.js index b05b916c..225f524a 100644 --- a/test/core/samples-common/construct-merge.js +++ b/test/core/samples-common/construct-merge.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = [ { x: 1, y: 2 }, @@ -9,4 +9,4 @@ module.exports = [ { x: 1, y: 2, r: 10, label: 'center/big' }, { x: 1, y: 2, r: 10, label: 'center/big' }, { x: 1, y: 2, r: 10, label: 'center/big' } -]; +] diff --git a/test/core/samples-common/construct-null.js b/test/core/samples-common/construct-null.js index c94c1a2e..950a4212 100644 --- a/test/core/samples-common/construct-null.js +++ b/test/core/samples-common/construct-null.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = [ null, @@ -17,4 +17,4 @@ module.exports = [ null ] } -]; +] diff --git a/test/core/samples-common/construct-omap.js b/test/core/samples-common/construct-omap.js index 3c98d7f6..ef17af35 100644 --- a/test/core/samples-common/construct-omap.js +++ b/test/core/samples-common/construct-omap.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = { Bestiary: [ @@ -11,4 +11,4 @@ module.exports = { { two : 2 }, { three : 3 } ] -}; +} diff --git a/test/core/samples-common/construct-pairs.js b/test/core/samples-common/construct-pairs.js index 595a56c4..97210bfe 100644 --- a/test/core/samples-common/construct-pairs.js +++ b/test/core/samples-common/construct-pairs.js @@ -1,14 +1,14 @@ -'use strict'; +'use strict' module.exports = { 'Block tasks': [ - [ 'meeting', 'with team.' ], - [ 'meeting', 'with boss.' ], - [ 'break', 'lunch.' ], - [ 'meeting', 'with client.' ] + ['meeting', 'with team.'], + ['meeting', 'with boss.'], + ['break', 'lunch.'], + ['meeting', 'with client.'] ], 'Flow tasks': [ - [ 'meeting', 'with team' ], - [ 'meeting', 'with boss' ] + ['meeting', 'with team'], + ['meeting', 'with boss'] ] -}; +} diff --git a/test/core/samples-common/construct-seq.js b/test/core/samples-common/construct-seq.js index 6962d595..9349184b 100644 --- a/test/core/samples-common/construct-seq.js +++ b/test/core/samples-common/construct-seq.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = { 'Block style': [ @@ -23,4 +23,4 @@ module.exports = { 'Neptune', 'Pluto' ] -}; +} diff --git a/test/core/samples-common/construct-set.js b/test/core/samples-common/construct-set.js index 1e39ba8a..2eead2cd 100644 --- a/test/core/samples-common/construct-set.js +++ b/test/core/samples-common/construct-set.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = { 'baseball players': { @@ -11,4 +11,4 @@ module.exports = { 'Detroit Tigers': null, 'New York Yankees': null } -}; +} diff --git a/test/core/samples-common/construct-str-ascii.js b/test/core/samples-common/construct-str-ascii.js index ddb434d0..56e5670d 100644 --- a/test/core/samples-common/construct-str-ascii.js +++ b/test/core/samples-common/construct-str-ascii.js @@ -1,3 +1,3 @@ -'use strict'; +'use strict' -module.exports = 'ascii string'; +module.exports = 'ascii string' diff --git a/test/core/samples-common/construct-str-utf8.js b/test/core/samples-common/construct-str-utf8.js index a0bb6dab..03e75f34 100644 --- a/test/core/samples-common/construct-str-utf8.js +++ b/test/core/samples-common/construct-str-utf8.js @@ -1,3 +1,3 @@ -'use strict'; +'use strict' -module.exports = '\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430'; +module.exports = '\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430' diff --git a/test/core/samples-common/construct-str.js b/test/core/samples-common/construct-str.js index 3307e0ec..4f9119e6 100644 --- a/test/core/samples-common/construct-str.js +++ b/test/core/samples-common/construct-str.js @@ -1,5 +1,5 @@ -'use strict'; +'use strict' module.exports = { string: 'abcd' -}; +} diff --git a/test/core/samples-common/construct-string-types.js b/test/core/samples-common/construct-string-types.js index 5c38d111..3264f910 100644 --- a/test/core/samples-common/construct-string-types.js +++ b/test/core/samples-common/construct-string-types.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' var essay = 'a\n' + 'b\n' + @@ -14,7 +14,7 @@ var essay = 'a\n' + 'aaaa bbbb cccc dddd eeeee fff ggggggg hhhi iiii jjjj ' + 'long asdfasdfasdfasdfslong ' + ' xlong ' + - 'asdfasdfasdfasdfasdfasdfasdfasd asdf xasdf the end'; + 'asdfasdfasdfasdfasdfasdfasdfasd asdf xasdf the end' module.exports = { simpleString: 'hello world', @@ -48,7 +48,7 @@ module.exports = { questy: '?asdf', // Example 8.1. - blockScalarHeader: [ 'literal\n', ' folded\n', 'keep\n\n', ' strip' ], + blockScalarHeader: ['literal\n', ' folded\n', 'keep\n\n', ' strip'], // Example 8.2. // The ' \t' is a more-indented line as per [177] s-nb-spaced-text. blockIndentationIndicator: [ @@ -66,49 +66,49 @@ module.exports = { longMultiTrailingCR: new Array(80).join('lo hel') + '\nworld\n\n\n\n\n', longMulti: new Array(80).join('lo hel') + '\nworld\n' -}; +} // now indent the long multi really far var obj = module.exports, - i; + i for (i = 0; i < 5; i++) { - obj.indent = {}; - obj = obj.indent; + obj.indent = {} + obj = obj.indent } -obj.ind = module.exports.longMulti; +obj.ind = module.exports.longMulti for (i = 0; i < 5; i++) { - obj.indent = {}; - obj = obj.indent; + obj.indent = {} + obj = obj.indent } -obj.ind = module.exports.longMulti; +obj.ind = module.exports.longMulti for (i = 0; i < 5; i++) { - obj.indent = {}; - obj = obj.indent; + obj.indent = {} + obj = obj.indent } -obj.ind = module.exports.longMulti; +obj.ind = module.exports.longMulti for (i = 0; i < 5; i++) { - obj.indent = {}; - obj = obj.indent; + obj.indent = {} + obj = obj.indent } -obj.ind = module.exports.longMulti; +obj.ind = module.exports.longMulti for (i = 0; i < 5; i++) { - obj.indent = {}; - obj = obj.indent; + obj.indent = {} + obj = obj.indent } -obj.ind = module.exports.longMulti; +obj.ind = module.exports.longMulti for (i = 0; i < 5; i++) { - obj.indent = {}; - obj = obj.indent; + obj.indent = {} + obj = obj.indent } -obj.ind = module.exports.longMulti; +obj.ind = module.exports.longMulti diff --git a/test/core/samples-common/construct-timestamp.js b/test/core/samples-common/construct-timestamp.js index 462c6919..d82b88c1 100644 --- a/test/core/samples-common/construct-timestamp.js +++ b/test/core/samples-common/construct-timestamp.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = { canonical: new Date(Date.UTC(2001, 11, 15, 2, 59, 43, 100)), @@ -7,4 +7,4 @@ module.exports = { 'no time zone (Z)': new Date(Date.UTC(2001, 11, 15, 2, 59, 43, 100)), 'date (00:00:00Z)': new Date(Date.UTC(2002, 11, 14)), 'not a date': '2002-1-1' -}; +} diff --git a/test/core/samples-common/construct-value.js b/test/core/samples-common/construct-value.js index d534dc69..7ed8de8d 100644 --- a/test/core/samples-common/construct-value.js +++ b/test/core/samples-common/construct-value.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = [ { @@ -13,4 +13,4 @@ module.exports = [ { '=': 'library2.dll', version: 2.3 } ] } -]; +] diff --git a/test/core/samples-common/dump-empty-collections.js b/test/core/samples-common/dump-empty-collections.js index 01ca101d..0591ac63 100644 --- a/test/core/samples-common/dump-empty-collections.js +++ b/test/core/samples-common/dump-empty-collections.js @@ -1,7 +1,6 @@ -'use strict'; - +'use strict' module.exports = { emptyArray: [], emptyObject: {} -}; +} diff --git a/test/core/samples-common/duplicate-mapping-key.js b/test/core/samples-common/duplicate-mapping-key.js index 43e9e94b..99694356 100644 --- a/test/core/samples-common/duplicate-mapping-key.js +++ b/test/core/samples-common/duplicate-mapping-key.js @@ -1,8 +1,8 @@ -'use strict'; +'use strict' module.exports = { foo: { baz: 'bat', foo: 'duplicate key' } -}; +} diff --git a/test/core/samples-common/duplicate-merge-key.js b/test/core/samples-common/duplicate-merge-key.js index df445815..0c67771f 100644 --- a/test/core/samples-common/duplicate-merge-key.js +++ b/test/core/samples-common/duplicate-merge-key.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = { x: 1, @@ -6,4 +6,4 @@ module.exports = { foo: 'bar', z: 3, t: 4 -}; +} diff --git a/test/core/samples-common/emitting-unacceptable-unicode-character-bug.js b/test/core/samples-common/emitting-unacceptable-unicode-character-bug.js index 7d5d677f..8afdfe81 100644 --- a/test/core/samples-common/emitting-unacceptable-unicode-character-bug.js +++ b/test/core/samples-common/emitting-unacceptable-unicode-character-bug.js @@ -1,3 +1,3 @@ -'use strict'; +'use strict' -module.exports = '\udd00'; +module.exports = '\udd00' diff --git a/test/core/samples-common/invalid-single-quote-bug.js b/test/core/samples-common/invalid-single-quote-bug.js index 9d949fca..c50c2cf8 100644 --- a/test/core/samples-common/invalid-single-quote-bug.js +++ b/test/core/samples-common/invalid-single-quote-bug.js @@ -1,6 +1,6 @@ -'use strict'; +'use strict' module.exports = [ "foo 'bar'", "foo\n'bar'" -]; +] diff --git a/test/core/samples-common/more-floats.js b/test/core/samples-common/more-floats.js index abc24829..6fa3d1b0 100644 --- a/test/core/samples-common/more-floats.js +++ b/test/core/samples-common/more-floats.js @@ -1,6 +1,6 @@ -'use strict'; +'use strict' -var assert = require('assert'); +var assert = require('assert') var expected = [ 0.0, @@ -10,20 +10,20 @@ var expected = [ Number.NEGATIVE_INFINITY, NaN, NaN -]; +] -function testHandler(actual) { - assert.strictEqual(Object.prototype.toString.call(actual), '[object Array]'); - assert.strictEqual(actual.length, 7); - assert.strictEqual(actual[0], expected[0]); - assert.strictEqual(actual[1], expected[1]); - assert.strictEqual(actual[2], expected[2]); - assert.strictEqual(actual[3], expected[3]); - assert.strictEqual(actual[4], expected[4]); - assert(Number.isNaN(actual[5])); - assert(Number.isNaN(actual[6])); +function testHandler (actual) { + assert.strictEqual(Object.prototype.toString.call(actual), '[object Array]') + assert.strictEqual(actual.length, 7) + assert.strictEqual(actual[0], expected[0]) + assert.strictEqual(actual[1], expected[1]) + assert.strictEqual(actual[2], expected[2]) + assert.strictEqual(actual[3], expected[3]) + assert.strictEqual(actual[4], expected[4]) + assert(Number.isNaN(actual[5])) + assert(Number.isNaN(actual[6])) } -testHandler.expected = expected; +testHandler.expected = expected -module.exports = testHandler; +module.exports = testHandler diff --git a/test/core/samples-common/negative-float-bug.js b/test/core/samples-common/negative-float-bug.js index b80bdcd8..fb385178 100644 --- a/test/core/samples-common/negative-float-bug.js +++ b/test/core/samples-common/negative-float-bug.js @@ -1,3 +1,3 @@ -'use strict'; +'use strict' -module.exports = -1.0; +module.exports = -1.0 diff --git a/test/core/samples-common/single-dot-is-not-float-bug.js b/test/core/samples-common/single-dot-is-not-float-bug.js index 980beaa2..64c2b9b6 100644 --- a/test/core/samples-common/single-dot-is-not-float-bug.js +++ b/test/core/samples-common/single-dot-is-not-float-bug.js @@ -1,3 +1,3 @@ -'use strict'; +'use strict' -module.exports = '.'; +module.exports = '.' diff --git a/test/core/samples-common/timestamp-bugs.js b/test/core/samples-common/timestamp-bugs.js index 58d8949f..97ec53cc 100644 --- a/test/core/samples-common/timestamp-bugs.js +++ b/test/core/samples-common/timestamp-bugs.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict' module.exports = [ new Date(Date.UTC(2001, 11, 15, 3, 29, 43, 100)), @@ -7,4 +7,4 @@ module.exports = [ new Date(Date.UTC(2001, 11, 14, (21 - 1), 59, 43, 0)), new Date(Date.UTC(2001, 11, 14, (21 + 1), (59 + 30), 43, 0)), new Date(Date.UTC(2005, 6, 8, 17, 35, 4, 517)) -]; +] diff --git a/test/core/samples-common/utf8-implicit.js b/test/core/samples-common/utf8-implicit.js index 975571c1..5581c1b1 100644 --- a/test/core/samples-common/utf8-implicit.js +++ b/test/core/samples-common/utf8-implicit.js @@ -1,3 +1,3 @@ -'use strict'; +'use strict' -module.exports = 'implicit UTF-8'; +module.exports = 'implicit UTF-8' diff --git a/test/core/samples-load-errors/duplicate-key.js b/test/core/samples-load-errors/duplicate-key.js index f66c52c8..414a55f0 100644 --- a/test/core/samples-load-errors/duplicate-key.js +++ b/test/core/samples-load-errors/duplicate-key.js @@ -1,3 +1,3 @@ -'use strict'; +'use strict' -module.exports = { foo: 'baz' }; +module.exports = { foo: 'baz' } diff --git a/test/core/samples-load-errors/duplicate-value-key.js b/test/core/samples-load-errors/duplicate-value-key.js index 98882f20..b44854cb 100644 --- a/test/core/samples-load-errors/duplicate-value-key.js +++ b/test/core/samples-load-errors/duplicate-value-key.js @@ -1,3 +1,3 @@ -'use strict'; +'use strict' -module.exports = { foo: 'bar', '=': 2 }; +module.exports = { foo: 'bar', '=': 2 } diff --git a/test/core/support/schema.js b/test/core/support/schema.js index 8afbccab..31488013 100644 --- a/test/core/support/schema.js +++ b/test/core/support/schema.js @@ -1,35 +1,29 @@ -'use strict'; +'use strict' +var util = require('util') +var yaml = require('js-yaml') -var util = require('util'); -var yaml = require('js-yaml'); - - -function Tag1(parameters) { - this.x = parameters.x; - this.y = parameters.y || 0; - this.z = parameters.z || 0; +function Tag1 (parameters) { + this.x = parameters.x + this.y = parameters.y || 0 + this.z = parameters.z || 0 } - -function Tag2() { - Tag1.apply(this, arguments); +function Tag2 () { + Tag1.apply(this, arguments) } -util.inherits(Tag2, Tag1); - +util.inherits(Tag2, Tag1) -function Tag3() { - Tag2.apply(this, arguments); +function Tag3 () { + Tag2.apply(this, arguments) } -util.inherits(Tag3, Tag2); +util.inherits(Tag3, Tag2) - -function Foo(parameters) { - this.myParameter = parameters.myParameter; - this.myAnotherParameter = parameters.myAnotherParameter; +function Foo (parameters) { + this.myParameter = parameters.myParameter + this.myAnotherParameter = parameters.myAnotherParameter } - var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ // NOTE: Type order matters! // Inherited classes must precede their parents because the dumper @@ -38,77 +32,76 @@ var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ new yaml.Type('!tag3', { kind: 'mapping', resolve: function (data) { - if (data === null) return false; + if (data === null) return false if (!Object.prototype.hasOwnProperty.call(data, '=') && !Object.prototype.hasOwnProperty.call(data, 'x')) { - return false; + return false } - if (!Object.keys(data).every(function (k) { return k === '=' || k === 'x' || k === 'y' || k === 'z'; })) { - return false; + if (!Object.keys(data).every(function (k) { return k === '=' || k === 'x' || k === 'y' || k === 'z' })) { + return false } - return true; + return true }, construct: function (data) { - return new Tag3({ x: (data['='] || data.x), y: data.y, z: data.z }); + return new Tag3({ x: (data['='] || data.x), y: data.y, z: data.z }) }, instanceOf: Tag3, represent: function (object) { - return { '=': object.x, y: object.y, z: object.z }; + return { '=': object.x, y: object.y, z: object.z } } }), new yaml.Type('!tag2', { kind: 'scalar', construct: function (data) { - return new Tag2({ x: (typeof data === 'number') ? data : parseInt(data, 10) }); + return new Tag2({ x: (typeof data === 'number') ? data : parseInt(data, 10) }) }, instanceOf: Tag2, represent: function (object) { - return String(object.x); + return String(object.x) } }), new yaml.Type('!tag1', { kind: 'mapping', resolve: function (data) { - if (data === null) return false; - if (!Object.prototype.hasOwnProperty.call(data, 'x')) return false; - if (!Object.keys(data).every(function (k) { return k === 'x' || k === 'y' || k === 'z'; })) { - return false; + if (data === null) return false + if (!Object.prototype.hasOwnProperty.call(data, 'x')) return false + if (!Object.keys(data).every(function (k) { return k === 'x' || k === 'y' || k === 'z' })) { + return false } - return true; + return true }, construct: function (data) { - return new Tag1({ x: data.x, y: data.y, z: data.z }); + return new Tag1({ x: data.x, y: data.y, z: data.z }) }, instanceOf: Tag1 }), new yaml.Type('!foo', { kind: 'mapping', resolve: function (data) { - if (data === null) return false; - if (!Object.keys(data).every(function (k) { return k === 'my-parameter' || k === 'my-another-parameter'; })) { - return false; + if (data === null) return false + if (!Object.keys(data).every(function (k) { return k === 'my-parameter' || k === 'my-another-parameter' })) { + return false } - return true; + return true }, construct: function (data) { return new Foo({ myParameter: data['my-parameter'], myAnotherParameter: data['my-another-parameter'] - }); + }) }, instanceOf: Foo, represent: function (object) { return { 'my-parameter': object.myParameter, 'my-another-parameter': object.myAnotherParameter - }; + } } }) -]); - +]) -module.exports.Tag1 = Tag1; -module.exports.Tag2 = Tag2; -module.exports.Tag3 = Tag3; -module.exports.Foo = Foo; -module.exports.TEST_SCHEMA = TEST_SCHEMA; +module.exports.Tag1 = Tag1 +module.exports.Tag2 = Tag2 +module.exports.Tag3 = Tag3 +module.exports.Foo = Foo +module.exports.TEST_SCHEMA = TEST_SCHEMA diff --git a/test/core/units/alias-nodes.js b/test/core/units/alias-nodes.js index 6be3b0ef..fede1145 100644 --- a/test/core/units/alias-nodes.js +++ b/test/core/units/alias-nodes.js @@ -1,59 +1,57 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') - -function TestClass(data) { - var self = this; - Object.keys(data).forEach(function (key) { self[key] = data[key]; }); +function TestClass (data) { + var self = this + Object.keys(data).forEach(function (key) { self[key] = data[key] }) } var TestClassYaml = new yaml.Type('!test', { kind: 'mapping', - construct: function (data) { return new TestClass(data); } -}); - -var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ TestClassYaml ]); + construct: function (data) { return new TestClass(data) } +}) +var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([TestClassYaml]) describe('Alias nodes', function () { describe('Resolving of an alias node should result the resolved and contructed value of the anchored node', function () { it('Simple built-in primitives', function () { - assert.strictEqual(yaml.load('[&1 "foobar", *1]')[1], 'foobar'); - assert.strictEqual(yaml.load('[&1 ~, *1]')[1], null); - assert.strictEqual(yaml.load('[&1 true, *1]')[1], true); - assert.strictEqual(yaml.load('[&1 42, *1]')[1], 42); - }); + assert.strictEqual(yaml.load('[&1 "foobar", *1]')[1], 'foobar') + assert.strictEqual(yaml.load('[&1 ~, *1]')[1], null) + assert.strictEqual(yaml.load('[&1 true, *1]')[1], true) + assert.strictEqual(yaml.load('[&1 42, *1]')[1], 42) + }) it('Simple built-in objects', function () { - assert.deepStrictEqual(yaml.load('[&1 [a, b, c, d], *1]')[1], [ 'a', 'b', 'c', 'd' ]); - assert.deepStrictEqual(yaml.load('[&1 {a: b, c: d}, *1]')[1], { a: 'b', c: 'd' }); - }); + assert.deepStrictEqual(yaml.load('[&1 [a, b, c, d], *1]')[1], ['a', 'b', 'c', 'd']) + assert.deepStrictEqual(yaml.load('[&1 {a: b, c: d}, *1]')[1], { a: 'b', c: 'd' }) + }) it('Recursive built-in objects', function () { - var actual = yaml.load('[&1 {self: *1}, *1]')[1]; + var actual = yaml.load('[&1 {self: *1}, *1]')[1] - assert(actual === actual.self); - }); + assert(actual === actual.self) + }) it('Simple custom objects', function () { var expected = new TestClass({ a: 'b', c: 'd' }), - actual = yaml.load('[&1 !test {a: b, c: d}, *1]', { schema: TEST_SCHEMA })[1]; + actual = yaml.load('[&1 !test {a: b, c: d}, *1]', { schema: TEST_SCHEMA })[1] - assert(actual instanceof TestClass); - assert.deepStrictEqual(actual, expected); - }); + assert(actual instanceof TestClass) + assert.deepStrictEqual(actual, expected) + }) // TODO: Not implemented yet (see issue #141) it.skip('Recursive custom objects', function () { - var actual = yaml.load('[&1 !test {self: *1}, *1]', { schema: TEST_SCHEMA })[1]; - - assert(actual instanceof TestClass); - assert(actual.self instanceof TestClass); - assert(actual === actual.self); - }); - }); -}); + var actual = yaml.load('[&1 !test {self: *1}, *1]', { schema: TEST_SCHEMA })[1] + + assert(actual instanceof TestClass) + assert(actual.self instanceof TestClass) + assert(actual === actual.self) + }) + }) +}) diff --git a/test/core/units/bom-strip.js b/test/core/units/bom-strip.js index 7eab36e8..bfbe5346 100644 --- a/test/core/units/bom-strip.js +++ b/test/core/units/bom-strip.js @@ -1,12 +1,11 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('BOM strip', function () { - assert.deepStrictEqual(yaml.load('\uFEFFfoo: bar\n'), { foo: 'bar' }); - assert.deepStrictEqual(yaml.load('foo: bar\n'), { foo: 'bar' }); -}); + assert.deepStrictEqual(yaml.load('\uFEFFfoo: bar\n'), { foo: 'bar' }) + assert.deepStrictEqual(yaml.load('foo: bar\n'), { foo: 'bar' }) +}) diff --git a/test/core/units/character-set.js b/test/core/units/character-set.js index 6f7058e2..8a118ab5 100644 --- a/test/core/units/character-set.js +++ b/test/core/units/character-set.js @@ -1,29 +1,28 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Allow astral characters', function () { - assert.deepStrictEqual(yaml.load('𝑘𝑒𝑦: 𝑣𝑎𝑙𝑢𝑒'), { '𝑘𝑒𝑦': '𝑣𝑎𝑙𝑢𝑒' }); -}); + assert.deepStrictEqual(yaml.load('𝑘𝑒𝑦: 𝑣𝑎𝑙𝑢𝑒'), { '𝑘𝑒𝑦': '𝑣𝑎𝑙𝑢𝑒' }) +}) it('Forbid non-printable characters', function () { - assert.throws(function () { yaml.load('\x01'); }, yaml.YAMLException); - assert.throws(function () { yaml.load('\x7f'); }, yaml.YAMLException); - assert.throws(function () { yaml.load('\x9f'); }, yaml.YAMLException); -}); + assert.throws(function () { yaml.load('\x01') }, yaml.YAMLException) + assert.throws(function () { yaml.load('\x7f') }, yaml.YAMLException) + assert.throws(function () { yaml.load('\x9f') }, yaml.YAMLException) +}) it('Forbid lone surrogates', function () { - assert.throws(function () { yaml.load('\udc00\ud800'); }, yaml.YAMLException); -}); + assert.throws(function () { yaml.load('\udc00\ud800') }, yaml.YAMLException) +}) it('Allow non-printable characters inside quoted scalars', function () { - assert.strictEqual(yaml.load('"\x7f\x9f\udc00\ud800"'), '\x7f\x9f\udc00\ud800'); -}); + assert.strictEqual(yaml.load('"\x7f\x9f\udc00\ud800"'), '\x7f\x9f\udc00\ud800') +}) it('Forbid control sequences inside quoted scalars', function () { - assert.throws(function () { yaml.load('"\x03"'); }, yaml.YAMLException); -}); + assert.throws(function () { yaml.load('"\x03"') }, yaml.YAMLException) +}) diff --git a/test/core/units/dump-scalar-styles.js b/test/core/units/dump-scalar-styles.js index cc93590d..f4bfe65e 100644 --- a/test/core/units/dump-scalar-styles.js +++ b/test/core/units/dump-scalar-styles.js @@ -1,29 +1,28 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') // Indents lines by 2 spaces. Empty lines (\n only) are not indented. -function indent(string) { - return string.replace(/^.+/gm, ' ' + '$&'); +function indent (string) { + return string.replace(/^.+/gm, ' ' + '$&') } -function getLength(s) { - return s.length; +function getLength (s) { + return s.length } // Repeats a string n times. -function repeat(string, n) { - return (new Array(n + 1)).join(string); +function repeat (string, n) { + return (new Array(n + 1)).join(string) } describe('Scalar style dump:', function () { - describe('Plain style', function () { it('is preferred', function () { - [ 'plain', + ['plain', 'hello world', 'pizza 3.14159', // cannot be misinterpreted as a number @@ -35,100 +34,100 @@ describe('Scalar style dump:', function () { '100% safe non-first characters? Of course!', 'Jack & Jill ' ].forEach(function (string) { - assert.strictEqual(yaml.dump(string), string + '\n'); - }); - }); + assert.strictEqual(yaml.dump(string), string + '\n') + }) + }) it('disallows flow indicators inside flow collections', function () { assert.strictEqual(yaml.dump({ quote: 'mispell [sic]' }, { flowLevel: 0 }), - "{quote: 'mispell [sic]'}\n"); + "{quote: 'mispell [sic]'}\n") assert.strictEqual(yaml.dump({ key: 'no commas, either' }, { flowLevel: 0 }), - "{key: 'no commas, either'}\n"); - }); - }); + "{key: 'no commas, either'}\n") + }) + }) describe('Single- and double-quoted styles', function () { it('quote strings of ambiguous type', function () { - assert.strictEqual(yaml.dump('Yes'), '\'Yes\'\n'); - assert.strictEqual(yaml.dump('true'), '\'true\'\n'); - assert.strictEqual(yaml.dump('42'), '\'42\'\n'); - assert.strictEqual(yaml.dump('99.9'), '\'99.9\'\n'); - assert.strictEqual(yaml.dump('127.0001'), '\'127.0001\'\n'); - assert.strictEqual(yaml.dump('1.23015e+3'), '\'1.23015e+3\'\n'); - }); + assert.strictEqual(yaml.dump('Yes'), '\'Yes\'\n') + assert.strictEqual(yaml.dump('true'), '\'true\'\n') + assert.strictEqual(yaml.dump('42'), '\'42\'\n') + assert.strictEqual(yaml.dump('99.9'), '\'99.9\'\n') + assert.strictEqual(yaml.dump('127.0001'), '\'127.0001\'\n') + assert.strictEqual(yaml.dump('1.23015e+3'), '\'1.23015e+3\'\n') + }) it('quote leading/trailing whitespace', function () { - assert.strictEqual(yaml.dump(' leading space'), '\' leading space\'\n'); - assert.strictEqual(yaml.dump('trailing space '), '\'trailing space \'\n'); - }); + assert.strictEqual(yaml.dump(' leading space'), '\' leading space\'\n') + assert.strictEqual(yaml.dump('trailing space '), '\'trailing space \'\n') + }) it('quote leading quotes', function () { - assert.strictEqual(yaml.dump("'singles double'"), "'''singles double'''\n"); - assert.strictEqual(yaml.dump('"single double'), '\'"single double\'\n'); - }); + assert.strictEqual(yaml.dump("'singles double'"), "'''singles double'''\n") + assert.strictEqual(yaml.dump('"single double'), '\'"single double\'\n') + }) it('escape \\ and " in double-quoted', function () { - assert.strictEqual(yaml.dump('\u0007 escape\\ escaper"'), '"\\a escape\\\\ escaper\\""\n'); - }); + assert.strictEqual(yaml.dump('\u0007 escape\\ escaper"'), '"\\a escape\\\\ escaper\\""\n') + }) it('escape non-printables', function () { - assert.strictEqual(yaml.dump('a\nb\u0001c'), '"a\\nb\\x01c"\n'); - }); - }); + assert.strictEqual(yaml.dump('a\nb\u0001c'), '"a\\nb\\x01c"\n') + }) + }) describe('Literal style', function () { - var content = 'a\nb \n\n c\n d', indented = indent(content); + var content = 'a\nb \n\n c\n d', indented = indent(content) it('preserves trailing newlines using chomping', function () { assert.strictEqual(yaml.dump({ a: '\n', b: '\n\n', c: 'c\n', d: 'd\nd' }), - 'a: |+\n\nb: |+\n\n\nc: |\n c\nd: |-\n d\n d\n'); - assert.strictEqual(yaml.dump('\n'), '|+\n' + '\n'); - assert.strictEqual(yaml.dump('\n\n'), '|+\n' + '\n\n'); + 'a: |+\n\nb: |+\n\n\nc: |\n c\nd: |-\n d\n d\n') + assert.strictEqual(yaml.dump('\n'), '|+\n' + '\n') + assert.strictEqual(yaml.dump('\n\n'), '|+\n' + '\n\n') - assert.strictEqual(yaml.dump(content), '|-\n' + indented + '\n'); - assert.strictEqual(yaml.dump(content + '\n'), '|\n' + indented + '\n'); - assert.strictEqual(yaml.dump(content + '\n\n'), '|+\n' + indented + '\n\n'); - assert.strictEqual(yaml.dump(content + '\n\n\n'), '|+\n' + indented + '\n\n\n'); - }); + assert.strictEqual(yaml.dump(content), '|-\n' + indented + '\n') + assert.strictEqual(yaml.dump(content + '\n'), '|\n' + indented + '\n') + assert.strictEqual(yaml.dump(content + '\n\n'), '|+\n' + indented + '\n\n') + assert.strictEqual(yaml.dump(content + '\n\n\n'), '|+\n' + indented + '\n\n\n') + }) it('accepts leading whitespace', function () { - assert.strictEqual(yaml.dump(' ' + content), '|2-\n ' + indented + '\n'); - }); + assert.strictEqual(yaml.dump(' ' + content), '|2-\n ' + indented + '\n') + }) it('falls back to quoting when required indent indicator is too large', function () { assert.strictEqual(yaml.dump(' these go\nup to\neleven', { indent: 11 }), - '" these go\\nup to\\neleven"\n'); - }); + '" these go\\nup to\\neleven"\n') + }) it('does not use block style for multiline key', function () { assert.strictEqual(yaml.dump({ 'push\nand': { you: 'pull' } - }), '"push\\nand":\n you: pull\n'); - }); - }); + }), '"push\\nand":\n you: pull\n') + }) + }) describe('Folded style', function () { (function () { var content = (function () { - var result = ''; - var i = 1000; + var result = '' + var i = 1000 for (var para = 1; para <= 7; para++) { - result += '\n'; + result += '\n' // indent paragraphs 3 and 4 if (para === 3 || para === 4) { - result += repeat(' ', para); + result += repeat(' ', para) } // vary the number of words on the last line for (var count = 2 * (30 / 5) + para - 1; count > 0; count--) { - result += i + ' '; - if (i % 17 === 0) result += ' '; - i++; + result += i + ' ' + if (i % 17 === 0) result += ' ' + i++ } } - return result; - }()); + return result + }()) var wrapped = '\n' + '1000 1001 1002 1003 1004 1005\n' + '1006 1007 1008 1009 1010 1011 \n' + @@ -148,29 +147,29 @@ describe('Scalar style dump:', function () { '\n' + '1087 1088 1089 1090 1091 1092\n' + '1093 1094 1095 1096 1097 1098\n' + - '1099 1100 1101 1102 1103 1104 '; - var indented = indent(wrapped); + '1099 1100 1101 1102 1103 1104 ' + var indented = indent(wrapped) - function dumpNarrow(s) { - return yaml.dump(s, { lineWidth: 30 + 2 }); + function dumpNarrow (s) { + return yaml.dump(s, { lineWidth: 30 + 2 }) } it('wraps lines and ignores more-indented lines ', function () { - assert.strictEqual(dumpNarrow(content), '>-\n' + indented + '\n'); - }); + assert.strictEqual(dumpNarrow(content), '>-\n' + indented + '\n') + }) it('preserves trailing newlines using chomping', function () { - assert.strictEqual(dumpNarrow(content + '\n'), '>\n' + indented + '\n'); - assert.strictEqual(dumpNarrow(content + '\n\n'), '>+\n' + indented + '\n\n'); - assert.strictEqual(dumpNarrow(content + '\n\n\n'), '>+\n' + indented + '\n\n\n'); - }); - }()); + assert.strictEqual(dumpNarrow(content + '\n'), '>\n' + indented + '\n') + assert.strictEqual(dumpNarrow(content + '\n\n'), '>+\n' + indented + '\n\n') + assert.strictEqual(dumpNarrow(content + '\n\n\n'), '>+\n' + indented + '\n\n\n') + }) + }()) // Dump and check that dump-then-load preserves content (is the identity function). - function dump(input, opts) { - var output = yaml.dump(input, opts); - assert.strictEqual(yaml.load(output), input, 'Dump then load should preserve content'); - return output; + function dump (input, opts) { + var output = yaml.dump(input, opts) + assert.strictEqual(yaml.load(output), input, 'Dump then load should preserve content') + return output } it('should not cut off a long word at the start of a line', function () { @@ -181,12 +180,12 @@ describe('Scalar style dump:', function () { repeat('1234567890', 9) + '\n' + 'hello\n' + '\n' + - 'goodbye\n')); - }); + 'goodbye\n')) + }) it('preserves consecutive spaces', function () { var alphabet = 'a bc def ghi' + repeat(' ', 70) + 'jk lmn o\n' - + ' p qrstu v' + repeat(' ', 80) + '\nw x\n' + 'yz '; + + ' p qrstu v' + repeat(' ', 80) + '\nw x\n' + 'yz ' assert.strictEqual(dump(alphabet), '>-\n' + indent( 'a bc def \n' + @@ -195,53 +194,53 @@ describe('Scalar style dump:', function () { ' p qrstu v' + repeat(' ', 80) + '\n' + 'w x\n' + '\n' + - 'yz \n')); + 'yz \n')) var indeed = repeat('word. ', 31) + '\n' + - [ 2, 3, 5, 7, 11, 13, 17 ] - .map(function (n) { return repeat(' ', n); }) - .join('\n'); + [2, 3, 5, 7, 11, 13, 17] + .map(function (n) { return repeat(' ', n) }) + .join('\n') assert.strictEqual(dump(indeed), '>-\n' + indent( 'word. word. word. word. word. word. word. word. word. word. word. word. word.\n' + 'word. word. word. word. word. word. word. word. word. word. word. word. word.\n' + 'word. word. word. word. word. \n' + - [ 2, 3, 5, 7, 11, 13, 17 ] - .map(function (n) { return repeat(' ', n); }) - .join('\n') + '\n')); - }); + [2, 3, 5, 7, 11, 13, 17] + .map(function (n) { return repeat(' ', n) }) + .join('\n') + '\n')) + }) var story = 'Call me Ishmael. Some years ago—never mind how long precisely—' + 'having little or no money in my purse, ' + 'and nothing particular to interest me on shore, ' - + 'I thought I would sail about a little and see the watery part of the world...'; - var prefix = 'var short_story = "",'; - var line = 'longer_story = "' + story + '";'; + + 'I thought I would sail about a little and see the watery part of the world...' + var prefix = 'var short_story = "",' + var line = 'longer_story = "' + story + '";' it('should fold a long last line missing an ending newline', function () { - var content = [ prefix, line ].join('\n'); + var content = [prefix, line].join('\n') - var lengths = dump(content).split('\n').map(getLength); - assert.deepStrictEqual(lengths, [ 2, 23, 0, 69, 76, 80, 24, 0 ]); - }); + var lengths = dump(content).split('\n').map(getLength) + assert.deepStrictEqual(lengths, [2, 23, 0, 69, 76, 80, 24, 0]) + }) - it('should not fold a more-indented last line', function functionName() { - var content = [ prefix, line, ' ' + line ].join('\n'); + it('should not fold a more-indented last line', function functionName () { + var content = [prefix, line, ' ' + line].join('\n') - var lengths = dump(content).split('\n').map(getLength); - assert.deepStrictEqual(lengths, [ 2, 23, 0, 69, 76, 80, 24, 250, 0 ]); - }); + var lengths = dump(content).split('\n').map(getLength) + assert.deepStrictEqual(lengths, [2, 23, 0, 69, 76, 80, 24, 250, 0]) + }) it('should not fold when lineWidth === -1', function () { - var content = [ prefix, line, line + line, line ].join('\n'); + var content = [prefix, line, line + line, line].join('\n') - assert.strictEqual(dump(content, { lineWidth: -1 }), '|-\n' + indent(content) + '\n'); - }); + assert.strictEqual(dump(content, { lineWidth: -1 }), '|-\n' + indent(content) + '\n') + }) it('falls back to literal style when no lines are foldable', function () { - var content = [ prefix, ' ' + line, ' ' + line ].join('\n'); + var content = [prefix, ' ' + line, ' ' + line].join('\n') - assert.strictEqual(dump(content), '|-\n' + indent(content) + '\n'); - }); - }); -}); + assert.strictEqual(dump(content), '|-\n' + indent(content) + '\n') + }) + }) +}) diff --git a/test/core/units/empty-node-resolving.js b/test/core/units/empty-node-resolving.js index 9bb7e76c..f17d3bc2 100644 --- a/test/core/units/empty-node-resolving.js +++ b/test/core/units/empty-node-resolving.js @@ -1,62 +1,61 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { describe, it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') describe('Resolving explicit tags on empty nodes', function () { it('!!binary', function () { - assert.throws(function () { yaml.load('!!binary'); }, yaml.YAMLException); - }); + assert.throws(function () { yaml.load('!!binary') }, yaml.YAMLException) + }) it('!!bool', function () { - assert.throws(function () { yaml.load('!!bool'); }, yaml.YAMLException); - }); + assert.throws(function () { yaml.load('!!bool') }, yaml.YAMLException) + }) it('!!float', function () { - assert.throws(function () { yaml.load('!!float'); }, yaml.YAMLException); - }); + assert.throws(function () { yaml.load('!!float') }, yaml.YAMLException) + }) it('!!int', function () { - assert.throws(function () { yaml.load('!!int'); }, yaml.YAMLException); - }); + assert.throws(function () { yaml.load('!!int') }, yaml.YAMLException) + }) it('!!map', function () { - assert.deepStrictEqual(yaml.load('!!map'), {}); - }); + assert.deepStrictEqual(yaml.load('!!map'), {}) + }) it('!!merge', function () { - assert.doesNotThrow(function () { yaml.load('? !!merge\n: []'); }); - }); + assert.doesNotThrow(function () { yaml.load('? !!merge\n: []') }) + }) it('!!null', function () { // Fetch null from an array to reduce chance that null is returned because of another bug - assert.strictEqual(yaml.load('- !!null')[0], null); - }); + assert.strictEqual(yaml.load('- !!null')[0], null) + }) it('!!omap', function () { - assert.deepStrictEqual(yaml.load('!!omap'), []); - }); + assert.deepStrictEqual(yaml.load('!!omap'), []) + }) it('!!pairs', function () { - assert.deepStrictEqual(yaml.load('!!pairs'), []); - }); + assert.deepStrictEqual(yaml.load('!!pairs'), []) + }) it('!!seq', function () { - assert.deepStrictEqual(yaml.load('!!seq'), []); - }); + assert.deepStrictEqual(yaml.load('!!seq'), []) + }) it('!!set', function () { - assert.deepStrictEqual(yaml.load('!!set'), {}); - }); + assert.deepStrictEqual(yaml.load('!!set'), {}) + }) it('!!str', function () { - assert.strictEqual(yaml.load('!!str'), ''); - }); + assert.strictEqual(yaml.load('!!str'), '') + }) it('!!timestamp', function () { - assert.throws(function () { yaml.load('!!timestamp'); }, yaml.YAMLException); - }); -}); + assert.throws(function () { yaml.load('!!timestamp') }, yaml.YAMLException) + }) +}) diff --git a/test/core/units/is-negative-zero.js b/test/core/units/is-negative-zero.js index 942a8886..286ee7d6 100644 --- a/test/core/units/is-negative-zero.js +++ b/test/core/units/is-negative-zero.js @@ -1,15 +1,14 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); - -var isNegativeZero = require('../../../lib/common').isNegativeZero; +var assert = require('assert') +var isNegativeZero = require('../../../lib/common').isNegativeZero it('isNegativeZero', function () { - assert(!isNegativeZero(0)); - assert(!isNegativeZero(0.0)); - assert(isNegativeZero(-0)); - assert(isNegativeZero(-0.0)); -}); + assert(!isNegativeZero(0)) + assert(!isNegativeZero(0.0)) + assert(isNegativeZero(-0)) + assert(isNegativeZero(-0.0)) +}) diff --git a/test/core/units/loader-parameters.js b/test/core/units/loader-parameters.js index 7bd2404b..46d7653f 100644 --- a/test/core/units/loader-parameters.js +++ b/test/core/units/loader-parameters.js @@ -1,56 +1,56 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); +const { describe, it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') describe('loader parameters', function () { - var testStr = 'test: 1 \ntest: 2'; - var expected = [ { test: 2 } ]; - var result; + var testStr = 'test: 1 \ntest: 2' + var expected = [{ test: 2 }] + var result it('loadAll(input, options)', function () { - result = yaml.loadAll(testStr, { json: true }); - assert.deepStrictEqual(result, expected); + result = yaml.loadAll(testStr, { json: true }) + assert.deepStrictEqual(result, expected) - result = []; + result = [] yaml.loadAll(testStr, function (doc) { - result.push(doc); - }, { json: true }); - assert.deepStrictEqual(result, expected); - }); + result.push(doc) + }, { json: true }) + assert.deepStrictEqual(result, expected) + }) it('loadAll(input, null, options)', function () { - result = yaml.loadAll(testStr, null, { json: true }); - assert.deepStrictEqual(result, expected); + result = yaml.loadAll(testStr, null, { json: true }) + assert.deepStrictEqual(result, expected) - result = []; + result = [] yaml.loadAll(testStr, function (doc) { - result.push(doc); - }, { json: true }); - assert.deepStrictEqual(result, expected); - }); + result.push(doc) + }, { json: true }) + assert.deepStrictEqual(result, expected) + }) it('loadAll(input, options)', function () { - result = yaml.loadAll(testStr, { json: true }); - assert.deepStrictEqual(result, expected); + result = yaml.loadAll(testStr, { json: true }) + assert.deepStrictEqual(result, expected) - result = []; + result = [] yaml.loadAll(testStr, function (doc) { - result.push(doc); - }, { json: true }); - assert.deepStrictEqual(result, expected); - }); + result.push(doc) + }, { json: true }) + assert.deepStrictEqual(result, expected) + }) it('loadAll(input, null, options)', function () { - result = yaml.loadAll(testStr, null, { json: true }); - assert.deepStrictEqual(result, expected); + result = yaml.loadAll(testStr, null, { json: true }) + assert.deepStrictEqual(result, expected) - result = []; + result = [] yaml.loadAll(testStr, function (doc) { - result.push(doc); - }, { json: true }); - assert.deepStrictEqual(result, expected); - }); -}); + result.push(doc) + }, { json: true }) + assert.deepStrictEqual(result, expected) + }) +}) diff --git a/test/core/units/replacer.js b/test/core/units/replacer.js index 10c2b17f..c4f83e88 100644 --- a/test/core/units/replacer.js +++ b/test/core/units/replacer.js @@ -1,10 +1,9 @@ -'use strict'; +'use strict' -const { describe, it } = require('node:test'); - -const assert = require('assert'); -const yaml = require('js-yaml'); +const { describe, it } = require('node:test') +const assert = require('assert') +const yaml = require('js-yaml') describe('replacer', function () { let undef = new yaml.Type('!undefined', { @@ -13,173 +12,165 @@ describe('replacer', function () { construct: () => {}, predicate: object => typeof object === 'undefined', represent: () => '' - }); - - let undef_schema = yaml.DEFAULT_SCHEMA.extend(undef); + }) + let undef_schema = yaml.DEFAULT_SCHEMA.extend(undef) it('should be called on the root of the document', function () { - let called = 0; + let called = 0 let result = yaml.dump(42, { - replacer(key, value) { - called++; - assert.deepStrictEqual(this, { '': 42 }); - assert.strictEqual(key, ''); - assert.strictEqual(value, 42); - return 123; + replacer (key, value) { + called++ + assert.deepStrictEqual(this, { '': 42 }) + assert.strictEqual(key, '') + assert.strictEqual(value, 42) + return 123 } - }); - assert.strictEqual(result, '123\n'); - assert.strictEqual(called, 1); + }) + assert.strictEqual(result, '123\n') + assert.strictEqual(called, 1) assert.strictEqual(yaml.dump(42, { - replacer(/* key, value */) {} - }), ''); + replacer (/* key, value */) {} + }), '') assert.strictEqual(yaml.dump(42, { - replacer(/* key, value */) { return 'foo'; } - }), 'foo\n'); - }); - + replacer (/* key, value */) { return 'foo' } + }), 'foo\n') + }) it('should be called in collections (block)', function () { - let called = 0; - - let result = yaml.dump([ 42 ], { - replacer(key, value) { - called++; - if (key === '' && called === 1) return value; - assert.deepStrictEqual(this, [ 42 ]); - assert.strictEqual(key, '0'); - assert.strictEqual(value, 42); - return 123; + let called = 0 + + let result = yaml.dump([42], { + replacer (key, value) { + called++ + if (key === '' && called === 1) return value + assert.deepStrictEqual(this, [42]) + assert.strictEqual(key, '0') + assert.strictEqual(value, 42) + return 123 }, flowLevel: -1 - }); - assert.strictEqual(result, '- 123\n'); - assert.strictEqual(called, 2); - }); - + }) + assert.strictEqual(result, '- 123\n') + assert.strictEqual(called, 2) + }) it('should be called in collections (flow)', function () { - let called = 0; - - let result = yaml.dump([ 42 ], { - replacer(key, value) { - called++; - if (key === '' && called === 1) return value; - assert.deepStrictEqual(this, [ 42 ]); - assert.strictEqual(key, '0'); - assert.strictEqual(value, 42); - return 123; + let called = 0 + + let result = yaml.dump([42], { + replacer (key, value) { + called++ + if (key === '' && called === 1) return value + assert.deepStrictEqual(this, [42]) + assert.strictEqual(key, '0') + assert.strictEqual(value, 42) + return 123 }, flowLevel: 0 - }); - assert.strictEqual(result, '[123]\n'); - assert.strictEqual(called, 2); - }); - + }) + assert.strictEqual(result, '[123]\n') + assert.strictEqual(called, 2) + }) it('should be called in mappings (block)', function () { - let called = 0; + let called = 0 let result = yaml.dump({ a: 42 }, { - replacer(key, value) { - called++; - if (key === '' && called === 1) return value; - assert.deepStrictEqual(this, { a: 42 }); - assert.strictEqual(key, 'a'); - assert.strictEqual(value, 42); - return 123; + replacer (key, value) { + called++ + if (key === '' && called === 1) return value + assert.deepStrictEqual(this, { a: 42 }) + assert.strictEqual(key, 'a') + assert.strictEqual(value, 42) + return 123 }, flowLevel: -1 - }); - assert.strictEqual(result, 'a: 123\n'); - assert.strictEqual(called, 2); - }); - + }) + assert.strictEqual(result, 'a: 123\n') + assert.strictEqual(called, 2) + }) it('should be called in mappings (flow)', function () { - let called = 0; + let called = 0 let result = yaml.dump({ a: 42 }, { - replacer(key, value) { - called++; - if (key === '' && called === 1) return value; - assert.deepStrictEqual(this, { a: 42 }); - assert.strictEqual(key, 'a'); - assert.strictEqual(value, 42); - return 123; + replacer (key, value) { + called++ + if (key === '' && called === 1) return value + assert.deepStrictEqual(this, { a: 42 }) + assert.strictEqual(key, 'a') + assert.strictEqual(value, 42) + return 123 }, flowLevel: 0 - }); - assert.strictEqual(result, '{a: 123}\n'); - assert.strictEqual(called, 2); - }); - + }) + assert.strictEqual(result, '{a: 123}\n') + assert.strictEqual(called, 2) + }) it('undefined removes element from a mapping', function () { - let str, result; + let str, result str = yaml.dump({ a: 1, b: 2, c: 3 }, { - replacer(key, value) { - if (key === 'b') return undefined; - return value; + replacer (key, value) { + if (key === 'b') return undefined + return value } - }); - result = yaml.load(str); - assert.deepStrictEqual(result, { a: 1, c: 3 }); + }) + result = yaml.load(str) + assert.deepStrictEqual(result, { a: 1, c: 3 }) str = yaml.dump({ a: 1, b: 2, c: 3 }, { - replacer(key, value) { - if (key === 'b') return undefined; - return value; + replacer (key, value) { + if (key === 'b') return undefined + return value }, schema: undef_schema - }); - result = yaml.load(str, { schema: undef_schema }); - assert.deepStrictEqual(result, { a: 1, b: undefined, c: 3 }); - }); - + }) + result = yaml.load(str, { schema: undef_schema }) + assert.deepStrictEqual(result, { a: 1, b: undefined, c: 3 }) + }) it('undefined replaces element in an array with null', function () { - let str, result; + let str, result - str = yaml.dump([ 1, 2, 3 ], { - replacer(key, value) { - if (key === '1') return undefined; - return value; + str = yaml.dump([1, 2, 3], { + replacer (key, value) { + if (key === '1') return undefined + return value } - }); - result = yaml.load(str); - assert.deepStrictEqual(result, [ 1, null, 3 ]); - - str = yaml.dump([ 1, 2, 3 ], { - replacer(key, value) { - if (key === '1') return undefined; - return value; + }) + result = yaml.load(str) + assert.deepStrictEqual(result, [1, null, 3]) + + str = yaml.dump([1, 2, 3], { + replacer (key, value) { + if (key === '1') return undefined + return value }, schema: undef_schema - }); - result = yaml.load(str, { schema: undef_schema }); - assert.deepStrictEqual(result, [ 1, undefined, 3 ]); - }); - + }) + result = yaml.load(str, { schema: undef_schema }) + assert.deepStrictEqual(result, [1, undefined, 3]) + }) it('should recursively call replacer', function () { - let count = 0; + let count = 0 let result = yaml.dump(42, { - replacer(key, value) { - return count++ > 3 ? value : { ['lvl' + count]: value }; + replacer (key, value) { + return count++ > 3 ? value : { ['lvl' + count]: value } } - }); + }) assert.strictEqual(result, ` lvl1: lvl2: lvl3: lvl4: 42 -`.replace(/^\n/, '')); - }); -}); +`.replace(/^\n/, '')) + }) +}) diff --git a/test/core/units/single-document-error.js b/test/core/units/single-document-error.js index 477a9c2a..2c94ada3 100644 --- a/test/core/units/single-document-error.js +++ b/test/core/units/single-document-error.js @@ -1,21 +1,20 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') it('Loading multidocument source using `load` should cause an error', function () { assert.throws(function () { - yaml.load('--- # first document\n--- # second document\n'); - }, yaml.YAMLException); + yaml.load('--- # first document\n--- # second document\n') + }, yaml.YAMLException) assert.throws(function () { - yaml.load('---\nfoo: bar\n---\nfoo: bar\n'); - }, yaml.YAMLException); + yaml.load('---\nfoo: bar\n---\nfoo: bar\n') + }, yaml.YAMLException) assert.throws(function () { - yaml.load('foo: bar\n---\nfoo: bar\n'); - }, yaml.YAMLException); -}); + yaml.load('foo: bar\n---\nfoo: bar\n') + }, yaml.YAMLException) +}) diff --git a/test/core/units/skip-invalid.js b/test/core/units/skip-invalid.js index aabe4773..4c16e1e6 100644 --- a/test/core/units/skip-invalid.js +++ b/test/core/units/skip-invalid.js @@ -1,34 +1,30 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var yaml = require('js-yaml'); +const { it } = require('node:test') +var assert = require('assert') +var yaml = require('js-yaml') var sample = { number: 42, string: 'hello', - func: function (a, b) { return a + b; }, + func: function (a, b) { return a + b }, regexp: /^hel+o/, - array: [ 1, 2, 3 ] -}; - + array: [1, 2, 3] +} var expected = { number: 42, string: 'hello', - array: [ 1, 2, 3 ] -}; - + array: [1, 2, 3] +} it('Dumper must throw an exception on invalid type when option `skipInvalid` is false.', function () { assert.throws(function () { - yaml.dump(sample, { skipInvalid: false }); - }, yaml.YAMLException); -}); - + yaml.dump(sample, { skipInvalid: false }) + }, yaml.YAMLException) +}) it('Dumper must skip pairs and values with invalid types when option `skipInvalid` is true.', function () { - assert.deepStrictEqual(yaml.load(yaml.dump(sample, { skipInvalid: true })), expected); -}); + assert.deepStrictEqual(yaml.load(yaml.dump(sample, { skipInvalid: true })), expected) +}) diff --git a/test/core/units/snippet.js b/test/core/units/snippet.js index 112d92e2..524b91ff 100644 --- a/test/core/units/snippet.js +++ b/test/core/units/snippet.js @@ -1,34 +1,33 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); - -var assert = require('assert'); -var path = require('path'); -var fs = require('fs'); -var snippet = require('../../../lib/snippet'); +const { it } = require('node:test') +var assert = require('assert') +var path = require('path') +var fs = require('fs') +var snippet = require('../../../lib/snippet') it('Snippet', function () { let filepath = path.join(__dirname, 'snippet.txt'), - filedata = fs.readFileSync(filepath, 'utf8'); + filedata = fs.readFileSync(filepath, 'utf8') - let data = filedata.split(/(---[ \d]*\n)/).slice(1); + let data = filedata.split(/(---[ \d]*\n)/).slice(1) for (let i = 0; i < data.length; i += 4) { let index = 0, line = 0, column = 0, input = data[i + 1], expected = data[i + 3].replace(/\n$/, ''), - mark, code; + mark, code - assert(input.indexOf('*') >= 0); + assert(input.indexOf('*') >= 0) while (input[index] !== '*') { if (input[index] === '\n') { - line += 1; - column = 0; + line += 1 + column = 0 } else { - column += 1; + column += 1 } - index += 1; + index += 1 } mark = { @@ -37,15 +36,15 @@ it('Snippet', function () { position: index, line: line, column: column - }; + } code = snippet(mark, { indent: 1, maxLength: 78, linesBefore: 3, linesAfter: 2 - }); + }) - assert.strictEqual(code, expected); + assert.strictEqual(code, expected) } -}); +}) diff --git a/test/core/units/sort-keys.js b/test/core/units/sort-keys.js index 25d712c8..cad235da 100644 --- a/test/core/units/sort-keys.js +++ b/test/core/units/sort-keys.js @@ -1,27 +1,27 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') -var sample = { b: 1, a: 2, c: 3 }; -var unsortedExpected = 'b: 1\na: 2\nc: 3\n'; -var simpleExpected = 'a: 2\nb: 1\nc: 3\n'; -var reverseExpected = 'c: 3\nb: 1\na: 2\n'; +var sample = { b: 1, a: 2, c: 3 } +var unsortedExpected = 'b: 1\na: 2\nc: 3\n' +var simpleExpected = 'a: 2\nb: 1\nc: 3\n' +var reverseExpected = 'c: 3\nb: 1\na: 2\n' it('Dumper should sort preserve key insertion order', function () { - assert.deepStrictEqual(yaml.dump(sample, { sortKeys: false }), unsortedExpected); -}); + assert.deepStrictEqual(yaml.dump(sample, { sortKeys: false }), unsortedExpected) +}) it('Dumper should sort keys when sortKeys is true', function () { - assert.deepStrictEqual(yaml.dump(sample, { sortKeys: true }), simpleExpected); -}); + assert.deepStrictEqual(yaml.dump(sample, { sortKeys: true }), simpleExpected) +}) it('Dumper should sort keys by sortKeys function when specified', function () { assert.deepStrictEqual(yaml.dump(sample, { sortKeys: function (a, b) { - return a < b ? 1 : a > b ? -1 : 0; + return a < b ? 1 : a > b ? -1 : 0 } - }), reverseExpected); -}); + }), reverseExpected) +}) diff --git a/test/core/units/tagmultikind.js b/test/core/units/tagmultikind.js index 35b89ddb..4ddabfbc 100644 --- a/test/core/units/tagmultikind.js +++ b/test/core/units/tagmultikind.js @@ -1,40 +1,38 @@ -'use strict'; +'use strict' -const { it } = require('node:test'); +const { it } = require('node:test') -var assert = require('assert'); -var yaml = require('js-yaml'); +var assert = require('assert') +var yaml = require('js-yaml') -var tags = [ { +var tags = [{ tag: 'Include', type: 'scalar' }, { tag: 'Include', type: 'mapping' -} ].map(function (fn) { +}].map(function (fn) { return new yaml.Type('!' + fn.tag, { kind: fn.type, resolve: function () { - return true; + return true }, construct: function (obj) { - return obj; + return obj } - }); -}); - -var schema = yaml.DEFAULT_SCHEMA.extend(tags); + }) +}) +var schema = yaml.DEFAULT_SCHEMA.extend(tags) it('Process tag with kind: scalar', function () { assert.deepStrictEqual(yaml.load('!Include foobar', { schema: schema - }), 'foobar'); -}); - + }), 'foobar') +}) it('Process tag with kind: mapping', function () { assert.deepStrictEqual(yaml.load('!Include\n location: foobar', { schema: schema - }), { location: 'foobar' }); -}); + }), { location: 'foobar' }) +}) From b66ae71eb58c5436b57a5515a87e18c3f734bc35 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 14:25:34 +0300 Subject: [PATCH 17/23] CS: no-multi-spaces --- bin/js-yaml.js | 4 +- eslint.config.mjs | 1 - examples/custom_types.js | 18 +-- examples/sample_document.js | 4 +- index.js | 26 ++-- lib/common.js | 10 +- lib/dumper.js | 138 ++++++++++---------- lib/loader.js | 116 ++++++++-------- lib/schema.js | 4 +- lib/snippet.js | 4 +- lib/type.js | 22 ++-- lib/type/binary.js | 2 +- lib/type/float.js | 6 +- lib/type/int.js | 10 +- lib/type/null.js | 4 +- lib/type/omap.js | 2 +- lib/type/timestamp.js | 20 +-- test/build/dist.test.js | 6 +- test/core/00-units.test.js | 2 +- test/core/10-loader.test.js | 8 +- test/core/11-load-errors.test.js | 6 +- test/core/20-dumper.test.js | 12 +- test/core/25-dumper-fuzzy.test.js | 4 +- test/core/30-issues.test.js | 2 +- test/core/issues/0063.js | 2 +- test/core/issues/0068.js | 4 +- test/core/issues/0085.js | 2 +- test/core/issues/0092.js | 2 +- test/core/issues/0093.js | 4 +- test/core/issues/0095.js | 14 +- test/core/issues/0108.js | 6 +- test/core/issues/0110.js | 2 +- test/core/issues/0112.js | 10 +- test/core/issues/0117.js | 2 +- test/core/issues/0144.js | 2 +- test/core/issues/0154.js | 2 +- test/core/issues/0155.js | 2 +- test/core/issues/0156.js | 2 +- test/core/issues/0205.js | 2 +- test/core/issues/0243.js | 2 +- test/core/issues/0266.js | 2 +- test/core/issues/0303.js | 2 +- test/core/issues/0321.js | 2 +- test/core/issues/0332.js | 2 +- test/core/issues/0418.js | 2 +- test/core/issues/0475.js | 2 +- test/core/issues/0519.js | 2 +- test/core/issues/0525-1.js | 2 +- test/core/issues/0525-2.js | 2 +- test/core/issues/0571.js | 2 +- test/core/issues/0576.js | 4 +- test/core/issues/0586.js | 2 +- test/core/issues/0587.js | 2 +- test/core/issues/0614.js | 2 +- test/core/samples-common/construct-float.js | 6 +- test/core/samples-common/construct-omap.js | 4 +- test/core/support/schema.js | 2 +- test/core/units/alias-nodes.js | 2 +- test/core/units/bom-strip.js | 2 +- test/core/units/dump-scalar-styles.js | 18 +-- test/core/units/empty-node-resolving.js | 2 +- test/core/units/loader-parameters.js | 2 +- test/core/units/single-document-error.js | 2 +- test/core/units/skip-invalid.js | 2 +- test/core/units/snippet.js | 6 +- test/core/units/sort-keys.js | 2 +- 66 files changed, 285 insertions(+), 286 deletions(-) diff --git a/bin/js-yaml.js b/bin/js-yaml.js index 71a567fa..2ad37a41 100755 --- a/bin/js-yaml.js +++ b/bin/js-yaml.js @@ -2,9 +2,9 @@ 'use strict' -var fs = require('fs') +var fs = require('fs') var argparse = require('argparse') -var yaml = require('..') +var yaml = require('..') /// ///////////////////////////////////////////////////////////////////////////// diff --git a/eslint.config.mjs b/eslint.config.mjs index 0c98367b..31cb17a3 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -14,7 +14,6 @@ export default [ rules: { camelcase: 'off', 'no-var': 'off', - '@stylistic/no-multi-spaces': 'off', '@stylistic/indent': 'off', '@stylistic/operator-linebreak': 'off', 'one-var': 'off', diff --git a/examples/custom_types.js b/examples/custom_types.js index 87ec74fb..a497bb21 100644 --- a/examples/custom_types.js +++ b/examples/custom_types.js @@ -1,6 +1,6 @@ 'use strict' -var fs = require('fs') +var fs = require('fs') var path = require('path') var util = require('util') var yaml = require('../') @@ -9,9 +9,9 @@ var yaml = require('../') function Point (x, y, z) { this.klass = 'Point' - this.x = x - this.y = y - this.z = z + this.x = x + this.y = y + this.z = z } function Space (height, width, points) { @@ -21,9 +21,9 @@ function Space (height, width, points) { } } - this.klass = 'Space' + this.klass = 'Space' this.height = height - this.width = width + this.width = width this.points = points } @@ -88,8 +88,8 @@ if (require.main === module) { } // There are some exports to play with this example interactively. -module.exports.Point = Point -module.exports.Space = Space +module.exports.Point = Point +module.exports.Space = Space module.exports.PointYamlType = PointYamlType module.exports.SpaceYamlType = SpaceYamlType -module.exports.SPACE_SCHEMA = SPACE_SCHEMA +module.exports.SPACE_SCHEMA = SPACE_SCHEMA diff --git a/examples/sample_document.js b/examples/sample_document.js index 27984a0e..c3593bb8 100644 --- a/examples/sample_document.js +++ b/examples/sample_document.js @@ -1,6 +1,6 @@ 'use strict' -var fs = require('fs') +var fs = require('fs') var path = require('path') var util = require('util') var yaml = require('../') @@ -8,7 +8,7 @@ var yaml = require('../') try { var filename = path.join(__dirname, 'sample_document.yml'), contents = fs.readFileSync(filename, 'utf8'), - data = yaml.load(contents) + data = yaml.load(contents) console.log(util.inspect(data, false, 10, true)) } catch (err) { diff --git a/index.js b/index.js index 23eed6de..db5c29fa 100644 --- a/index.js +++ b/index.js @@ -10,16 +10,16 @@ function renamed (from, to) { } } -module.exports.Type = require('./lib/type') -module.exports.Schema = require('./lib/schema') -module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe') -module.exports.JSON_SCHEMA = require('./lib/schema/json') -module.exports.CORE_SCHEMA = require('./lib/schema/core') -module.exports.DEFAULT_SCHEMA = require('./lib/schema/default') -module.exports.load = loader.load -module.exports.loadAll = loader.loadAll -module.exports.dump = dumper.dump -module.exports.YAMLException = require('./lib/exception') +module.exports.Type = require('./lib/type') +module.exports.Schema = require('./lib/schema') +module.exports.FAILSAFE_SCHEMA = require('./lib/schema/failsafe') +module.exports.JSON_SCHEMA = require('./lib/schema/json') +module.exports.CORE_SCHEMA = require('./lib/schema/core') +module.exports.DEFAULT_SCHEMA = require('./lib/schema/default') +module.exports.load = loader.load +module.exports.loadAll = loader.loadAll +module.exports.dump = dumper.dump +module.exports.YAMLException = require('./lib/exception') // Re-export all types in case user wants to create custom schema module.exports.types = { @@ -39,6 +39,6 @@ module.exports.types = { } // Removed functions from JS-YAML 3.0.x -module.exports.safeLoad = renamed('safeLoad', 'load') -module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll') -module.exports.safeDump = renamed('safeDump', 'dump') +module.exports.safeLoad = renamed('safeLoad', 'load') +module.exports.safeLoadAll = renamed('safeLoadAll', 'loadAll') +module.exports.safeDump = renamed('safeDump', 'dump') diff --git a/lib/common.js b/lib/common.js index f360c775..335970e1 100644 --- a/lib/common.js +++ b/lib/common.js @@ -44,9 +44,9 @@ function isNegativeZero (number) { return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number) } -module.exports.isNothing = isNothing -module.exports.isObject = isObject -module.exports.toArray = toArray -module.exports.repeat = repeat +module.exports.isNothing = isNothing +module.exports.isObject = isObject +module.exports.toArray = toArray +module.exports.repeat = repeat module.exports.isNegativeZero = isNegativeZero -module.exports.extend = extend +module.exports.extend = extend diff --git a/lib/dumper.js b/lib/dumper.js index 25c27f06..b5212924 100644 --- a/lib/dumper.js +++ b/lib/dumper.js @@ -1,53 +1,53 @@ 'use strict' -var common = require('./common') -var YAMLException = require('./exception') -var DEFAULT_SCHEMA = require('./schema/default') +var common = require('./common') +var YAMLException = require('./exception') +var DEFAULT_SCHEMA = require('./schema/default') -var _toString = Object.prototype.toString +var _toString = Object.prototype.toString var _hasOwnProperty = Object.prototype.hasOwnProperty -var CHAR_BOM = 0xFEFF -var CHAR_TAB = 0x09 /* Tab */ -var CHAR_LINE_FEED = 0x0A /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D /* CR */ -var CHAR_SPACE = 0x20 /* Space */ -var CHAR_EXCLAMATION = 0x21 /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22 /* " */ -var CHAR_SHARP = 0x23 /* # */ -var CHAR_PERCENT = 0x25 /* % */ -var CHAR_AMPERSAND = 0x26 /* & */ -var CHAR_SINGLE_QUOTE = 0x27 /* ' */ -var CHAR_ASTERISK = 0x2A /* * */ -var CHAR_COMMA = 0x2C /* , */ -var CHAR_MINUS = 0x2D /* - */ -var CHAR_COLON = 0x3A /* : */ -var CHAR_EQUALS = 0x3D /* = */ -var CHAR_GREATER_THAN = 0x3E /* > */ -var CHAR_QUESTION = 0x3F /* ? */ -var CHAR_COMMERCIAL_AT = 0x40 /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B /* [ */ +var CHAR_BOM = 0xFEFF +var CHAR_TAB = 0x09 /* Tab */ +var CHAR_LINE_FEED = 0x0A /* LF */ +var CHAR_CARRIAGE_RETURN = 0x0D /* CR */ +var CHAR_SPACE = 0x20 /* Space */ +var CHAR_EXCLAMATION = 0x21 /* ! */ +var CHAR_DOUBLE_QUOTE = 0x22 /* " */ +var CHAR_SHARP = 0x23 /* # */ +var CHAR_PERCENT = 0x25 /* % */ +var CHAR_AMPERSAND = 0x26 /* & */ +var CHAR_SINGLE_QUOTE = 0x27 /* ' */ +var CHAR_ASTERISK = 0x2A /* * */ +var CHAR_COMMA = 0x2C /* , */ +var CHAR_MINUS = 0x2D /* - */ +var CHAR_COLON = 0x3A /* : */ +var CHAR_EQUALS = 0x3D /* = */ +var CHAR_GREATER_THAN = 0x3E /* > */ +var CHAR_QUESTION = 0x3F /* ? */ +var CHAR_COMMERCIAL_AT = 0x40 /* @ */ +var CHAR_LEFT_SQUARE_BRACKET = 0x5B /* [ */ var CHAR_RIGHT_SQUARE_BRACKET = 0x5D /* ] */ -var CHAR_GRAVE_ACCENT = 0x60 /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B /* { */ -var CHAR_VERTICAL_LINE = 0x7C /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D /* } */ +var CHAR_GRAVE_ACCENT = 0x60 /* ` */ +var CHAR_LEFT_CURLY_BRACKET = 0x7B /* { */ +var CHAR_VERTICAL_LINE = 0x7C /* | */ +var CHAR_RIGHT_CURLY_BRACKET = 0x7D /* } */ var ESCAPE_SEQUENCES = {} -ESCAPE_SEQUENCES[0x00] = '\\0' -ESCAPE_SEQUENCES[0x07] = '\\a' -ESCAPE_SEQUENCES[0x08] = '\\b' -ESCAPE_SEQUENCES[0x09] = '\\t' -ESCAPE_SEQUENCES[0x0A] = '\\n' -ESCAPE_SEQUENCES[0x0B] = '\\v' -ESCAPE_SEQUENCES[0x0C] = '\\f' -ESCAPE_SEQUENCES[0x0D] = '\\r' -ESCAPE_SEQUENCES[0x1B] = '\\e' -ESCAPE_SEQUENCES[0x22] = '\\"' -ESCAPE_SEQUENCES[0x5C] = '\\\\' -ESCAPE_SEQUENCES[0x85] = '\\N' -ESCAPE_SEQUENCES[0xA0] = '\\_' +ESCAPE_SEQUENCES[0x00] = '\\0' +ESCAPE_SEQUENCES[0x07] = '\\a' +ESCAPE_SEQUENCES[0x08] = '\\b' +ESCAPE_SEQUENCES[0x09] = '\\t' +ESCAPE_SEQUENCES[0x0A] = '\\n' +ESCAPE_SEQUENCES[0x0B] = '\\v' +ESCAPE_SEQUENCES[0x0C] = '\\f' +ESCAPE_SEQUENCES[0x0D] = '\\r' +ESCAPE_SEQUENCES[0x1B] = '\\e' +ESCAPE_SEQUENCES[0x22] = '\\"' +ESCAPE_SEQUENCES[0x5C] = '\\\\' +ESCAPE_SEQUENCES[0x85] = '\\N' +ESCAPE_SEQUENCES[0xA0] = '\\_' ESCAPE_SEQUENCES[0x2028] = '\\L' ESCAPE_SEQUENCES[0x2029] = '\\P' @@ -110,20 +110,20 @@ var QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2 function State (options) { - this.schema = options['schema'] || DEFAULT_SCHEMA - this.indent = Math.max(1, (options['indent'] || 2)) + this.schema = options['schema'] || DEFAULT_SCHEMA + this.indent = Math.max(1, (options['indent'] || 2)) this.noArrayIndent = options['noArrayIndent'] || false - this.skipInvalid = options['skipInvalid'] || false - this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']) - this.styleMap = compileStyleMap(this.schema, options['styles'] || null) - this.sortKeys = options['sortKeys'] || false - this.lineWidth = options['lineWidth'] || 80 - this.noRefs = options['noRefs'] || false - this.noCompatMode = options['noCompatMode'] || false - this.condenseFlow = options['condenseFlow'] || false - this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE - this.forceQuotes = options['forceQuotes'] || false - this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null + this.skipInvalid = options['skipInvalid'] || false + this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']) + this.styleMap = compileStyleMap(this.schema, options['styles'] || null) + this.sortKeys = options['sortKeys'] || false + this.lineWidth = options['lineWidth'] || 80 + this.noRefs = options['noRefs'] || false + this.noCompatMode = options['noCompatMode'] || false + this.condenseFlow = options['condenseFlow'] || false + this.quotingType = options['quotingType'] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE + this.forceQuotes = options['forceQuotes'] || false + this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null this.implicitTypes = this.schema.compiledImplicit this.explicitTypes = this.schema.compiledExplicit @@ -190,10 +190,10 @@ function isWhitespace (c) { // should also be escaped. [However,] This isn’t mandatory" // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. function isPrintable (c) { - return (0x00020 <= c && c <= 0x00007E) + return (0x00020 <= c && c <= 0x00007E) || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) - || (0x10000 <= c && c <= 0x10FFFF) + || (0x10000 <= c && c <= 0x10FFFF) } // [34] ns-char ::= nb-char - s-white @@ -298,11 +298,11 @@ function needIndentIndicator (string) { return leadingSpaceRe.test(string) } -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, +var STYLE_PLAIN = 1, + STYLE_SINGLE = 2, STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5 + STYLE_FOLDED = 4, + STYLE_DOUBLE = 5 // Determines which scalar styles are possible and returns the preferred style. // lineWidth = -1 => no limit. @@ -443,7 +443,7 @@ function blockHeader (string, indentPerLevel) { var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '' // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n' + var clip = string[string.length - 1] === '\n' var keep = clip && (string[string.length - 2] === '\n' || string === '\n') var chomp = keep ? '+' : (clip ? '' : '-') @@ -556,7 +556,7 @@ function escapeString (string) { function writeFlowSequence (state, level, object) { var _result = '', - _tag = state.tag, + _tag = state.tag, index, length, value @@ -583,7 +583,7 @@ function writeFlowSequence (state, level, object) { function writeBlockSequence (state, level, object, compact) { var _result = '', - _tag = state.tag, + _tag = state.tag, index, length, value @@ -618,8 +618,8 @@ function writeBlockSequence (state, level, object, compact) { } function writeFlowMapping (state, level, object) { - var _result = '', - _tag = state.tag, + var _result = '', + _tag = state.tag, objectKeyList = Object.keys(object), index, length, @@ -663,8 +663,8 @@ function writeFlowMapping (state, level, object) { } function writeBlockMapping (state, level, object, compact) { - var _result = '', - _tag = state.tag, + var _result = '', + _tag = state.tag, objectKeyList = Object.keys(object), index, length, @@ -748,9 +748,9 @@ function detectType (state, object, explicit) { for (index = 0, length = typeList.length; index < length; index += 1) { type = typeList[index] - if ((type.instanceOf || type.predicate) && + if ((type.instanceOf || type.predicate) && (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && - (!type.predicate || type.predicate(object))) { + (!type.predicate || type.predicate(object))) { if (explicit) { if (type.multi && type.representName) { state.tag = type.representName(object) diff --git a/lib/loader.js b/lib/loader.js index aff5ba4d..b7c25a46 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -1,26 +1,26 @@ 'use strict' -var common = require('./common') -var YAMLException = require('./exception') -var makeSnippet = require('./snippet') -var DEFAULT_SCHEMA = require('./schema/default') +var common = require('./common') +var YAMLException = require('./exception') +var makeSnippet = require('./snippet') +var DEFAULT_SCHEMA = require('./schema/default') var _hasOwnProperty = Object.prototype.hasOwnProperty -var CONTEXT_FLOW_IN = 1 -var CONTEXT_FLOW_OUT = 2 -var CONTEXT_BLOCK_IN = 3 +var CONTEXT_FLOW_IN = 1 +var CONTEXT_FLOW_OUT = 2 +var CONTEXT_BLOCK_IN = 3 var CONTEXT_BLOCK_OUT = 4 -var CHOMPING_CLIP = 1 +var CHOMPING_CLIP = 1 var CHOMPING_STRIP = 2 -var CHOMPING_KEEP = 3 +var CHOMPING_KEEP = 3 -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/ +var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/ -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/ -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i +var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/ +var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i +var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i function _class (obj) { return Object.prototype.toString.call(obj) } @@ -137,23 +137,23 @@ for (var i = 0; i < 256; i++) { function State (input, options) { this.input = input - this.filename = options['filename'] || null - this.schema = options['schema'] || DEFAULT_SCHEMA + this.filename = options['filename'] || null + this.schema = options['schema'] || DEFAULT_SCHEMA this.onWarning = options['onWarning'] || null // (Hidden) Remove? makes the loader to expect YAML 1.1 documents // if such documents have no explicit %YAML directive - this.legacy = options['legacy'] || false + this.legacy = options['legacy'] || false - this.json = options['json'] || false - this.listener = options['listener'] || null + this.json = options['json'] || false + this.listener = options['listener'] || null this.implicitTypes = this.schema.compiledImplicit - this.typeMap = this.schema.compiledTypeMap + this.typeMap = this.schema.compiledTypeMap - this.length = input.length - this.position = 0 - this.line = 0 - this.lineStart = 0 + this.length = input.length + this.position = 0 + this.line = 0 + this.lineStart = 0 this.lineIndent = 0 // position of first leading tab in the current line, @@ -471,18 +471,18 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { ch = state.input.charCodeAt(state.position) - if (is_WS_OR_EOL(ch) || + if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || - ch === 0x23/* # */ || - ch === 0x26/* & */ || - ch === 0x2A/* * */ || - ch === 0x21/* ! */ || - ch === 0x7C/* | */ || - ch === 0x3E/* > */ || - ch === 0x27/* ' */ || - ch === 0x22/* " */ || - ch === 0x25/* % */ || - ch === 0x40/* @ */ || + ch === 0x23/* # */ || + ch === 0x26/* & */ || + ch === 0x2A/* * */ || + ch === 0x21/* ! */ || + ch === 0x7C/* | */ || + ch === 0x3E/* > */ || + ch === 0x27/* ' */ || + ch === 0x22/* " */ || + ch === 0x25/* % */ || + ch === 0x40/* @ */ || ch === 0x60/* ` */) { return false } @@ -681,9 +681,9 @@ function readFlowCollection (state, nodeIndent) { _line, _lineStart, _pos, - _tag = state.tag, + _tag = state.tag, _result, - _anchor = state.anchor, + _anchor = state.anchor, following, terminator, isPair, @@ -791,11 +791,11 @@ function readFlowCollection (state, nodeIndent) { function readBlockScalar (state, nodeIndent) { var captureStart, folding, - chomping = CHOMPING_CLIP, + chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, + textIndent = nodeIndent, + emptyLines = 0, atMoreIndented = false, tmp, ch @@ -929,11 +929,11 @@ function readBlockScalar (state, nodeIndent) { function readBlockSequence (state, nodeIndent) { var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], + _tag = state.tag, + _anchor = state.anchor, + _result = [], following, - detected = false, + detected = false, ch // there is a leading tab before this token, so it can't be a block sequence/mapping; @@ -1004,15 +1004,15 @@ function readBlockMapping (state, nodeIndent, flowIndent) { _keyLine, _keyLineStart, _keyPos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, + _tag = state.tag, + _anchor = state.anchor, + _result = {}, overridableKeys = Object.create(null), - keyTag = null, - keyNode = null, - valueNode = null, + keyTag = null, + keyNode = null, + valueNode = null, atExplicitKey = false, - detected = false, + detected = false, ch // there is a leading tab before this token, so it can't be a block sequence/mapping; @@ -1170,7 +1170,7 @@ function readBlockMapping (state, nodeIndent, flowIndent) { function readTagProperty (state) { var _position, isVerbatim = false, - isNamed = false, + isNamed = false, tagHandle, tagName, ch @@ -1322,7 +1322,7 @@ function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompac allowBlockScalars, allowBlockCollections, indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this= 0) { value = value.slice(1) diff --git a/lib/type/int.js b/lib/type/int.js index 06e94050..008b14bd 100644 --- a/lib/type/int.js +++ b/lib/type/int.js @@ -1,7 +1,7 @@ 'use strict' var common = require('../common') -var Type = require('../type') +var Type = require('../type') function isHexCode (c) { return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || @@ -139,14 +139,14 @@ module.exports = new Type('tag:yaml.org,2002:int', { predicate: isInteger, represent: { binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1) }, - octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1) }, + octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1) }, decimal: function (obj) { return obj.toString(10) }, - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1) } + hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1) } }, defaultStyle: 'decimal', styleAliases: { - binary: [2, 'bin'], - octal: [8, 'oct'], + binary: [2, 'bin'], + octal: [8, 'oct'], decimal: [10, 'dec'], hexadecimal: [16, 'hex'] } diff --git a/lib/type/null.js b/lib/type/null.js index 72b524c5..b3cff868 100644 --- a/lib/type/null.js +++ b/lib/type/null.js @@ -25,11 +25,11 @@ module.exports = new Type('tag:yaml.org,2002:null', { construct: constructYamlNull, predicate: isNull, represent: { - canonical: function () { return '~' }, + canonical: function () { return '~' }, lowercase: function () { return 'null' }, uppercase: function () { return 'NULL' }, camelcase: function () { return 'Null' }, - empty: function () { return '' } + empty: function () { return '' } }, defaultStyle: 'lowercase' }) diff --git a/lib/type/omap.js b/lib/type/omap.js index 6b56af45..514c2a03 100644 --- a/lib/type/omap.js +++ b/lib/type/omap.js @@ -3,7 +3,7 @@ var Type = require('../type') var _hasOwnProperty = Object.prototype.hasOwnProperty -var _toString = Object.prototype.toString +var _toString = Object.prototype.toString function resolveYamlOmap (data) { if (data === null) return true diff --git a/lib/type/timestamp.js b/lib/type/timestamp.js index 75ca0705..f109f4b9 100644 --- a/lib/type/timestamp.js +++ b/lib/type/timestamp.js @@ -3,19 +3,19 @@ var Type = require('../type') var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9])' + // [2] month '-([0-9][0-9])$') // [3] day var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction + '^([0-9][0-9][0-9][0-9])' + // [1] year + '-([0-9][0-9]?)' + // [2] month + '-([0-9][0-9]?)' + // [3] day + '(?:[Tt]|[ \\t]+)' + // ... + '([0-9][0-9]?)' + // [4] hour + ':([0-9][0-9])' + // [5] minute + ':([0-9][0-9])' + // [6] second + '(?:\\.([0-9]*))?' + // [7] fraction '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour '(?::([0-9][0-9]))?))?$') // [11] tz_minute diff --git a/test/build/dist.test.js b/test/build/dist.test.js index 40d1238e..14a4076e 100644 --- a/test/build/dist.test.js +++ b/test/build/dist.test.js @@ -3,9 +3,9 @@ const { describe, it } = require('node:test') const assert = require('assert') -const fs = require('fs') -const path = require('path') -const vm = require('vm') +const fs = require('fs') +const path = require('path') +const vm = require('vm') const distDir = path.resolve(__dirname, '../../dist') diff --git a/test/core/00-units.test.js b/test/core/00-units.test.js index a4590f2e..3e8ec88f 100644 --- a/test/core/00-units.test.js +++ b/test/core/00-units.test.js @@ -3,7 +3,7 @@ const { describe } = require('node:test') var path = require('path') -var fs = require('fs') +var fs = require('fs') describe('Units', function () { var directory = path.resolve(__dirname, 'units') diff --git a/test/core/10-loader.test.js b/test/core/10-loader.test.js index 529b00ca..83928d5e 100644 --- a/test/core/10-loader.test.js +++ b/test/core/10-loader.test.js @@ -3,9 +3,9 @@ const { describe, it } = require('node:test') var assert = require('assert') -var path = require('path') -var fs = require('fs') -var yaml = require('js-yaml') +var path = require('path') +var fs = require('fs') +var yaml = require('js-yaml') var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA @@ -19,7 +19,7 @@ describe('Loader', function () { it(path.basename(jsFile, '.js'), function () { var expected = require(path.resolve(samplesDir, jsFile)) - var actual = [] + var actual = [] yaml.loadAll(fs.readFileSync(yamlFile, { encoding: 'utf8' }), function (doc) { actual.push(doc) }, { filename: yamlFile, diff --git a/test/core/11-load-errors.test.js b/test/core/11-load-errors.test.js index 1034e955..7afb533f 100644 --- a/test/core/11-load-errors.test.js +++ b/test/core/11-load-errors.test.js @@ -3,9 +3,9 @@ const { describe, it } = require('node:test') var assert = require('assert') -var path = require('path') -var fs = require('fs') -var yaml = require('js-yaml') +var path = require('path') +var fs = require('fs') +var yaml = require('js-yaml') var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA diff --git a/test/core/20-dumper.test.js b/test/core/20-dumper.test.js index 55c0a27e..dc88b4ab 100644 --- a/test/core/20-dumper.test.js +++ b/test/core/20-dumper.test.js @@ -3,9 +3,9 @@ const { describe, it } = require('node:test') var assert = require('assert') -var path = require('path') -var fs = require('fs') -var yaml = require('js-yaml') +var path = require('path') +var fs = require('fs') +var yaml = require('js-yaml') var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA @@ -16,9 +16,9 @@ describe('Dumper', function () { if (path.extname(jsFile) !== '.js') return // continue it(path.basename(jsFile, '.js'), function () { - var sample = require(path.resolve(samplesDir, jsFile)) - var data = typeof sample === 'function' ? sample.expected : sample, - serialized = yaml.dump(data, { schema: TEST_SCHEMA }), + var sample = require(path.resolve(samplesDir, jsFile)) + var data = typeof sample === 'function' ? sample.expected : sample, + serialized = yaml.dump(data, { schema: TEST_SCHEMA }), deserialized = yaml.load(serialized, { schema: TEST_SCHEMA }) if (typeof sample === 'function') { diff --git a/test/core/25-dumper-fuzzy.test.js b/test/core/25-dumper-fuzzy.test.js index 307d5205..0d22f6f7 100644 --- a/test/core/25-dumper-fuzzy.test.js +++ b/test/core/25-dumper-fuzzy.test.js @@ -3,8 +3,8 @@ const { describe, it } = require('node:test') var assert = require('assert') -var fc = require('fast-check') -var yaml = require('js-yaml') +var fc = require('fast-check') +var yaml = require('js-yaml') // Generate valid YAML instances for yaml.safeDump var key = fc.string({ unit: fc.nat({ max: 0xffff }).map(n => String.fromCharCode(n)) }) diff --git a/test/core/30-issues.test.js b/test/core/30-issues.test.js index 29a3e3fa..31d8ef86 100644 --- a/test/core/30-issues.test.js +++ b/test/core/30-issues.test.js @@ -3,7 +3,7 @@ const { describe } = require('node:test') var path = require('path') -var fs = require('fs') +var fs = require('fs') describe('Issues', function () { var issues = path.resolve(__dirname, 'issues') diff --git a/test/core/issues/0063.js b/test/core/issues/0063.js index 8d3c229c..731cedc9 100644 --- a/test/core/issues/0063.js +++ b/test/core/issues/0063.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Invalid errors/warnings of invalid indentation on flow scalars', function () { var sources = [ diff --git a/test/core/issues/0068.js b/test/core/issues/0068.js index 19947256..480fa805 100644 --- a/test/core/issues/0068.js +++ b/test/core/issues/0068.js @@ -3,9 +3,9 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Prevent adding unnecessary space character to end of a line within block collections', function () { assert.strictEqual(yaml.dump({ data: ['foo', 'bar', 'baz'] }), 'data:\n - foo\n - bar\n - baz\n') - assert.strictEqual(yaml.dump({ foo: { bar: ['baz'] } }), 'foo:\n bar:\n - baz\n') + assert.strictEqual(yaml.dump({ foo: { bar: ['baz'] } }), 'foo:\n bar:\n - baz\n') }) diff --git a/test/core/issues/0085.js b/test/core/issues/0085.js index 93817644..d8299b79 100644 --- a/test/core/issues/0085.js +++ b/test/core/issues/0085.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') var DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', diff --git a/test/core/issues/0092.js b/test/core/issues/0092.js index e919d50e..e0cc872a 100644 --- a/test/core/issues/0092.js +++ b/test/core/issues/0092.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Invalid parse error on whitespace between quoted scalar keys and ":" symbol in mappings', function () { assert.doesNotThrow(function () { diff --git a/test/core/issues/0093.js b/test/core/issues/0093.js index ca2b77d5..2e7cf5be 100644 --- a/test/core/issues/0093.js +++ b/test/core/issues/0093.js @@ -34,7 +34,7 @@ third: > f `) - assert.strictEqual(data.first, 'a b\n c\n d\ne f\n') + assert.strictEqual(data.first, 'a b\n c\n d\ne f\n') assert.strictEqual(data.second, 'a b\n c\n\n d\ne f\n') - assert.strictEqual(data.third, 'a b\n\n c\n d\ne f\n') + assert.strictEqual(data.third, 'a b\n\n c\n d\ne f\n') }) diff --git a/test/core/issues/0095.js b/test/core/issues/0095.js index 1ca93efa..15d8f8fc 100644 --- a/test/core/issues/0095.js +++ b/test/core/issues/0095.js @@ -3,22 +3,22 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Empty block scalars loaded wrong', function () { - assert.deepStrictEqual(yaml.load('a: |\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: |\nb: .'), { a: '', b: '.' }) assert.deepStrictEqual(yaml.load('a: |+\nb: .'), { a: '', b: '.' }) assert.deepStrictEqual(yaml.load('a: |-\nb: .'), { a: '', b: '.' }) - assert.deepStrictEqual(yaml.load('a: >\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: >\nb: .'), { a: '', b: '.' }) assert.deepStrictEqual(yaml.load('a: >+\nb: .'), { a: '', b: '.' }) assert.deepStrictEqual(yaml.load('a: >-\nb: .'), { a: '', b: '.' }) - assert.deepStrictEqual(yaml.load('a: |\n\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: |\n\nb: .'), { a: '', b: '.' }) assert.deepStrictEqual(yaml.load('a: |+\n\nb: .'), { a: '\n', b: '.' }) - assert.deepStrictEqual(yaml.load('a: |-\n\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: |-\n\nb: .'), { a: '', b: '.' }) - assert.deepStrictEqual(yaml.load('a: >\n\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: >\n\nb: .'), { a: '', b: '.' }) assert.deepStrictEqual(yaml.load('a: >+\n\nb: .'), { a: '\n', b: '.' }) - assert.deepStrictEqual(yaml.load('a: >-\n\nb: .'), { a: '', b: '.' }) + assert.deepStrictEqual(yaml.load('a: >-\n\nb: .'), { a: '', b: '.' }) }) diff --git a/test/core/issues/0108.js b/test/core/issues/0108.js index 8f8584c3..65476851 100644 --- a/test/core/issues/0108.js +++ b/test/core/issues/0108.js @@ -3,10 +3,10 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Literal scalars have an unwanted leading line break', function () { - assert.strictEqual(yaml.load('|\n foobar\n'), 'foobar\n') - assert.strictEqual(yaml.load('|\n hello\n world\n'), 'hello\nworld\n') + assert.strictEqual(yaml.load('|\n foobar\n'), 'foobar\n') + assert.strictEqual(yaml.load('|\n hello\n world\n'), 'hello\nworld\n') assert.strictEqual(yaml.load('|\n war never changes\n'), 'war never changes\n') }) diff --git a/test/core/issues/0110.js b/test/core/issues/0110.js index 3dc6e9e0..f5d209ed 100644 --- a/test/core/issues/0110.js +++ b/test/core/issues/0110.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Circular and cross references', function () { var source = { diff --git a/test/core/issues/0112.js b/test/core/issues/0112.js index 9da8b10f..0d7e61f5 100644 --- a/test/core/issues/0112.js +++ b/test/core/issues/0112.js @@ -3,12 +3,12 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Plain scalar "constructor" parsed as `null`', function () { - assert.strictEqual(yaml.load('constructor'), 'constructor') - assert.deepStrictEqual(yaml.load('constructor: value'), { constructor: 'value' }) - assert.deepStrictEqual(yaml.load('key: constructor'), { key: 'constructor' }) + assert.strictEqual(yaml.load('constructor'), 'constructor') + assert.deepStrictEqual(yaml.load('constructor: value'), { constructor: 'value' }) + assert.deepStrictEqual(yaml.load('key: constructor'), { key: 'constructor' }) assert.deepStrictEqual(yaml.load('{ constructor: value }'), { constructor: 'value' }) - assert.deepStrictEqual(yaml.load('{ key: constructor }'), { key: 'constructor' }) + assert.deepStrictEqual(yaml.load('{ key: constructor }'), { key: 'constructor' }) }) diff --git a/test/core/issues/0117.js b/test/core/issues/0117.js index cb12c660..d0c1a156 100644 --- a/test/core/issues/0117.js +++ b/test/core/issues/0117.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Negative zero loses the sign after dump', function () { assert.strictEqual(yaml.dump(-0), '-0.0\n') diff --git a/test/core/issues/0144.js b/test/core/issues/0144.js index 3a6fc96f..0ed82974 100644 --- a/test/core/issues/0144.js +++ b/test/core/issues/0144.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Infinite loop when attempting to parse multi-line scalar document that is not indented', function () { assert.strictEqual(yaml.load('--- |\nfoo\n'), 'foo\n') diff --git a/test/core/issues/0154.js b/test/core/issues/0154.js index 5665571f..bba6eb77 100644 --- a/test/core/issues/0154.js +++ b/test/core/issues/0154.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Indentation warning on empty lines within quoted scalars and flow collections', function () { assert.doesNotThrow(function () { yaml.load("- 'hello\n\n world'") }) diff --git a/test/core/issues/0155.js b/test/core/issues/0155.js index 829e36f1..688cd805 100644 --- a/test/core/issues/0155.js +++ b/test/core/issues/0155.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Named null', function () { assert.deepStrictEqual(yaml.load('---\ntest: !!null \nfoo: bar'), { test: null, foo: 'bar' }) diff --git a/test/core/issues/0156.js b/test/core/issues/0156.js index c5cd06c1..b591cdbb 100644 --- a/test/core/issues/0156.js +++ b/test/core/issues/0156.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') function SuccessSignal () {} diff --git a/test/core/issues/0205.js b/test/core/issues/0205.js index 3b285f42..5d5b4a10 100644 --- a/test/core/issues/0205.js +++ b/test/core/issues/0205.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Duplicated objects within array', function () { var obj = { test: 'canary' } diff --git a/test/core/issues/0243.js b/test/core/issues/0243.js index 3414a839..cef57a07 100644 --- a/test/core/issues/0243.js +++ b/test/core/issues/0243.js @@ -3,7 +3,7 @@ const { describe, it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') var readFileSync = require('fs').readFileSync describe('Duplicated mapping key errors throw at beginning of key', function () { diff --git a/test/core/issues/0266.js b/test/core/issues/0266.js index 6bd414c5..319de8ff 100644 --- a/test/core/issues/0266.js +++ b/test/core/issues/0266.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') var DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', diff --git a/test/core/issues/0303.js b/test/core/issues/0303.js index fc76fa60..28823272 100644 --- a/test/core/issues/0303.js +++ b/test/core/issues/0303.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Loader should not strip quotes before newlines', function () { var with_space = yaml.load("'''foo'' '") diff --git a/test/core/issues/0321.js b/test/core/issues/0321.js index 8d0194ea..faaaced7 100644 --- a/test/core/issues/0321.js +++ b/test/core/issues/0321.js @@ -3,7 +3,7 @@ const { it } = require('node:test') const assert = require('assert') -const yaml = require('js-yaml') +const yaml = require('js-yaml') it('Should throw exception on extra comma in flow mappings', function () { assert.throws(function () { diff --git a/test/core/issues/0332.js b/test/core/issues/0332.js index 55858002..f5a8abae 100644 --- a/test/core/issues/0332.js +++ b/test/core/issues/0332.js @@ -3,7 +3,7 @@ const { it } = require('node:test') const assert = require('assert') -const yaml = require('js-yaml') +const yaml = require('js-yaml') it('Should format errors', function () { try { diff --git a/test/core/issues/0418.js b/test/core/issues/0418.js index 7e721680..dddfadb7 100644 --- a/test/core/issues/0418.js +++ b/test/core/issues/0418.js @@ -7,5 +7,5 @@ const yaml = require('js-yaml') it('should error on invalid indentation in mappings', function () { assert.throws(() => yaml.load('foo: "1" bar: "2"'), /bad indentation of a mapping entry/) - assert.throws(() => yaml.load('- "foo" - "bar"'), /bad indentation of a sequence entry/) + assert.throws(() => yaml.load('- "foo" - "bar"'), /bad indentation of a sequence entry/) }) diff --git a/test/core/issues/0475.js b/test/core/issues/0475.js index ce0aec5a..b48505f8 100644 --- a/test/core/issues/0475.js +++ b/test/core/issues/0475.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') var readFileSync = require('fs').readFileSync it('Should not allow nested arrays in map keys (explicit syntax)', function () { diff --git a/test/core/issues/0519.js b/test/core/issues/0519.js index c594ace3..a2992d47 100644 --- a/test/core/issues/0519.js +++ b/test/core/issues/0519.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Dumper should add quotes around equals sign', function () { // pyyaml fails with unquoted `=` diff --git a/test/core/issues/0525-1.js b/test/core/issues/0525-1.js index 4c216be2..f0448984 100644 --- a/test/core/issues/0525-1.js +++ b/test/core/issues/0525-1.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Should throw if there is a null-byte in input', function () { try { diff --git a/test/core/issues/0525-2.js b/test/core/issues/0525-2.js index 7c62aa1b..a2fe906c 100644 --- a/test/core/issues/0525-2.js +++ b/test/core/issues/0525-2.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Should check kind type when resolving ! tag', function () { try { diff --git a/test/core/issues/0571.js b/test/core/issues/0571.js index 7fcbb57b..ad81a2a7 100644 --- a/test/core/issues/0571.js +++ b/test/core/issues/0571.js @@ -3,7 +3,7 @@ const { describe, it } = require('node:test') const assert = require('assert') -const yaml = require('js-yaml') +const yaml = require('js-yaml') describe('Undefined', function () { let undef = new yaml.Type('!undefined', { diff --git a/test/core/issues/0576.js b/test/core/issues/0576.js index b3e7164e..2299f1b9 100644 --- a/test/core/issues/0576.js +++ b/test/core/issues/0576.js @@ -3,11 +3,11 @@ const { describe, it } = require('node:test') const assert = require('assert') -const yaml = require('js-yaml') +const yaml = require('js-yaml') describe('Custom tags', function () { let tag_names = ['tag', '!tag', '!!tag', '!', 'tag*-!< >{\n}', '!tagαβγ'] - let encoded = ['!', '!tag', '!%21tag', '!%3C%21tag%3E', + let encoded = ['!', '!tag', '!%21tag', '!%3C%21tag%3E', '!', '!tag%CE%B1%CE%B2%CE%B3'] let tags = tag_names.map(tag => diff --git a/test/core/issues/0586.js b/test/core/issues/0586.js index c0737b78..44fd9723 100644 --- a/test/core/issues/0586.js +++ b/test/core/issues/0586.js @@ -3,7 +3,7 @@ const { it } = require('node:test') const assert = require('assert') -const yaml = require('js-yaml') +const yaml = require('js-yaml') it('Should allow custom formatting through implicit custom tags', function () { function CustomDump (data, opts) { diff --git a/test/core/issues/0587.js b/test/core/issues/0587.js index 8493ddb5..70939a1b 100644 --- a/test/core/issues/0587.js +++ b/test/core/issues/0587.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Should not encode astral characters', function () { assert.strictEqual(yaml.dump('😃😊'), '😃😊\n') diff --git a/test/core/issues/0614.js b/test/core/issues/0614.js index 1495f255..1c746cd2 100644 --- a/test/core/issues/0614.js +++ b/test/core/issues/0614.js @@ -5,7 +5,7 @@ const { it } = require('node:test') /* global BigInt */ const assert = require('assert') -const yaml = require('js-yaml') +const yaml = require('js-yaml') it('Should allow int override', function () { let options = Object.assign({}, yaml.types.int.options) diff --git a/test/core/samples-common/construct-float.js b/test/core/samples-common/construct-float.js index 44152aef..6e4773df 100644 --- a/test/core/samples-common/construct-float.js +++ b/test/core/samples-common/construct-float.js @@ -14,9 +14,9 @@ function testHandler (actual) { assert.strictEqual(Object.prototype.toString.call(actual), '[object Object]') assert.strictEqual(Object.keys(actual).sort().join(','), Object.keys(expected).sort().join(',')) - assert.strictEqual(actual['canonical'], expected['canonical']) - assert.strictEqual(actual['exponential'], expected['exponential']) - assert.strictEqual(actual['fixed'], expected['fixed']) + assert.strictEqual(actual['canonical'], expected['canonical']) + assert.strictEqual(actual['exponential'], expected['exponential']) + assert.strictEqual(actual['fixed'], expected['fixed']) assert.strictEqual(actual['negative infinity'], expected['negative infinity']) assert(Number.isNaN(actual['not a number'])) diff --git a/test/core/samples-common/construct-omap.js b/test/core/samples-common/construct-omap.js index ef17af35..8c41dcf5 100644 --- a/test/core/samples-common/construct-omap.js +++ b/test/core/samples-common/construct-omap.js @@ -2,8 +2,8 @@ module.exports = { Bestiary: [ - { aardvark : 'African pig-like ant eater. Ugly.' }, - { anteater : 'South-American ant eater. Two species.' }, + { aardvark : 'African pig-like ant eater. Ugly.' }, + { anteater : 'South-American ant eater. Two species.' }, { anaconda : 'South-American constrictor snake. Scaly.' } ], Numbers: [ diff --git a/test/core/support/schema.js b/test/core/support/schema.js index 31488013..21841fd0 100644 --- a/test/core/support/schema.js +++ b/test/core/support/schema.js @@ -20,7 +20,7 @@ function Tag3 () { util.inherits(Tag3, Tag2) function Foo (parameters) { - this.myParameter = parameters.myParameter + this.myParameter = parameters.myParameter this.myAnotherParameter = parameters.myAnotherParameter } diff --git a/test/core/units/alias-nodes.js b/test/core/units/alias-nodes.js index fede1145..a683b3f9 100644 --- a/test/core/units/alias-nodes.js +++ b/test/core/units/alias-nodes.js @@ -3,7 +3,7 @@ const { describe, it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') function TestClass (data) { var self = this diff --git a/test/core/units/bom-strip.js b/test/core/units/bom-strip.js index bfbe5346..944d8731 100644 --- a/test/core/units/bom-strip.js +++ b/test/core/units/bom-strip.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('BOM strip', function () { assert.deepStrictEqual(yaml.load('\uFEFFfoo: bar\n'), { foo: 'bar' }) diff --git a/test/core/units/dump-scalar-styles.js b/test/core/units/dump-scalar-styles.js index f4bfe65e..a77b59b4 100644 --- a/test/core/units/dump-scalar-styles.js +++ b/test/core/units/dump-scalar-styles.js @@ -3,7 +3,7 @@ const { describe, it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') // Indents lines by 2 spaces. Empty lines (\n only) are not indented. function indent (string) { @@ -81,12 +81,12 @@ describe('Scalar style dump:', function () { it('preserves trailing newlines using chomping', function () { assert.strictEqual(yaml.dump({ a: '\n', b: '\n\n', c: 'c\n', d: 'd\nd' }), 'a: |+\n\nb: |+\n\n\nc: |\n c\nd: |-\n d\n d\n') - assert.strictEqual(yaml.dump('\n'), '|+\n' + '\n') - assert.strictEqual(yaml.dump('\n\n'), '|+\n' + '\n\n') + assert.strictEqual(yaml.dump('\n'), '|+\n' + '\n') + assert.strictEqual(yaml.dump('\n\n'), '|+\n' + '\n\n') - assert.strictEqual(yaml.dump(content), '|-\n' + indented + '\n') - assert.strictEqual(yaml.dump(content + '\n'), '|\n' + indented + '\n') - assert.strictEqual(yaml.dump(content + '\n\n'), '|+\n' + indented + '\n\n') + assert.strictEqual(yaml.dump(content), '|-\n' + indented + '\n') + assert.strictEqual(yaml.dump(content + '\n'), '|\n' + indented + '\n') + assert.strictEqual(yaml.dump(content + '\n\n'), '|+\n' + indented + '\n\n') assert.strictEqual(yaml.dump(content + '\n\n\n'), '|+\n' + indented + '\n\n\n') }) @@ -155,12 +155,12 @@ describe('Scalar style dump:', function () { } it('wraps lines and ignores more-indented lines ', function () { - assert.strictEqual(dumpNarrow(content), '>-\n' + indented + '\n') + assert.strictEqual(dumpNarrow(content), '>-\n' + indented + '\n') }) it('preserves trailing newlines using chomping', function () { - assert.strictEqual(dumpNarrow(content + '\n'), '>\n' + indented + '\n') - assert.strictEqual(dumpNarrow(content + '\n\n'), '>+\n' + indented + '\n\n') + assert.strictEqual(dumpNarrow(content + '\n'), '>\n' + indented + '\n') + assert.strictEqual(dumpNarrow(content + '\n\n'), '>+\n' + indented + '\n\n') assert.strictEqual(dumpNarrow(content + '\n\n\n'), '>+\n' + indented + '\n\n\n') }) }()) diff --git a/test/core/units/empty-node-resolving.js b/test/core/units/empty-node-resolving.js index f17d3bc2..8f187d4c 100644 --- a/test/core/units/empty-node-resolving.js +++ b/test/core/units/empty-node-resolving.js @@ -3,7 +3,7 @@ const { describe, it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') describe('Resolving explicit tags on empty nodes', function () { it('!!binary', function () { diff --git a/test/core/units/loader-parameters.js b/test/core/units/loader-parameters.js index 46d7653f..f506fea8 100644 --- a/test/core/units/loader-parameters.js +++ b/test/core/units/loader-parameters.js @@ -7,7 +7,7 @@ var yaml = require('js-yaml') describe('loader parameters', function () { var testStr = 'test: 1 \ntest: 2' - var expected = [{ test: 2 }] + var expected = [{ test: 2 }] var result it('loadAll(input, options)', function () { diff --git a/test/core/units/single-document-error.js b/test/core/units/single-document-error.js index 2c94ada3..02f608b3 100644 --- a/test/core/units/single-document-error.js +++ b/test/core/units/single-document-error.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') it('Loading multidocument source using `load` should cause an error', function () { assert.throws(function () { diff --git a/test/core/units/skip-invalid.js b/test/core/units/skip-invalid.js index 4c16e1e6..58d450b5 100644 --- a/test/core/units/skip-invalid.js +++ b/test/core/units/skip-invalid.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') var sample = { number: 42, diff --git a/test/core/units/snippet.js b/test/core/units/snippet.js index 524b91ff..d83147b1 100644 --- a/test/core/units/snippet.js +++ b/test/core/units/snippet.js @@ -2,9 +2,9 @@ const { it } = require('node:test') -var assert = require('assert') -var path = require('path') -var fs = require('fs') +var assert = require('assert') +var path = require('path') +var fs = require('fs') var snippet = require('../../../lib/snippet') it('Snippet', function () { diff --git a/test/core/units/sort-keys.js b/test/core/units/sort-keys.js index cad235da..c1d32ff0 100644 --- a/test/core/units/sort-keys.js +++ b/test/core/units/sort-keys.js @@ -3,7 +3,7 @@ const { it } = require('node:test') var assert = require('assert') -var yaml = require('js-yaml') +var yaml = require('js-yaml') var sample = { b: 1, a: 2, c: 3 } var unsortedExpected = 'b: 1\na: 2\nc: 3\n' From 4a4790c1db729ad18d23699297632ea0b3d57685 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 16:11:39 +0300 Subject: [PATCH 18/23] CS: multiline-ternary, yoda, no-unmodified-loop-condition, no-useless-return, no-control-regex --- eslint.config.mjs | 5 ----- lib/dumper.js | 20 ++++++++++---------- lib/loader.js | 13 +++++++------ lib/type/int.js | 10 +++++----- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 31cb17a3..f2cf0957 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -19,14 +19,9 @@ export default [ 'one-var': 'off', '@stylistic/key-spacing': 'off', 'prefer-const': 'off', - '@stylistic/multiline-ternary': 'off', 'no-useless-escape': 'off', '@stylistic/no-mixed-operators': 'off', - yoda: 'off', 'object-shorthand': 'off', - 'no-control-regex': 'off', - 'no-unmodified-loop-condition': 'off', - 'no-useless-return': 'off' } } ] diff --git a/lib/dumper.js b/lib/dumper.js index b5212924..72f55eda 100644 --- a/lib/dumper.js +++ b/lib/dumper.js @@ -190,10 +190,10 @@ function isWhitespace (c) { // should also be escaped. [However,] This isn’t mandatory" // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. function isPrintable (c) { - return (0x00020 <= c && c <= 0x00007E) - || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM) - || (0x10000 <= c && c <= 0x10FFFF) + return (c >= 0x00020 && c <= 0x00007E) + || ((c >= 0x000A1 && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) + || ((c >= 0x0E000 && c <= 0x00FFFD) && c !== CHAR_BOM) + || (c >= 0x10000 && c <= 0x10FFFF) } // [34] ns-char ::= nb-char - s-white @@ -407,8 +407,9 @@ function writeScalar (state, string, level, iskey, inblock) { // state.lineWidth > 40 + state.indent: width decreases until the lower bound. // This behaves better than a constant minimum width which disallows narrower options, // or an indent threshold which causes the width to suddenly increase. - var lineWidth = state.lineWidth === -1 - ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent) + var lineWidth = (state.lineWidth === -1) + ? -1 + : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent) // Without knowing if keys are implicit/explicit, assume implicit for safety. var singleLineOnly = iskey @@ -480,10 +481,9 @@ function foldString (string, width) { while ((match = lineRe.exec(string))) { var prefix = match[1], line = match[2] moreIndented = (line[0] === ' ') - result += prefix - + (!prevMoreIndented && !moreIndented && line !== '' - ? '\n' : '') - + foldLine(line, width) + result += prefix + + ((!prevMoreIndented && !moreIndented && line !== '') ? '\n' : '') + + foldLine(line, width) prevMoreIndented = moreIndented } diff --git a/lib/loader.js b/lib/loader.js index b7c25a46..b0448171 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -16,6 +16,7 @@ var CHOMPING_CLIP = 1 var CHOMPING_STRIP = 2 var CHOMPING_KEEP = 3 +// eslint-disable-next-line no-control-regex var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/ @@ -50,13 +51,13 @@ function is_FLOW_INDICATOR (c) { function fromHexCode (c) { var lc - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + if ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) { return c - 0x30 } lc = c | 0x20 - if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) { + if ((lc >= 0x61/* a */) && (lc <= 0x66/* f */)) { return lc - 0x61 + 10 } @@ -71,7 +72,7 @@ function escapedHexLen (c) { } function fromDecimalCode (c) { - if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) { + if ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) { return c - 0x30 } @@ -79,6 +80,7 @@ function fromDecimalCode (c) { } function simpleEscapeSequence (c) { + /* eslint-disable @stylistic/multiline-ternary */ return (c === 0x30/* 0 */) ? '\x00' : (c === 0x61/* a */) ? '\x07' : (c === 0x62/* b */) ? '\x08' : @@ -273,7 +275,7 @@ function captureSegment (state, start, end, checkJson) { for (_position = 0, _length = _result.length; _position < _length; _position += 1) { _character = _result.charCodeAt(_position) if (!(_character === 0x09 || - (0x20 <= _character && _character <= 0x10FFFF))) { + (_character >= 0x20 && _character <= 0x10FFFF))) { throwError(state, 'expected valid JSON character') } } @@ -852,6 +854,7 @@ function readBlockScalar (state, nodeIndent) { ch = state.input.charCodeAt(state.position) + // eslint-disable-next-line no-unmodified-loop-condition while ((!detectedIndent || state.lineIndent < textIndent) && (ch === 0x20/* Space */)) { state.lineIndent++ @@ -1593,8 +1596,6 @@ function readDocument (state) { if (state.position < (state.length - 1)) { throwError(state, 'end of the stream or a document separator is expected') - } else { - return } } diff --git a/lib/type/int.js b/lib/type/int.js index 008b14bd..1bb39979 100644 --- a/lib/type/int.js +++ b/lib/type/int.js @@ -4,17 +4,17 @@ var common = require('../common') var Type = require('../type') function isHexCode (c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)) + return ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) || + ((c >= 0x41/* A */) && (c <= 0x46/* F */)) || + ((c >= 0x61/* a */) && (c <= 0x66/* f */)) } function isOctCode (c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)) + return ((c >= 0x30/* 0 */) && (c <= 0x37/* 7 */)) } function isDecCode (c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) + return ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) } function resolveYamlInteger (data) { From 53c6e254236e5d5f70c2f8b192e5f5c9f633ef78 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 16:34:25 +0300 Subject: [PATCH 19/23] CS: one-var --- eslint.config.mjs | 1 - examples/int_type_override.js | 4 +- examples/sample_document.js | 6 +- lib/common.js | 3 +- lib/dumper.js | 113 +++++----- lib/exception.js | 3 +- lib/loader.js | 204 +++++++++--------- lib/schema.js | 24 ++- lib/snippet.js | 4 +- lib/type/binary.js | 27 ++- lib/type/int.js | 12 +- lib/type/omap.js | 8 +- lib/type/pairs.js | 16 +- lib/type/set.js | 3 +- lib/type/timestamp.js | 14 +- test/core/20-dumper.test.js | 6 +- test/core/issues/0046.js | 5 +- test/core/issues/0054.js | 4 +- test/core/issues/0194.js | 4 +- test/core/issues/0399.js | 3 +- test/core/issues/0570.js | 3 +- test/core/issues/0614.js | 4 +- .../samples-common/construct-string-types.js | 4 +- test/core/units/alias-nodes.js | 4 +- test/core/units/dump-scalar-styles.js | 3 +- test/core/units/snippet.js | 14 +- 26 files changed, 277 insertions(+), 219 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index f2cf0957..a7d4ef33 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -16,7 +16,6 @@ export default [ 'no-var': 'off', '@stylistic/indent': 'off', '@stylistic/operator-linebreak': 'off', - 'one-var': 'off', '@stylistic/key-spacing': 'off', 'prefer-const': 'off', 'no-useless-escape': 'off', diff --git a/examples/int_type_override.js b/examples/int_type_override.js index ea4675fe..423fd03d 100644 --- a/examples/int_type_override.js +++ b/examples/int_type_override.js @@ -11,7 +11,9 @@ const yaml = require('../') let options = Object.assign({}, yaml.types.int.options) options.construct = data => { - let value = data, sign = 1n, ch + let value = data + let sign = 1n + let ch if (value.indexOf('_') !== -1) { value = value.replace(/_/g, '') diff --git a/examples/sample_document.js b/examples/sample_document.js index c3593bb8..dc002ead 100644 --- a/examples/sample_document.js +++ b/examples/sample_document.js @@ -6,9 +6,9 @@ var util = require('util') var yaml = require('../') try { - var filename = path.join(__dirname, 'sample_document.yml'), - contents = fs.readFileSync(filename, 'utf8'), - data = yaml.load(contents) + var filename = path.join(__dirname, 'sample_document.yml') + var contents = fs.readFileSync(filename, 'utf8') + var data = yaml.load(contents) console.log(util.inspect(data, false, 10, true)) } catch (err) { diff --git a/lib/common.js b/lib/common.js index 335970e1..97ec9796 100644 --- a/lib/common.js +++ b/lib/common.js @@ -31,7 +31,8 @@ function extend (target, source) { } function repeat (string, count) { - var result = '', cycle + var result = '' + var cycle for (cycle = 0; cycle < count; cycle += 1) { result += string diff --git a/lib/dumper.js b/lib/dumper.js index 72f55eda..e91397a3 100644 --- a/lib/dumper.js +++ b/lib/dumper.js @@ -106,8 +106,8 @@ function encodeHex (character) { return '\\' + handle + common.repeat('0', length - string.length) + string } -var QUOTING_TYPE_SINGLE = 1, - QUOTING_TYPE_DOUBLE = 2 +var QUOTING_TYPE_SINGLE = 1 +var QUOTING_TYPE_DOUBLE = 2 function State (options) { this.schema = options['schema'] || DEFAULT_SCHEMA @@ -137,12 +137,12 @@ function State (options) { // Indents every line in a string. Empty lines (\n only) are not indented. function indentString (string, spaces) { - var ind = common.repeat(' ', spaces), - position = 0, - next = -1, - result = '', - line, - length = string.length + var ind = common.repeat(' ', spaces) + var position = 0 + var next = -1 + var result = '' + var line + var length = string.length while (position < length) { next = string.indexOf('\n', position) @@ -281,7 +281,9 @@ function isPlainSafeLast (c) { // Same as 'string'.codePointAt(pos), but works in older browsers. function codePointAt (string, pos) { - var first = string.charCodeAt(pos), second + var first = string.charCodeAt(pos) + var second + if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { second = string.charCodeAt(pos + 1) if (second >= 0xDC00 && second <= 0xDFFF) { @@ -298,11 +300,11 @@ function needIndentIndicator (string) { return leadingSpaceRe.test(string) } -var STYLE_PLAIN = 1, - STYLE_SINGLE = 2, - STYLE_LITERAL = 3, - STYLE_FOLDED = 4, - STYLE_DOUBLE = 5 +var STYLE_PLAIN = 1 +var STYLE_SINGLE = 2 +var STYLE_LITERAL = 3 +var STYLE_FOLDED = 4 +var STYLE_DOUBLE = 5 // Determines which scalar styles are possible and returns the preferred style. // lineWidth = -1 => no limit. @@ -479,7 +481,9 @@ function foldString (string, width) { // rest of the lines var match while ((match = lineRe.exec(string))) { - var prefix = match[1], line = match[2] + var prefix = match[1] + var line = match[2] + moreIndented = (line[0] === ' ') result += prefix + ((!prevMoreIndented && !moreIndented && line !== '') ? '\n' : '') + @@ -501,7 +505,10 @@ function foldLine (line, width) { var breakRe = / [^ ]/g // note: the match index will always be <= length-2. var match // start is an inclusive index. end, curr, and next are exclusive. - var start = 0, end, curr = 0, next = 0 + var start = 0 + var end + var curr = 0 + var next = 0 var result = '' // Invariants: 0 <= start <= length-1. @@ -555,11 +562,11 @@ function escapeString (string) { } function writeFlowSequence (state, level, object) { - var _result = '', - _tag = state.tag, - index, - length, - value + var _result = '' + var _tag = state.tag + var index + var length + var value for (index = 0, length = object.length; index < length; index += 1) { value = object[index] @@ -582,11 +589,11 @@ function writeFlowSequence (state, level, object) { } function writeBlockSequence (state, level, object, compact) { - var _result = '', - _tag = state.tag, - index, - length, - value + var _result = '' + var _tag = state.tag + var index + var length + var value for (index = 0, length = object.length; index < length; index += 1) { value = object[index] @@ -618,14 +625,14 @@ function writeBlockSequence (state, level, object, compact) { } function writeFlowMapping (state, level, object) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - pairBuffer + var _result = '' + var _tag = state.tag + var objectKeyList = Object.keys(object) + var index + var length + var objectKey + var objectValue + var pairBuffer for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = '' @@ -663,15 +670,15 @@ function writeFlowMapping (state, level, object) { } function writeBlockMapping (state, level, object, compact) { - var _result = '', - _tag = state.tag, - objectKeyList = Object.keys(object), - index, - length, - objectKey, - objectValue, - explicitPair, - pairBuffer + var _result = '' + var _tag = state.tag + var objectKeyList = Object.keys(object) + var index + var length + var objectKey + var objectValue + var explicitPair + var pairBuffer // Allow sorting keys so that the output file is deterministic if (state.sortKeys === true) { @@ -801,9 +808,9 @@ function writeNode (state, level, object, block, compact, iskey, isblockseq) { block = (state.flowLevel < 0 || state.flowLevel > level) } - var objectOrArray = type === '[object Object]' || type === '[object Array]', - duplicateIndex, - duplicate + var objectOrArray = type === '[object Object]' || type === '[object Array]' + var duplicateIndex + var duplicate if (objectOrArray) { duplicateIndex = state.duplicates.indexOf(object) @@ -893,10 +900,10 @@ function writeNode (state, level, object, block, compact, iskey, isblockseq) { } function getDuplicateReferences (object, state) { - var objects = [], - duplicatesIndexes = [], - index, - length + var objects = [] + var duplicatesIndexes = [] + var index + var length inspectNode(object, objects, duplicatesIndexes) @@ -907,9 +914,9 @@ function getDuplicateReferences (object, state) { } function inspectNode (object, objects, duplicatesIndexes) { - var objectKeyList, - index, - length + var objectKeyList + var index + var length if (object !== null && typeof object === 'object') { index = objects.indexOf(object) diff --git a/lib/exception.js b/lib/exception.js index 8f31e963..7c893855 100644 --- a/lib/exception.js +++ b/lib/exception.js @@ -3,7 +3,8 @@ 'use strict' function formatError (exception, compact) { - var where = '', message = exception.reason || '(unknown reason)' + var where = '' + var message = exception.reason || '(unknown reason)' if (!exception.mark) return message diff --git a/lib/loader.js b/lib/loader.js index b0448171..d7c17f81 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -387,8 +387,8 @@ function readLineBreak (state) { } function skipSeparationSpace (state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position) + var lineBreaks = 0 + var ch = state.input.charCodeAt(state.position) while (ch !== 0) { while (is_WHITE_SPACE(ch)) { @@ -428,8 +428,8 @@ function skipSeparationSpace (state, allowComments, checkIndent) { } function testDocumentSeparator (state) { - var _position = state.position, - ch + var _position = state.position + var ch ch = state.input.charCodeAt(_position) @@ -459,17 +459,17 @@ function writeFoldedLines (state, count) { } function readPlainScalar (state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch + var preceding + var following + var captureStart + var captureEnd + var hasPendingContent + var _line + var _lineStart + var _lineIndent + var _kind = state.kind + var _result = state.result + var ch ch = state.input.charCodeAt(state.position) @@ -565,8 +565,9 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { } function readSingleQuotedScalar (state, nodeIndent) { - var ch, - captureStart, captureEnd + var ch + var captureStart + var captureEnd ch = state.input.charCodeAt(state.position) @@ -607,12 +608,12 @@ function readSingleQuotedScalar (state, nodeIndent) { } function readDoubleQuotedScalar (state, nodeIndent) { - var captureStart, - captureEnd, - hexLength, - hexResult, - tmp, - ch + var captureStart + var captureEnd + var hexLength + var hexResult + var tmp + var ch ch = state.input.charCodeAt(state.position) @@ -679,23 +680,23 @@ function readDoubleQuotedScalar (state, nodeIndent) { } function readFlowCollection (state, nodeIndent) { - var readNext = true, - _line, - _lineStart, - _pos, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = Object.create(null), - keyNode, - keyTag, - valueNode, - ch + var readNext = true + var _line + var _lineStart + var _pos + var _tag = state.tag + var _result + var _anchor = state.anchor + var following + var terminator + var isPair + var isExplicitPair + var isMapping + var overridableKeys = Object.create(null) + var keyNode + var keyTag + var valueNode + var ch ch = state.input.charCodeAt(state.position) @@ -791,16 +792,16 @@ function readFlowCollection (state, nodeIndent) { } function readBlockScalar (state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch + var captureStart + var folding + var chomping = CHOMPING_CLIP + var didReadContent = false + var detectedIndent = false + var textIndent = nodeIndent + var emptyLines = 0 + var atMoreIndented = false + var tmp + var ch ch = state.input.charCodeAt(state.position) @@ -931,13 +932,13 @@ function readBlockScalar (state, nodeIndent) { } function readBlockSequence (state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch + var _line + var _tag = state.tag + var _anchor = state.anchor + var _result = [] + var following + var detected = false + var ch // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar @@ -1001,22 +1002,22 @@ function readBlockSequence (state, nodeIndent) { } function readBlockMapping (state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _keyLine, - _keyLineStart, - _keyPos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = Object.create(null), - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch + var following + var allowCompact + var _line + var _keyLine + var _keyLineStart + var _keyPos + var _tag = state.tag + var _anchor = state.anchor + var _result = {} + var overridableKeys = Object.create(null) + var keyTag = null + var keyNode = null + var valueNode = null + var atExplicitKey = false + var detected = false + var ch // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar @@ -1171,12 +1172,12 @@ function readBlockMapping (state, nodeIndent, flowIndent) { } function readTagProperty (state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch + var _position + var isVerbatim = false + var isNamed = false + var tagHandle + var tagName + var ch ch = state.input.charCodeAt(state.position) @@ -1264,8 +1265,8 @@ function readTagProperty (state) { } function readAnchorProperty (state) { - var _position, - ch + var _position + var ch ch = state.input.charCodeAt(state.position) @@ -1291,8 +1292,9 @@ function readAnchorProperty (state) { } function readAlias (state) { - var _position, alias, - ch + var _position + var alias + var ch ch = state.input.charCodeAt(state.position) @@ -1321,18 +1323,18 @@ function readAlias (state) { } function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, // 1: this>parent, 0: this=parent, -1: thisparent, 0: this=parent, -1: this { - let value = data, sign = 1n, ch + let value = data + let sign = 1n + let ch if (value.indexOf('_') !== -1) { value = value.replace(/_/g, '') diff --git a/test/core/samples-common/construct-string-types.js b/test/core/samples-common/construct-string-types.js index 3264f910..081d8992 100644 --- a/test/core/samples-common/construct-string-types.js +++ b/test/core/samples-common/construct-string-types.js @@ -69,8 +69,8 @@ module.exports = { } // now indent the long multi really far -var obj = module.exports, - i +var obj = module.exports +var i for (i = 0; i < 5; i++) { obj.indent = {} diff --git a/test/core/units/alias-nodes.js b/test/core/units/alias-nodes.js index a683b3f9..b3e49694 100644 --- a/test/core/units/alias-nodes.js +++ b/test/core/units/alias-nodes.js @@ -38,8 +38,8 @@ describe('Alias nodes', function () { }) it('Simple custom objects', function () { - var expected = new TestClass({ a: 'b', c: 'd' }), - actual = yaml.load('[&1 !test {a: b, c: d}, *1]', { schema: TEST_SCHEMA })[1] + var expected = new TestClass({ a: 'b', c: 'd' }) + var actual = yaml.load('[&1 !test {a: b, c: d}, *1]', { schema: TEST_SCHEMA })[1] assert(actual instanceof TestClass) assert.deepStrictEqual(actual, expected) diff --git a/test/core/units/dump-scalar-styles.js b/test/core/units/dump-scalar-styles.js index a77b59b4..478ca8ee 100644 --- a/test/core/units/dump-scalar-styles.js +++ b/test/core/units/dump-scalar-styles.js @@ -76,7 +76,8 @@ describe('Scalar style dump:', function () { }) describe('Literal style', function () { - var content = 'a\nb \n\n c\n d', indented = indent(content) + var content = 'a\nb \n\n c\n d' + var indented = indent(content) it('preserves trailing newlines using chomping', function () { assert.strictEqual(yaml.dump({ a: '\n', b: '\n\n', c: 'c\n', d: 'd\nd' }), diff --git a/test/core/units/snippet.js b/test/core/units/snippet.js index d83147b1..25df6f92 100644 --- a/test/core/units/snippet.js +++ b/test/core/units/snippet.js @@ -8,15 +8,19 @@ var fs = require('fs') var snippet = require('../../../lib/snippet') it('Snippet', function () { - let filepath = path.join(__dirname, 'snippet.txt'), - filedata = fs.readFileSync(filepath, 'utf8') + let filepath = path.join(__dirname, 'snippet.txt') + let filedata = fs.readFileSync(filepath, 'utf8') let data = filedata.split(/(---[ \d]*\n)/).slice(1) for (let i = 0; i < data.length; i += 4) { - let index = 0, line = 0, column = 0, input = data[i + 1], - expected = data[i + 3].replace(/\n$/, ''), - mark, code + let index = 0 + let line = 0 + let column = 0 + let input = data[i + 1] + let expected = data[i + 3].replace(/\n$/, '') + let mark + let code assert(input.indexOf('*') >= 0) From d1971f890eca79de41f9dbad5c9ce7735bb45620 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 17:21:30 +0300 Subject: [PATCH 20/23] refactor: replace multiline ternary with switch statement --- lib/loader.js | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/loader.js b/lib/loader.js index d7c17f81..054970ba 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -80,25 +80,27 @@ function fromDecimalCode (c) { } function simpleEscapeSequence (c) { - /* eslint-disable @stylistic/multiline-ternary */ - return (c === 0x30/* 0 */) ? '\x00' : - (c === 0x61/* a */) ? '\x07' : - (c === 0x62/* b */) ? '\x08' : - (c === 0x74/* t */) ? '\x09' : - (c === 0x09/* Tab */) ? '\x09' : - (c === 0x6E/* n */) ? '\x0A' : - (c === 0x76/* v */) ? '\x0B' : - (c === 0x66/* f */) ? '\x0C' : - (c === 0x72/* r */) ? '\x0D' : - (c === 0x65/* e */) ? '\x1B' : - (c === 0x20/* Space */) ? ' ' : - (c === 0x22/* " */) ? '\x22' : - (c === 0x2F/* / */) ? '/' : - (c === 0x5C/* \ */) ? '\x5C' : - (c === 0x4E/* N */) ? '\x85' : - (c === 0x5F/* _ */) ? '\xA0' : - (c === 0x4C/* L */) ? '\u2028' : - (c === 0x50/* P */) ? '\u2029' : '' + switch (c) { + case 0x30/* 0 */: return '\x00' + case 0x61/* a */: return '\x07' + case 0x62/* b */: return '\x08' + case 0x74/* t */: return '\x09' + case 0x09/* Tab */: return '\x09' + case 0x6E/* n */: return '\x0A' + case 0x76/* v */: return '\x0B' + case 0x66/* f */: return '\x0C' + case 0x72/* r */: return '\x0D' + case 0x65/* e */: return '\x1B' + case 0x20/* Space */: return ' ' + case 0x22/* " */: return '\x22' + case 0x2F/* / */: return '/' + case 0x5C/* \ */: return '\x5C' + case 0x4E/* N */: return '\x85' + case 0x5F/* _ */: return '\xA0' + case 0x4C/* L */: return '\u2028' + case 0x50/* P */: return '\u2029' + default: return '' + } } function charFromCodepoint (c) { From 33381cd703202d294fef4348227e8c0780796655 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 18:14:22 +0300 Subject: [PATCH 21/23] CS: indent, operator-linebreak, no-mixed-operators --- bin/js-yaml.js | 4 +- eslint.config.mjs | 3 - lib/dumper.js | 109 +++++++++++++------------- lib/loader.js | 11 ++- test/core/units/dump-scalar-styles.js | 12 +-- 5 files changed, 69 insertions(+), 70 deletions(-) diff --git a/bin/js-yaml.js b/bin/js-yaml.js index 2ad37a41..9a74da59 100755 --- a/bin/js-yaml.js +++ b/bin/js-yaml.js @@ -76,7 +76,7 @@ readFile(options.file, 'utf8', function (error, input) { } console.error( - options.trace && error.stack || + (options.trace && error.stack) || error.message || String(error)) @@ -103,7 +103,7 @@ readFile(options.file, 'utf8', function (error, input) { } } else { console.error( - options.trace && err.stack || + (options.trace && err.stack) || err.message || String(err)) diff --git a/eslint.config.mjs b/eslint.config.mjs index a7d4ef33..e642babc 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -14,12 +14,9 @@ export default [ rules: { camelcase: 'off', 'no-var': 'off', - '@stylistic/indent': 'off', - '@stylistic/operator-linebreak': 'off', '@stylistic/key-spacing': 'off', 'prefer-const': 'off', 'no-useless-escape': 'off', - '@stylistic/no-mixed-operators': 'off', 'object-shorthand': 'off', } } diff --git a/lib/dumper.js b/lib/dumper.js index e91397a3..de0244d2 100644 --- a/lib/dumper.js +++ b/lib/dumper.js @@ -190,10 +190,10 @@ function isWhitespace (c) { // should also be escaped. [However,] This isn’t mandatory" // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029. function isPrintable (c) { - return (c >= 0x00020 && c <= 0x00007E) - || ((c >= 0x000A1 && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) - || ((c >= 0x0E000 && c <= 0x00FFFD) && c !== CHAR_BOM) - || (c >= 0x10000 && c <= 0x10FFFF) + return (c >= 0x00020 && c <= 0x00007E) || + ((c >= 0x000A1 && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029) || + ((c >= 0x0E000 && c <= 0x00FFFD) && c !== CHAR_BOM) || + (c >= 0x10000 && c <= 0x10FFFF) } // [34] ns-char ::= nb-char - s-white @@ -202,11 +202,11 @@ function isPrintable (c) { // Including s-white (for some reason, examples doesn't match specs in this aspect) // ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark function isNsCharOrWhitespace (c) { - return isPrintable(c) - && c !== CHAR_BOM + return isPrintable(c) && + c !== CHAR_BOM && // - b-char - && c !== CHAR_CARRIAGE_RETURN - && c !== CHAR_LINE_FEED + c !== CHAR_CARRIAGE_RETURN && + c !== CHAR_LINE_FEED } // [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out @@ -222,22 +222,24 @@ function isPlainSafe (c, prev, inblock) { var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c) var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c) return ( - // ns-plain-safe - inblock ? // c = flow-in - cIsNsCharOrWhitespace - : cIsNsCharOrWhitespace - // - c-flow-indicator - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET - ) + ( + // ns-plain-safe + inblock // c = flow-in + ? cIsNsCharOrWhitespace + : cIsNsCharOrWhitespace && + // - c-flow-indicator + c !== CHAR_COMMA && + c !== CHAR_LEFT_SQUARE_BRACKET && + c !== CHAR_RIGHT_SQUARE_BRACKET && + c !== CHAR_LEFT_CURLY_BRACKET && + c !== CHAR_RIGHT_CURLY_BRACKET + ) && // ns-plain-char - && c !== CHAR_SHARP // false on '#' - && !(prev === CHAR_COLON && !cIsNsChar) // false on ': ' - || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#' - || (prev === CHAR_COLON && cIsNsChar) // change to true on ':[^ ]' + c !== CHAR_SHARP && // false on '#' + !(prev === CHAR_COLON && !cIsNsChar) + ) || // false on ': ' + (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) || // change to true on '[^ ]#' + (prev === CHAR_COLON && cIsNsChar) // change to true on ':[^ ]' } // Simplified test for values allowed as the first character in plain style. @@ -245,32 +247,33 @@ function isPlainSafeFirst (c) { // Uses a subset of ns-char - c-indicator // where ns-char = nb-char - s-white. // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part - return isPrintable(c) && c !== CHAR_BOM - && !isWhitespace(c) // - s-white + return isPrintable(c) && + c !== CHAR_BOM && + !isWhitespace(c) && // - s-white // - (c-indicator ::= // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}” - && c !== CHAR_MINUS - && c !== CHAR_QUESTION - && c !== CHAR_COLON - && c !== CHAR_COMMA - && c !== CHAR_LEFT_SQUARE_BRACKET - && c !== CHAR_RIGHT_SQUARE_BRACKET - && c !== CHAR_LEFT_CURLY_BRACKET - && c !== CHAR_RIGHT_CURLY_BRACKET + c !== CHAR_MINUS && + c !== CHAR_QUESTION && + c !== CHAR_COLON && + c !== CHAR_COMMA && + c !== CHAR_LEFT_SQUARE_BRACKET && + c !== CHAR_RIGHT_SQUARE_BRACKET && + c !== CHAR_LEFT_CURLY_BRACKET && + c !== CHAR_RIGHT_CURLY_BRACKET && // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"” - && c !== CHAR_SHARP - && c !== CHAR_AMPERSAND - && c !== CHAR_ASTERISK - && c !== CHAR_EXCLAMATION - && c !== CHAR_VERTICAL_LINE - && c !== CHAR_EQUALS - && c !== CHAR_GREATER_THAN - && c !== CHAR_SINGLE_QUOTE - && c !== CHAR_DOUBLE_QUOTE + c !== CHAR_SHARP && + c !== CHAR_AMPERSAND && + c !== CHAR_ASTERISK && + c !== CHAR_EXCLAMATION && + c !== CHAR_VERTICAL_LINE && + c !== CHAR_EQUALS && + c !== CHAR_GREATER_THAN && + c !== CHAR_SINGLE_QUOTE && + c !== CHAR_DOUBLE_QUOTE && // | “%” | “@” | “`”) - && c !== CHAR_PERCENT - && c !== CHAR_COMMERCIAL_AT - && c !== CHAR_GRAVE_ACCENT + c !== CHAR_PERCENT && + c !== CHAR_COMMERCIAL_AT && + c !== CHAR_GRAVE_ACCENT } // Simplified test for values allowed as the last character in plain style. @@ -322,8 +325,8 @@ function chooseScalarStyle (string, singleLineOnly, indentPerLevel, lineWidth, var hasFoldableLine = false // only checked if shouldTrackWidth var shouldTrackWidth = lineWidth !== -1 var previousLineBreak = -1 // count the first line correctly - var plain = isPlainSafeFirst(codePointAt(string, 0)) - && isPlainSafeLast(codePointAt(string, string.length - 1)) + var plain = isPlainSafeFirst(codePointAt(string, 0)) && + isPlainSafeLast(codePointAt(string, string.length - 1)) if (singleLineOnly || forceQuotes) { // Case: no block styles. @@ -414,9 +417,9 @@ function writeScalar (state, string, level, iskey, inblock) { : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent) // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey + var singleLineOnly = iskey || // No block styles in flow mode. - || (state.flowLevel > -1 && level >= state.flowLevel) + (state.flowLevel > -1 && level >= state.flowLevel) function testAmbiguity (string) { return testImplicitResolving(state, string) } @@ -428,11 +431,11 @@ function writeScalar (state, string, level, iskey, inblock) { case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'" case STYLE_LITERAL: - return '|' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(string, indent)) + return '|' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(string, indent)) case STYLE_FOLDED: - return '>' + blockHeader(string, state.indent) - + dropEndingNewline(indentString(foldString(string, lineWidth), indent)) + return '>' + blockHeader(string, state.indent) + + dropEndingNewline(indentString(foldString(string, lineWidth), indent)) case STYLE_DOUBLE: return '"' + escapeString(string, lineWidth) + '"' default: diff --git a/lib/loader.js b/lib/loader.js index 054970ba..bc330732 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -495,7 +495,7 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { following = state.input.charCodeAt(state.position + 1) if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { + (withinFlowCollection && is_FLOW_INDICATOR(following))) { return false } } @@ -510,7 +510,7 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { following = state.input.charCodeAt(state.position + 1) if (is_WS_OR_EOL(following) || - withinFlowCollection && is_FLOW_INDICATOR(following)) { + (withinFlowCollection && is_FLOW_INDICATOR(following))) { break } } else if (ch === 0x23/* # */) { @@ -520,7 +520,7 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { break } } else if ((state.position === state.lineStart && testDocumentSeparator(state)) || - withinFlowCollection && is_FLOW_INDICATOR(ch)) { + (withinFlowCollection && is_FLOW_INDICATOR(ch))) { break } else if (is_EOL(ch)) { _line = state.line @@ -1398,9 +1398,8 @@ function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompac blockIndent = state.position - state.lineStart if (indentStatus === 1) { - if (allowBlockCollections && - (readBlockSequence(state, blockIndent) || - readBlockMapping(state, blockIndent, flowIndent)) || + if ((allowBlockCollections && + (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent))) || readFlowCollection(state, flowIndent)) { hasContent = true } else { diff --git a/test/core/units/dump-scalar-styles.js b/test/core/units/dump-scalar-styles.js index 478ca8ee..cb70259a 100644 --- a/test/core/units/dump-scalar-styles.js +++ b/test/core/units/dump-scalar-styles.js @@ -185,8 +185,8 @@ describe('Scalar style dump:', function () { }) it('preserves consecutive spaces', function () { - var alphabet = 'a bc def ghi' + repeat(' ', 70) + 'jk lmn o\n' - + ' p qrstu v' + repeat(' ', 80) + '\nw x\n' + 'yz ' + var alphabet = 'a bc def ghi' + repeat(' ', 70) + 'jk lmn o\n' + + ' p qrstu v' + repeat(' ', 80) + '\nw x\n' + 'yz ' assert.strictEqual(dump(alphabet), '>-\n' + indent( 'a bc def \n' + @@ -211,10 +211,10 @@ describe('Scalar style dump:', function () { .join('\n') + '\n')) }) - var story = 'Call me Ishmael. Some years ago—never mind how long precisely—' - + 'having little or no money in my purse, ' - + 'and nothing particular to interest me on shore, ' - + 'I thought I would sail about a little and see the watery part of the world...' + var story = 'Call me Ishmael. Some years ago—never mind how long precisely—' + + 'having little or no money in my purse, ' + + 'and nothing particular to interest me on shore, ' + + 'I thought I would sail about a little and see the watery part of the world...' var prefix = 'var short_story = "",' var line = 'longer_story = "' + story + '";' From 13642a6b4c3507ee46cf9c17032b0ad3d7545c7d Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 19:16:09 +0300 Subject: [PATCH 22/23] CS [es2015]: var => let/const --- bin/js-yaml.js | 14 +- eslint.config.mjs | 2 - examples/custom_types.js | 16 +- examples/dumper.js | 4 +- examples/int_type_override.js | 4 +- examples/sample_document.js | 14 +- index.js | 4 +- lib/common.js | 6 +- lib/dumper.js | 276 ++++++++--------- lib/exception.js | 4 +- lib/loader.js | 292 +++++++++--------- lib/schema.js | 20 +- lib/schema/failsafe.js | 2 +- lib/snippet.js | 28 +- lib/type.js | 8 +- lib/type/binary.js | 41 ++- lib/type/bool.js | 4 +- lib/type/float.js | 16 +- lib/type/int.js | 18 +- lib/type/map.js | 2 +- lib/type/merge.js | 2 +- lib/type/null.js | 4 +- lib/type/omap.js | 18 +- lib/type/pairs.js | 31 +- lib/type/seq.js | 2 +- lib/type/set.js | 8 +- lib/type/str.js | 2 +- lib/type/timestamp.js | 39 +-- support/demo_template/index.mjs | 14 +- test/core/00-units.test.js | 6 +- test/core/10-loader.test.js | 18 +- test/core/11-load-errors.test.js | 16 +- test/core/20-dumper.test.js | 20 +- test/core/25-dumper-fuzzy.test.js | 16 +- test/core/30-issues.test.js | 6 +- test/core/issues/0008.js | 4 +- test/core/issues/0017.js | 6 +- test/core/issues/0019.js | 6 +- test/core/issues/0026.js | 6 +- test/core/issues/0027.js | 8 +- test/core/issues/0033.js | 6 +- test/core/issues/0046.js | 14 +- test/core/issues/0054.js | 10 +- test/core/issues/0063.js | 8 +- test/core/issues/0064.js | 6 +- test/core/issues/0068.js | 4 +- test/core/issues/0085.js | 8 +- test/core/issues/0092.js | 4 +- test/core/issues/0093.js | 6 +- test/core/issues/0095.js | 4 +- test/core/issues/0108.js | 4 +- test/core/issues/0110.js | 8 +- test/core/issues/0112.js | 4 +- test/core/issues/0117.js | 4 +- test/core/issues/0144.js | 4 +- test/core/issues/0154.js | 4 +- test/core/issues/0155.js | 4 +- test/core/issues/0156.js | 8 +- test/core/issues/0160.js | 4 +- test/core/issues/0164.js | 4 +- test/core/issues/0194.js | 11 +- test/core/issues/0203.js | 6 +- test/core/issues/0205.js | 16 +- test/core/issues/0220.js | 4 +- test/core/issues/0221.js | 4 +- test/core/issues/0235.js | 4 +- test/core/issues/0243.js | 14 +- test/core/issues/0248-listener.js | 10 +- test/core/issues/0258.js | 10 +- test/core/issues/0266.js | 8 +- test/core/issues/0303.js | 8 +- test/core/issues/0333.js | 6 +- test/core/issues/0335.js | 6 +- test/core/issues/0342.js | 10 +- test/core/issues/0346.js | 12 +- test/core/issues/0350.js | 6 +- test/core/issues/0351.js | 4 +- test/core/issues/0385.js | 16 +- test/core/issues/0399.js | 8 +- test/core/issues/0403.js | 6 +- test/core/issues/0432.js | 16 +- test/core/issues/0468.js | 8 +- test/core/issues/0470.js | 8 +- test/core/issues/0475.js | 6 +- test/core/issues/0519.js | 4 +- test/core/issues/0521.js | 12 +- test/core/issues/0525-1.js | 4 +- test/core/issues/0525-2.js | 4 +- test/core/issues/0570.js | 6 +- test/core/issues/0571.js | 4 +- test/core/issues/0576.js | 8 +- test/core/issues/0586.js | 6 +- test/core/issues/0587.js | 4 +- test/core/issues/0614.js | 4 +- test/core/samples-common/construct-custom.js | 6 +- test/core/samples-common/construct-float.js | 4 +- .../samples-common/construct-string-types.js | 6 +- test/core/samples-common/more-floats.js | 4 +- test/core/support/schema.js | 6 +- test/core/units/alias-nodes.js | 18 +- test/core/units/bom-strip.js | 4 +- test/core/units/character-set.js | 4 +- test/core/units/dump-scalar-styles.js | 46 +-- test/core/units/empty-node-resolving.js | 4 +- test/core/units/is-negative-zero.js | 4 +- test/core/units/loader-parameters.js | 10 +- test/core/units/replacer.js | 16 +- test/core/units/single-document-error.js | 4 +- test/core/units/skip-invalid.js | 8 +- test/core/units/snippet.js | 24 +- test/core/units/sort-keys.js | 12 +- test/core/units/tagmultikind.js | 8 +- 112 files changed, 772 insertions(+), 804 deletions(-) diff --git a/bin/js-yaml.js b/bin/js-yaml.js index 9a74da59..4adc9322 100755 --- a/bin/js-yaml.js +++ b/bin/js-yaml.js @@ -2,13 +2,13 @@ 'use strict' -var fs = require('fs') -var argparse = require('argparse') -var yaml = require('..') +const fs = require('fs') +const argparse = require('argparse') +const yaml = require('..') /// ///////////////////////////////////////////////////////////////////////////// -var cli = new argparse.ArgumentParser({ +const cli = new argparse.ArgumentParser({ prog: 'js-yaml', add_help: true }) @@ -44,7 +44,7 @@ cli.add_argument('file', { /// ///////////////////////////////////////////////////////////////////////////// -var options = cli.parse_args() +const options = cli.parse_args() /// ///////////////////////////////////////////////////////////////////////////// @@ -52,7 +52,7 @@ function readFile (filename, encoding, callback) { if (options.file === '-') { // read from stdin - var chunks = [] + const chunks = [] process.stdin.on('data', function (chunk) { chunks.push(chunk) @@ -67,7 +67,7 @@ function readFile (filename, encoding, callback) { } readFile(options.file, 'utf8', function (error, input) { - var output, isYaml + let output, isYaml if (error) { if (error.code === 'ENOENT') { diff --git a/eslint.config.mjs b/eslint.config.mjs index e642babc..0af9359d 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -13,9 +13,7 @@ export default [ { rules: { camelcase: 'off', - 'no-var': 'off', '@stylistic/key-spacing': 'off', - 'prefer-const': 'off', 'no-useless-escape': 'off', 'object-shorthand': 'off', } diff --git a/examples/custom_types.js b/examples/custom_types.js index a497bb21..7fc27538 100644 --- a/examples/custom_types.js +++ b/examples/custom_types.js @@ -1,9 +1,9 @@ 'use strict' -var fs = require('fs') -var path = require('path') -var util = require('util') -var yaml = require('../') +const fs = require('fs') +const path = require('path') +const util = require('util') +const yaml = require('../') // Let's define a couple of classes. @@ -29,7 +29,7 @@ function Space (height, width, points) { // Then define YAML types to load and dump our Point/Space objects. -var PointYamlType = new yaml.Type('!point', { +const PointYamlType = new yaml.Type('!point', { // Loader must parse sequence nodes only for this type (i.e. arrays in JS terminology). // Other available kinds are 'scalar' (string) and 'mapping' (object). // http://www.yaml.org/spec/1.2/spec.html#kind// @@ -57,7 +57,7 @@ var PointYamlType = new yaml.Type('!point', { } }) -var SpaceYamlType = new yaml.Type('!space', { +const SpaceYamlType = new yaml.Type('!space', { kind: 'mapping', construct: function (data) { data = data || {} // in case of empty node @@ -70,13 +70,13 @@ var SpaceYamlType = new yaml.Type('!space', { // After our types are defined, it's time to join them into a schema. -var SPACE_SCHEMA = yaml.DEFAULT_SCHEMA.extend([SpaceYamlType, PointYamlType]) +const SPACE_SCHEMA = yaml.DEFAULT_SCHEMA.extend([SpaceYamlType, PointYamlType]) // do not execute the following if file is required (http://stackoverflow.com/a/6398335) if (require.main === module) { // And read a document using that schema. fs.readFile(path.join(__dirname, 'custom_types.yml'), 'utf8', function (error, data) { - var loaded + let loaded if (!error) { loaded = yaml.load(data, { schema: SPACE_SCHEMA }) diff --git a/examples/dumper.js b/examples/dumper.js index aee5b73b..d3fa3af6 100644 --- a/examples/dumper.js +++ b/examples/dumper.js @@ -1,7 +1,7 @@ 'use strict' -var yaml = require('../') -var object = require('./dumper.json') +const yaml = require('../') +const object = require('./dumper.json') console.log(yaml.dump(object, { flowLevel: 3, diff --git a/examples/int_type_override.js b/examples/int_type_override.js index 423fd03d..caf06c9f 100644 --- a/examples/int_type_override.js +++ b/examples/int_type_override.js @@ -8,7 +8,7 @@ const util = require('util') const yaml = require('../') // keep most of the original `int` options as is -let options = Object.assign({}, yaml.types.int.options) +const options = Object.assign({}, yaml.types.int.options) options.construct = data => { let value = data @@ -35,7 +35,7 @@ options.predicate = object => { yaml.types.int.options.predicate(object) } -let BigIntType = new yaml.Type('tag:yaml.org,2002:int', options) +const BigIntType = new yaml.Type('tag:yaml.org,2002:int', options) const SCHEMA = yaml.DEFAULT_SCHEMA.extend({ implicit: [BigIntType] }) diff --git a/examples/sample_document.js b/examples/sample_document.js index dc002ead..23b93f3b 100644 --- a/examples/sample_document.js +++ b/examples/sample_document.js @@ -1,14 +1,14 @@ 'use strict' -var fs = require('fs') -var path = require('path') -var util = require('util') -var yaml = require('../') +const fs = require('fs') +const path = require('path') +const util = require('util') +const yaml = require('../') try { - var filename = path.join(__dirname, 'sample_document.yml') - var contents = fs.readFileSync(filename, 'utf8') - var data = yaml.load(contents) + const filename = path.join(__dirname, 'sample_document.yml') + const contents = fs.readFileSync(filename, 'utf8') + const data = yaml.load(contents) console.log(util.inspect(data, false, 10, true)) } catch (err) { diff --git a/index.js b/index.js index db5c29fa..3d5d4142 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict' -var loader = require('./lib/loader') -var dumper = require('./lib/dumper') +const loader = require('./lib/loader') +const dumper = require('./lib/dumper') function renamed (from, to) { return function () { diff --git a/lib/common.js b/lib/common.js index 97ec9796..a362694e 100644 --- a/lib/common.js +++ b/lib/common.js @@ -16,7 +16,7 @@ function toArray (sequence) { } function extend (target, source) { - var index, length, key, sourceKeys + let index, length, key, sourceKeys if (source) { sourceKeys = Object.keys(source) @@ -31,8 +31,8 @@ function extend (target, source) { } function repeat (string, count) { - var result = '' - var cycle + let result = '' + let cycle for (cycle = 0; cycle < count; cycle += 1) { result += string diff --git a/lib/dumper.js b/lib/dumper.js index de0244d2..80887fd2 100644 --- a/lib/dumper.js +++ b/lib/dumper.js @@ -1,39 +1,39 @@ 'use strict' -var common = require('./common') -var YAMLException = require('./exception') -var DEFAULT_SCHEMA = require('./schema/default') - -var _toString = Object.prototype.toString -var _hasOwnProperty = Object.prototype.hasOwnProperty - -var CHAR_BOM = 0xFEFF -var CHAR_TAB = 0x09 /* Tab */ -var CHAR_LINE_FEED = 0x0A /* LF */ -var CHAR_CARRIAGE_RETURN = 0x0D /* CR */ -var CHAR_SPACE = 0x20 /* Space */ -var CHAR_EXCLAMATION = 0x21 /* ! */ -var CHAR_DOUBLE_QUOTE = 0x22 /* " */ -var CHAR_SHARP = 0x23 /* # */ -var CHAR_PERCENT = 0x25 /* % */ -var CHAR_AMPERSAND = 0x26 /* & */ -var CHAR_SINGLE_QUOTE = 0x27 /* ' */ -var CHAR_ASTERISK = 0x2A /* * */ -var CHAR_COMMA = 0x2C /* , */ -var CHAR_MINUS = 0x2D /* - */ -var CHAR_COLON = 0x3A /* : */ -var CHAR_EQUALS = 0x3D /* = */ -var CHAR_GREATER_THAN = 0x3E /* > */ -var CHAR_QUESTION = 0x3F /* ? */ -var CHAR_COMMERCIAL_AT = 0x40 /* @ */ -var CHAR_LEFT_SQUARE_BRACKET = 0x5B /* [ */ -var CHAR_RIGHT_SQUARE_BRACKET = 0x5D /* ] */ -var CHAR_GRAVE_ACCENT = 0x60 /* ` */ -var CHAR_LEFT_CURLY_BRACKET = 0x7B /* { */ -var CHAR_VERTICAL_LINE = 0x7C /* | */ -var CHAR_RIGHT_CURLY_BRACKET = 0x7D /* } */ - -var ESCAPE_SEQUENCES = {} +const common = require('./common') +const YAMLException = require('./exception') +const DEFAULT_SCHEMA = require('./schema/default') + +const _toString = Object.prototype.toString +const _hasOwnProperty = Object.prototype.hasOwnProperty + +const CHAR_BOM = 0xFEFF +const CHAR_TAB = 0x09 /* Tab */ +const CHAR_LINE_FEED = 0x0A /* LF */ +const CHAR_CARRIAGE_RETURN = 0x0D /* CR */ +const CHAR_SPACE = 0x20 /* Space */ +const CHAR_EXCLAMATION = 0x21 /* ! */ +const CHAR_DOUBLE_QUOTE = 0x22 /* " */ +const CHAR_SHARP = 0x23 /* # */ +const CHAR_PERCENT = 0x25 /* % */ +const CHAR_AMPERSAND = 0x26 /* & */ +const CHAR_SINGLE_QUOTE = 0x27 /* ' */ +const CHAR_ASTERISK = 0x2A /* * */ +const CHAR_COMMA = 0x2C /* , */ +const CHAR_MINUS = 0x2D /* - */ +const CHAR_COLON = 0x3A /* : */ +const CHAR_EQUALS = 0x3D /* = */ +const CHAR_GREATER_THAN = 0x3E /* > */ +const CHAR_QUESTION = 0x3F /* ? */ +const CHAR_COMMERCIAL_AT = 0x40 /* @ */ +const CHAR_LEFT_SQUARE_BRACKET = 0x5B /* [ */ +const CHAR_RIGHT_SQUARE_BRACKET = 0x5D /* ] */ +const CHAR_GRAVE_ACCENT = 0x60 /* ` */ +const CHAR_LEFT_CURLY_BRACKET = 0x7B /* { */ +const CHAR_VERTICAL_LINE = 0x7C /* | */ +const CHAR_RIGHT_CURLY_BRACKET = 0x7D /* } */ + +const ESCAPE_SEQUENCES = {} ESCAPE_SEQUENCES[0x00] = '\\0' ESCAPE_SEQUENCES[0x07] = '\\a' @@ -51,20 +51,20 @@ ESCAPE_SEQUENCES[0xA0] = '\\_' ESCAPE_SEQUENCES[0x2028] = '\\L' ESCAPE_SEQUENCES[0x2029] = '\\P' -var DEPRECATED_BOOLEANS_SYNTAX = [ +const DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' ] -var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/ +const DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/ function compileStyleMap (schema, map) { - var result, keys, index, length, tag, style, type + let index, length, tag, style, type if (map === null) return {} - result = {} - keys = Object.keys(map) + const result = {} + const keys = Object.keys(map) for (index = 0, length = keys.length; index < length; index += 1) { tag = keys[index] @@ -86,9 +86,9 @@ function compileStyleMap (schema, map) { } function encodeHex (character) { - var string, handle, length + let handle, length - string = character.toString(16).toUpperCase() + const string = character.toString(16).toUpperCase() if (character <= 0xFF) { handle = 'x' @@ -106,8 +106,8 @@ function encodeHex (character) { return '\\' + handle + common.repeat('0', length - string.length) + string } -var QUOTING_TYPE_SINGLE = 1 -var QUOTING_TYPE_DOUBLE = 2 +const QUOTING_TYPE_SINGLE = 1 +const QUOTING_TYPE_DOUBLE = 2 function State (options) { this.schema = options['schema'] || DEFAULT_SCHEMA @@ -137,12 +137,12 @@ function State (options) { // Indents every line in a string. Empty lines (\n only) are not indented. function indentString (string, spaces) { - var ind = common.repeat(' ', spaces) - var position = 0 - var next = -1 - var result = '' - var line - var length = string.length + const ind = common.repeat(' ', spaces) + let position = 0 + let next = -1 + let result = '' + let line + const length = string.length while (position < length) { next = string.indexOf('\n', position) @@ -167,7 +167,7 @@ function generateNextLine (state, level) { } function testImplicitResolving (state, str) { - var index, length, type + let index, length, type for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { type = state.implicitTypes[index] @@ -219,8 +219,8 @@ function isNsCharOrWhitespace (c) { // | ( /* An ns-char preceding */ “#” ) // | ( “:” /* Followed by an ns-plain-safe(c) */ ) function isPlainSafe (c, prev, inblock) { - var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c) - var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c) + const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c) + const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c) return ( ( // ns-plain-safe @@ -284,8 +284,8 @@ function isPlainSafeLast (c) { // Same as 'string'.codePointAt(pos), but works in older browsers. function codePointAt (string, pos) { - var first = string.charCodeAt(pos) - var second + const first = string.charCodeAt(pos) + let second if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) { second = string.charCodeAt(pos + 1) @@ -299,15 +299,15 @@ function codePointAt (string, pos) { // Determines whether block indentation indicator is required. function needIndentIndicator (string) { - var leadingSpaceRe = /^\n* / + const leadingSpaceRe = /^\n* / return leadingSpaceRe.test(string) } -var STYLE_PLAIN = 1 -var STYLE_SINGLE = 2 -var STYLE_LITERAL = 3 -var STYLE_FOLDED = 4 -var STYLE_DOUBLE = 5 +const STYLE_PLAIN = 1 +const STYLE_SINGLE = 2 +const STYLE_LITERAL = 3 +const STYLE_FOLDED = 4 +const STYLE_DOUBLE = 5 // Determines which scalar styles are possible and returns the preferred style. // lineWidth = -1 => no limit. @@ -318,14 +318,14 @@ var STYLE_DOUBLE = 5 // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1). function chooseScalarStyle (string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) { - var i - var char = 0 - var prevChar = null - var hasLineBreak = false - var hasFoldableLine = false // only checked if shouldTrackWidth - var shouldTrackWidth = lineWidth !== -1 - var previousLineBreak = -1 // count the first line correctly - var plain = isPlainSafeFirst(codePointAt(string, 0)) && + let i + let char = 0 + let prevChar = null + let hasLineBreak = false + let hasFoldableLine = false // only checked if shouldTrackWidth + const shouldTrackWidth = lineWidth !== -1 + let previousLineBreak = -1 // count the first line correctly + let plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1)) if (singleLineOnly || forceQuotes) { @@ -404,7 +404,7 @@ function writeScalar (state, string, level, iskey, inblock) { } } - var indent = state.indent * Math.max(1, level) // no 0-indent scalars + const indent = state.indent * Math.max(1, level) // no 0-indent scalars // As indentation gets deeper, let the width decrease monotonically // to the lower bound min(state.lineWidth, 40). // Note that this implies @@ -412,12 +412,12 @@ function writeScalar (state, string, level, iskey, inblock) { // state.lineWidth > 40 + state.indent: width decreases until the lower bound. // This behaves better than a constant minimum width which disallows narrower options, // or an indent threshold which causes the width to suddenly increase. - var lineWidth = (state.lineWidth === -1) + const lineWidth = (state.lineWidth === -1) ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent) // Without knowing if keys are implicit/explicit, assume implicit for safety. - var singleLineOnly = iskey || + const singleLineOnly = iskey || // No block styles in flow mode. (state.flowLevel > -1 && level >= state.flowLevel) function testAmbiguity (string) { @@ -446,12 +446,12 @@ function writeScalar (state, string, level, iskey, inblock) { // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9. function blockHeader (string, indentPerLevel) { - var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '' + const indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '' // note the special case: the string '\n' counts as a "trailing" empty line. - var clip = string[string.length - 1] === '\n' - var keep = clip && (string[string.length - 2] === '\n' || string === '\n') - var chomp = keep ? '+' : (clip ? '' : '-') + const clip = string[string.length - 1] === '\n' + const keep = clip && (string[string.length - 2] === '\n' || string === '\n') + const chomp = keep ? '+' : (clip ? '' : '-') return indentIndicator + chomp + '\n' } @@ -468,24 +468,24 @@ function foldString (string, width) { // unless they're before or after a more-indented line, or at the very // beginning or end, in which case $k$ maps to $k$. // Therefore, parse each chunk as newline(s) followed by a content line. - var lineRe = /(\n+)([^\n]*)/g + const lineRe = /(\n+)([^\n]*)/g // first line (possibly an empty line) - var result = (function () { - var nextLF = string.indexOf('\n') + let result = (function () { + let nextLF = string.indexOf('\n') nextLF = nextLF !== -1 ? nextLF : string.length lineRe.lastIndex = nextLF return foldLine(string.slice(0, nextLF), width) }()) // If we haven't reached the first content line yet, don't add an extra \n. - var prevMoreIndented = string[0] === '\n' || string[0] === ' ' - var moreIndented + let prevMoreIndented = string[0] === '\n' || string[0] === ' ' + let moreIndented // rest of the lines - var match + let match while ((match = lineRe.exec(string))) { - var prefix = match[1] - var line = match[2] + const prefix = match[1] + const line = match[2] moreIndented = (line[0] === ' ') result += prefix + @@ -505,14 +505,14 @@ function foldLine (line, width) { if (line === '' || line[0] === ' ') return line // Since a more-indented line adds a \n, breaks can't be followed by a space. - var breakRe = / [^ ]/g // note: the match index will always be <= length-2. - var match + const breakRe = / [^ ]/g // note: the match index will always be <= length-2. + let match // start is an inclusive index. end, curr, and next are exclusive. - var start = 0 - var end - var curr = 0 - var next = 0 - var result = '' + let start = 0 + let end + let curr = 0 + let next = 0 + let result = '' // Invariants: 0 <= start <= length-1. // 0 <= curr <= next <= max(0, length-2). curr - start <= width. @@ -545,11 +545,11 @@ function foldLine (line, width) { // Escapes a double-quoted string. function escapeString (string) { - var result = '' - var char = 0 - var escapeSeq + let result = '' + let char = 0 + let escapeSeq - for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { + for (let i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { char = codePointAt(string, i) escapeSeq = ESCAPE_SEQUENCES[char] @@ -565,11 +565,11 @@ function escapeString (string) { } function writeFlowSequence (state, level, object) { - var _result = '' - var _tag = state.tag - var index - var length - var value + let _result = '' + const _tag = state.tag + let index + let length + let value for (index = 0, length = object.length; index < length; index += 1) { value = object[index] @@ -592,11 +592,11 @@ function writeFlowSequence (state, level, object) { } function writeBlockSequence (state, level, object, compact) { - var _result = '' - var _tag = state.tag - var index - var length - var value + let _result = '' + const _tag = state.tag + let index + let length + let value for (index = 0, length = object.length; index < length; index += 1) { value = object[index] @@ -628,14 +628,14 @@ function writeBlockSequence (state, level, object, compact) { } function writeFlowMapping (state, level, object) { - var _result = '' - var _tag = state.tag - var objectKeyList = Object.keys(object) - var index - var length - var objectKey - var objectValue - var pairBuffer + let _result = '' + const _tag = state.tag + const objectKeyList = Object.keys(object) + let index + let length + let objectKey + let objectValue + let pairBuffer for (index = 0, length = objectKeyList.length; index < length; index += 1) { pairBuffer = '' @@ -673,15 +673,15 @@ function writeFlowMapping (state, level, object) { } function writeBlockMapping (state, level, object, compact) { - var _result = '' - var _tag = state.tag - var objectKeyList = Object.keys(object) - var index - var length - var objectKey - var objectValue - var explicitPair - var pairBuffer + let _result = '' + const _tag = state.tag + const objectKeyList = Object.keys(object) + let index + let length + let objectKey + let objectValue + let explicitPair + let pairBuffer // Allow sorting keys so that the output file is deterministic if (state.sortKeys === true) { @@ -751,9 +751,9 @@ function writeBlockMapping (state, level, object, compact) { } function detectType (state, object, explicit) { - var _result, typeList, index, length, type, style + let _result, index, length, type, style - typeList = explicit ? state.explicitTypes : state.implicitTypes + const typeList = explicit ? state.explicitTypes : state.implicitTypes for (index = 0, length = typeList.length; index < length; index += 1) { type = typeList[index] @@ -803,17 +803,17 @@ function writeNode (state, level, object, block, compact, iskey, isblockseq) { detectType(state, object, true) } - var type = _toString.call(state.dump) - var inblock = block - var tagStr + const type = _toString.call(state.dump) + const inblock = block + let tagStr if (block) { block = (state.flowLevel < 0 || state.flowLevel > level) } - var objectOrArray = type === '[object Object]' || type === '[object Array]' - var duplicateIndex - var duplicate + const objectOrArray = type === '[object Object]' || type === '[object Array]' + let duplicateIndex + let duplicate if (objectOrArray) { duplicateIndex = state.duplicates.indexOf(object) @@ -903,10 +903,10 @@ function writeNode (state, level, object, block, compact, iskey, isblockseq) { } function getDuplicateReferences (object, state) { - var objects = [] - var duplicatesIndexes = [] - var index - var length + const objects = [] + const duplicatesIndexes = [] + let index + let length inspectNode(object, objects, duplicatesIndexes) @@ -917,9 +917,9 @@ function getDuplicateReferences (object, state) { } function inspectNode (object, objects, duplicatesIndexes) { - var objectKeyList - var index - var length + let objectKeyList + let index + let length if (object !== null && typeof object === 'object') { index = objects.indexOf(object) @@ -948,11 +948,11 @@ function inspectNode (object, objects, duplicatesIndexes) { function dump (input, options) { options = options || {} - var state = new State(options) + const state = new State(options) if (!state.noRefs) getDuplicateReferences(input, state) - var value = input + let value = input if (state.replacer) { value = state.replacer.call({ '': value }, '', value) diff --git a/lib/exception.js b/lib/exception.js index 7c893855..8571562e 100644 --- a/lib/exception.js +++ b/lib/exception.js @@ -3,8 +3,8 @@ 'use strict' function formatError (exception, compact) { - var where = '' - var message = exception.reason || '(unknown reason)' + let where = '' + const message = exception.reason || '(unknown reason)' if (!exception.mark) return message diff --git a/lib/loader.js b/lib/loader.js index bc330732..ccd0d41c 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -1,27 +1,27 @@ 'use strict' -var common = require('./common') -var YAMLException = require('./exception') -var makeSnippet = require('./snippet') -var DEFAULT_SCHEMA = require('./schema/default') +const common = require('./common') +const YAMLException = require('./exception') +const makeSnippet = require('./snippet') +const DEFAULT_SCHEMA = require('./schema/default') -var _hasOwnProperty = Object.prototype.hasOwnProperty +const _hasOwnProperty = Object.prototype.hasOwnProperty -var CONTEXT_FLOW_IN = 1 -var CONTEXT_FLOW_OUT = 2 -var CONTEXT_BLOCK_IN = 3 -var CONTEXT_BLOCK_OUT = 4 +const CONTEXT_FLOW_IN = 1 +const CONTEXT_FLOW_OUT = 2 +const CONTEXT_BLOCK_IN = 3 +const CONTEXT_BLOCK_OUT = 4 -var CHOMPING_CLIP = 1 -var CHOMPING_STRIP = 2 -var CHOMPING_KEEP = 3 +const CHOMPING_CLIP = 1 +const CHOMPING_STRIP = 2 +const CHOMPING_KEEP = 3 // eslint-disable-next-line no-control-regex -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/ -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/ -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/ -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i +const PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/ +const PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/ +const PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/ +const PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i +const PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i function _class (obj) { return Object.prototype.toString.call(obj) } @@ -49,13 +49,11 @@ function is_FLOW_INDICATOR (c) { } function fromHexCode (c) { - var lc - if ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) { return c - 0x30 } - lc = c | 0x20 + const lc = c | 0x20 if ((lc >= 0x61/* a */) && (lc <= 0x66/* f */)) { return lc - 0x61 + 10 @@ -131,9 +129,9 @@ function setProperty (object, key, value) { } } -var simpleEscapeCheck = new Array(256) // integer, for fast access -var simpleEscapeMap = new Array(256) -for (var i = 0; i < 256; i++) { +const simpleEscapeCheck = new Array(256) // integer, for fast access +const simpleEscapeMap = new Array(256) +for (let i = 0; i < 256; i++) { simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0 simpleEscapeMap[i] = simpleEscapeSequence(i) } @@ -178,7 +176,7 @@ function State (input, options) { } function generateError (state, message) { - var mark = { + const mark = { name: state.filename, buffer: state.input.slice(0, -1), // omit trailing \0 position: state.position, @@ -201,11 +199,9 @@ function throwWarning (state, message) { } } -var directiveHandlers = { +const directiveHandlers = { YAML: function handleYamlDirective (state, name, args) { - var match, major, minor - if (state.version !== null) { throwError(state, 'duplication of %YAML directive') } @@ -214,14 +210,14 @@ var directiveHandlers = { throwError(state, 'YAML directive accepts exactly one argument') } - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]) + const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]) if (match === null) { throwError(state, 'ill-formed argument of the YAML directive') } - major = parseInt(match[1], 10) - minor = parseInt(match[2], 10) + const major = parseInt(match[1], 10) + const minor = parseInt(match[2], 10) if (major !== 1) { throwError(state, 'unacceptable YAML version of the document') @@ -236,13 +232,13 @@ var directiveHandlers = { }, TAG: function handleTagDirective (state, name, args) { - var handle, prefix + let prefix if (args.length !== 2) { throwError(state, 'TAG directive accepts exactly two arguments') } - handle = args[0] + const handle = args[0] prefix = args[1] if (!PATTERN_TAG_HANDLE.test(handle)) { @@ -268,7 +264,7 @@ var directiveHandlers = { } function captureSegment (state, start, end, checkJson) { - var _position, _length, _character, _result + let _position, _length, _character, _result if (start < end) { _result = state.input.slice(start, end) @@ -290,13 +286,13 @@ function captureSegment (state, start, end, checkJson) { } function mergeMappings (state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity + let key, index, quantity if (!common.isObject(source)) { throwError(state, 'cannot merge mappings; the provided source object is unacceptable') } - sourceKeys = Object.keys(source) + const sourceKeys = Object.keys(source) for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { key = sourceKeys[index] @@ -310,7 +306,7 @@ function mergeMappings (state, destination, source, overridableKeys) { function storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) { - var index, quantity + let index, quantity // The output is a plain object here, so keys can only be strings. // We need to convert keyNode to a string, but doing so can hang the process @@ -368,9 +364,7 @@ function storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, val } function readLineBreak (state) { - var ch - - ch = state.input.charCodeAt(state.position) + const ch = state.input.charCodeAt(state.position) if (ch === 0x0A/* LF */) { state.position++ @@ -389,8 +383,8 @@ function readLineBreak (state) { } function skipSeparationSpace (state, allowComments, checkIndent) { - var lineBreaks = 0 - var ch = state.input.charCodeAt(state.position) + let lineBreaks = 0 + let ch = state.input.charCodeAt(state.position) while (ch !== 0) { while (is_WHITE_SPACE(ch)) { @@ -430,8 +424,8 @@ function skipSeparationSpace (state, allowComments, checkIndent) { } function testDocumentSeparator (state) { - var _position = state.position - var ch + let _position = state.position + let ch ch = state.input.charCodeAt(_position) @@ -461,17 +455,17 @@ function writeFoldedLines (state, count) { } function readPlainScalar (state, nodeIndent, withinFlowCollection) { - var preceding - var following - var captureStart - var captureEnd - var hasPendingContent - var _line - var _lineStart - var _lineIndent - var _kind = state.kind - var _result = state.result - var ch + let preceding + let following + let captureStart + let captureEnd + let hasPendingContent + let _line + let _lineStart + let _lineIndent + const _kind = state.kind + const _result = state.result + let ch ch = state.input.charCodeAt(state.position) @@ -567,9 +561,9 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { } function readSingleQuotedScalar (state, nodeIndent) { - var ch - var captureStart - var captureEnd + let ch + let captureStart + let captureEnd ch = state.input.charCodeAt(state.position) @@ -610,12 +604,12 @@ function readSingleQuotedScalar (state, nodeIndent) { } function readDoubleQuotedScalar (state, nodeIndent) { - var captureStart - var captureEnd - var hexLength - var hexResult - var tmp - var ch + let captureStart + let captureEnd + let hexLength + let hexResult + let tmp + let ch ch = state.input.charCodeAt(state.position) @@ -682,23 +676,23 @@ function readDoubleQuotedScalar (state, nodeIndent) { } function readFlowCollection (state, nodeIndent) { - var readNext = true - var _line - var _lineStart - var _pos - var _tag = state.tag - var _result - var _anchor = state.anchor - var following - var terminator - var isPair - var isExplicitPair - var isMapping - var overridableKeys = Object.create(null) - var keyNode - var keyTag - var valueNode - var ch + let readNext = true + let _line + let _lineStart + let _pos + const _tag = state.tag + let _result + const _anchor = state.anchor + let following + let terminator + let isPair + let isExplicitPair + let isMapping + const overridableKeys = Object.create(null) + let keyNode + let keyTag + let valueNode + let ch ch = state.input.charCodeAt(state.position) @@ -794,16 +788,16 @@ function readFlowCollection (state, nodeIndent) { } function readBlockScalar (state, nodeIndent) { - var captureStart - var folding - var chomping = CHOMPING_CLIP - var didReadContent = false - var detectedIndent = false - var textIndent = nodeIndent - var emptyLines = 0 - var atMoreIndented = false - var tmp - var ch + let captureStart + let folding + let chomping = CHOMPING_CLIP + let didReadContent = false + let detectedIndent = false + let textIndent = nodeIndent + let emptyLines = 0 + let atMoreIndented = false + let tmp + let ch ch = state.input.charCodeAt(state.position) @@ -934,13 +928,13 @@ function readBlockScalar (state, nodeIndent) { } function readBlockSequence (state, nodeIndent) { - var _line - var _tag = state.tag - var _anchor = state.anchor - var _result = [] - var following - var detected = false - var ch + let _line + const _tag = state.tag + const _anchor = state.anchor + const _result = [] + let following + let detected = false + let ch // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar @@ -1004,22 +998,22 @@ function readBlockSequence (state, nodeIndent) { } function readBlockMapping (state, nodeIndent, flowIndent) { - var following - var allowCompact - var _line - var _keyLine - var _keyLineStart - var _keyPos - var _tag = state.tag - var _anchor = state.anchor - var _result = {} - var overridableKeys = Object.create(null) - var keyTag = null - var keyNode = null - var valueNode = null - var atExplicitKey = false - var detected = false - var ch + let following + let allowCompact + let _line + let _keyLine + let _keyLineStart + let _keyPos + const _tag = state.tag + const _anchor = state.anchor + const _result = {} + const overridableKeys = Object.create(null) + let keyTag = null + let keyNode = null + let valueNode = null + let atExplicitKey = false + let detected = false + let ch // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar @@ -1174,12 +1168,12 @@ function readBlockMapping (state, nodeIndent, flowIndent) { } function readTagProperty (state) { - var _position - var isVerbatim = false - var isNamed = false - var tagHandle - var tagName - var ch + let _position + let isVerbatim = false + let isNamed = false + let tagHandle + let tagName + let ch ch = state.input.charCodeAt(state.position) @@ -1267,8 +1261,7 @@ function readTagProperty (state) { } function readAnchorProperty (state) { - var _position - var ch + let ch ch = state.input.charCodeAt(state.position) @@ -1279,7 +1272,7 @@ function readAnchorProperty (state) { } ch = state.input.charCodeAt(++state.position) - _position = state.position + const _position = state.position while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state.input.charCodeAt(++state.position) @@ -1294,16 +1287,14 @@ function readAnchorProperty (state) { } function readAlias (state) { - var _position - var alias - var ch + let ch ch = state.input.charCodeAt(state.position) if (ch !== 0x2A/* * */) return false ch = state.input.charCodeAt(++state.position) - _position = state.position + const _position = state.position while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state.input.charCodeAt(++state.position) @@ -1313,7 +1304,7 @@ function readAlias (state) { throwError(state, 'name of an alias node must contain at least one character') } - alias = state.input.slice(_position, state.position) + const alias = state.input.slice(_position, state.position) if (!_hasOwnProperty.call(state.anchorMap, alias)) { throwError(state, 'unidentified alias "' + alias + '"') @@ -1325,18 +1316,17 @@ function readAlias (state) { } function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles - var allowBlockScalars - var allowBlockCollections - var indentStatus = 1 // 1: this>parent, 0: this=parent, -1: thisparent, 0: this=parent, -1: this maxHalfLength) { head = ' ... ' @@ -38,11 +38,11 @@ function makeSnippet (mark, options) { if (typeof options.linesBefore !== 'number') options.linesBefore = 3 if (typeof options.linesAfter !== 'number') options.linesAfter = 2 - var re = /\r?\n|\r|\0/g - var lineStarts = [0] - var lineEnds = [] - var match - var foundLineNo = -1 + const re = /\r?\n|\r|\0/g + const lineStarts = [0] + const lineEnds = [] + let match + let foundLineNo = -1 while ((match = re.exec(mark.buffer))) { lineEnds.push(match.index) @@ -55,11 +55,11 @@ function makeSnippet (mark, options) { if (foundLineNo < 0) foundLineNo = lineStarts.length - 1 - var result = '' - var i - var line - var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length - var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3) + let result = '' + let i + let line + const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length + const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3) for (i = 1; i <= options.linesBefore; i++) { if (foundLineNo - i < 0) break diff --git a/lib/type.js b/lib/type.js index 55e491a8..8ec3dbed 100644 --- a/lib/type.js +++ b/lib/type.js @@ -1,8 +1,8 @@ 'use strict' -var YAMLException = require('./exception') +const YAMLException = require('./exception') -var TYPE_CONSTRUCTOR_OPTIONS = [ +const TYPE_CONSTRUCTOR_OPTIONS = [ 'kind', 'multi', 'resolve', @@ -15,14 +15,14 @@ var TYPE_CONSTRUCTOR_OPTIONS = [ 'styleAliases' ] -var YAML_NODE_KINDS = [ +const YAML_NODE_KINDS = [ 'scalar', 'sequence', 'mapping' ] function compileStyleAliases (map) { - var result = {} + const result = {} if (map !== null) { Object.keys(map).forEach(function (style) { diff --git a/lib/type/binary.js b/lib/type/binary.js index 88857326..cd59c09e 100644 --- a/lib/type/binary.js +++ b/lib/type/binary.js @@ -1,18 +1,18 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') // [ 64, 65, 66 ] -> [ padding, CR, LF ] -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r' +const BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r' function resolveYamlBinary (data) { if (data === null) return false - var code - var idx - var bitlen = 0 - var max = data.length - var map = BASE64_MAP + let code + let idx + let bitlen = 0 + const max = data.length + const map = BASE64_MAP // Convert one by one. for (idx = 0; idx < max; idx++) { @@ -32,12 +32,12 @@ function resolveYamlBinary (data) { } function constructYamlBinary (data) { - var idx; var tailbits - var input = data.replace(/[\r\n=]/g, '') // remove CR/LF & padding to simplify scan - var max = input.length - var map = BASE64_MAP - var bits = 0 - var result = [] + let idx + const input = data.replace(/[\r\n=]/g, '') // remove CR/LF & padding to simplify scan + const max = input.length + const map = BASE64_MAP + let bits = 0 + const result = [] // Collect by 6*4 bits (3 bytes) @@ -53,7 +53,7 @@ function constructYamlBinary (data) { // Dump tail - tailbits = (max % 4) * 6 + const tailbits = (max % 4) * 6 if (tailbits === 0) { result.push((bits >> 16) & 0xFF) @@ -70,12 +70,11 @@ function constructYamlBinary (data) { } function representYamlBinary (object /*, style */) { - var result = '' - var bits = 0 - var idx - var tail - var max = object.length - var map = BASE64_MAP + let result = '' + let bits = 0 + let idx + const max = object.length + const map = BASE64_MAP // Convert every three bytes to 4 ASCII characters. @@ -92,7 +91,7 @@ function representYamlBinary (object /*, style */) { // Dump tail - tail = max % 3 + const tail = max % 3 if (tail === 0) { result += map[(bits >> 18) & 0x3F] diff --git a/lib/type/bool.js b/lib/type/bool.js index bac7a46d..ba3d44f8 100644 --- a/lib/type/bool.js +++ b/lib/type/bool.js @@ -1,11 +1,11 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') function resolveYamlBoolean (data) { if (data === null) return false - var max = data.length + const max = data.length return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')) diff --git a/lib/type/float.js b/lib/type/float.js index 66e5f857..66e11f53 100644 --- a/lib/type/float.js +++ b/lib/type/float.js @@ -1,9 +1,9 @@ 'use strict' -var common = require('../common') -var Type = require('../type') +const common = require('../common') +const Type = require('../type') -var YAML_FLOAT_PATTERN = new RegExp( +const YAML_FLOAT_PATTERN = new RegExp( // 2.5e4, 2.5 and integers '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + // .2e4, .2 @@ -28,10 +28,10 @@ function resolveYamlFloat (data) { } function constructYamlFloat (data) { - var value, sign + let value value = data.replace(/_/g, '').toLowerCase() - sign = value[0] === '-' ? -1 : 1 + const sign = value[0] === '-' ? -1 : 1 if ('+-'.indexOf(value[0]) >= 0) { value = value.slice(1) @@ -45,11 +45,9 @@ function constructYamlFloat (data) { return sign * parseFloat(value, 10) } -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/ +const SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/ function representYamlFloat (object, style) { - var res - if (isNaN(object)) { switch (style) { case 'lowercase': return '.nan' @@ -72,7 +70,7 @@ function representYamlFloat (object, style) { return '-0.0' } - res = object.toString(10) + const res = object.toString(10) // JS stringifier can build scientific format without dots: 5e-100, // while YAML requres dot: 5.e-100. Fix it with simple hack diff --git a/lib/type/int.js b/lib/type/int.js index a589bb9b..48575d19 100644 --- a/lib/type/int.js +++ b/lib/type/int.js @@ -1,7 +1,7 @@ 'use strict' -var common = require('../common') -var Type = require('../type') +const common = require('../common') +const Type = require('../type') function isHexCode (c) { return ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) || @@ -20,10 +20,10 @@ function isDecCode (c) { function resolveYamlInteger (data) { if (data === null) return false - var max = data.length - var index = 0 - var hasDigits = false - var ch + const max = data.length + let index = 0 + let hasDigits = false + let ch if (!max) return false @@ -102,9 +102,9 @@ function resolveYamlInteger (data) { } function constructYamlInteger (data) { - var value = data - var sign = 1 - var ch + let value = data + let sign = 1 + let ch if (value.indexOf('_') !== -1) { value = value.replace(/_/g, '') diff --git a/lib/type/map.js b/lib/type/map.js index 5be7c724..aa278741 100644 --- a/lib/type/map.js +++ b/lib/type/map.js @@ -1,6 +1,6 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') module.exports = new Type('tag:yaml.org,2002:map', { kind: 'mapping', diff --git a/lib/type/merge.js b/lib/type/merge.js index b42b81d9..5781ff53 100644 --- a/lib/type/merge.js +++ b/lib/type/merge.js @@ -1,6 +1,6 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') function resolveYamlMerge (data) { return data === '<<' || data === null diff --git a/lib/type/null.js b/lib/type/null.js index b3cff868..cbae3bdc 100644 --- a/lib/type/null.js +++ b/lib/type/null.js @@ -1,11 +1,11 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') function resolveYamlNull (data) { if (data === null) return true - var max = data.length + const max = data.length return (max === 1 && data === '~') || (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL')) diff --git a/lib/type/omap.js b/lib/type/omap.js index f5dde865..1dc946d2 100644 --- a/lib/type/omap.js +++ b/lib/type/omap.js @@ -1,19 +1,19 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') -var _hasOwnProperty = Object.prototype.hasOwnProperty -var _toString = Object.prototype.toString +const _hasOwnProperty = Object.prototype.hasOwnProperty +const _toString = Object.prototype.toString function resolveYamlOmap (data) { if (data === null) return true - var objectKeys = [] - var index; var length - var pair - var pairKey - var pairHasKey - var object = data + const objectKeys = [] + let index; let length + let pair + let pairKey + let pairHasKey + const object = data for (index = 0, length = object.length; index < length; index += 1) { pair = object[index] diff --git a/lib/type/pairs.js b/lib/type/pairs.js index a1fbbe90..11a2faba 100644 --- a/lib/type/pairs.js +++ b/lib/type/pairs.js @@ -1,20 +1,19 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') -var _toString = Object.prototype.toString +const _toString = Object.prototype.toString function resolveYamlPairs (data) { if (data === null) return true - var index - var length - var pair - var keys - var result - var object = data + let index + let length + let pair + let keys + const object = data - result = new Array(object.length) + const result = new Array(object.length) for (index = 0, length = object.length; index < length; index += 1) { pair = object[index] @@ -34,14 +33,12 @@ function resolveYamlPairs (data) { function constructYamlPairs (data) { if (data === null) return [] - var index - var length - var pair - var keys - var result - var object = data - - result = new Array(object.length) + let index + let length + let pair + let keys + const object = data + const result = new Array(object.length) for (index = 0, length = object.length; index < length; index += 1) { pair = object[index] diff --git a/lib/type/seq.js b/lib/type/seq.js index eeb72425..e85ab662 100644 --- a/lib/type/seq.js +++ b/lib/type/seq.js @@ -1,6 +1,6 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') module.exports = new Type('tag:yaml.org,2002:seq', { kind: 'sequence', diff --git a/lib/type/set.js b/lib/type/set.js index 84283c03..7a7c4d88 100644 --- a/lib/type/set.js +++ b/lib/type/set.js @@ -1,14 +1,14 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') -var _hasOwnProperty = Object.prototype.hasOwnProperty +const _hasOwnProperty = Object.prototype.hasOwnProperty function resolveYamlSet (data) { if (data === null) return true - var key - var object = data + let key + const object = data for (key in object) { if (_hasOwnProperty.call(object, key)) { diff --git a/lib/type/str.js b/lib/type/str.js index 128d90d7..072ef27f 100644 --- a/lib/type/str.js +++ b/lib/type/str.js @@ -1,6 +1,6 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') module.exports = new Type('tag:yaml.org,2002:str', { kind: 'scalar', diff --git a/lib/type/timestamp.js b/lib/type/timestamp.js index 8862029b..611c048d 100644 --- a/lib/type/timestamp.js +++ b/lib/type/timestamp.js @@ -1,13 +1,13 @@ 'use strict' -var Type = require('../type') +const Type = require('../type') -var YAML_DATE_REGEXP = new RegExp( +const YAML_DATE_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9])' + // [2] month '-([0-9][0-9])$') // [3] day -var YAML_TIMESTAMP_REGEXP = new RegExp( +const YAML_TIMESTAMP_REGEXP = new RegExp( '^([0-9][0-9][0-9][0-9])' + // [1] year '-([0-9][0-9]?)' + // [2] month '-([0-9][0-9]?)' + // [3] day @@ -27,18 +27,9 @@ function resolveYamlTimestamp (data) { } function constructYamlTimestamp (data) { - var match - var year - var month - var day - var hour - var minute - var second - var fraction = 0 - var delta = null - var tz_hour - var tz_minute - var date + let match + let fraction = 0 + let delta = null match = YAML_DATE_REGEXP.exec(data) if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data) @@ -47,9 +38,9 @@ function constructYamlTimestamp (data) { // match: [1] year [2] month [3] day - year = +(match[1]) - month = +(match[2]) - 1 // JS month starts with 0 - day = +(match[3]) + const year = +(match[1]) + const month = +(match[2]) - 1 // JS month starts with 0 + const day = +(match[3]) if (!match[4]) { // no hour return new Date(Date.UTC(year, month, day)) @@ -57,9 +48,9 @@ function constructYamlTimestamp (data) { // match: [4] hour [5] minute [6] second [7] fraction - hour = +(match[4]) - minute = +(match[5]) - second = +(match[6]) + const hour = +(match[4]) + const minute = +(match[5]) + const second = +(match[6]) if (match[7]) { fraction = match[7].slice(0, 3) @@ -72,13 +63,13 @@ function constructYamlTimestamp (data) { // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute if (match[9]) { - tz_hour = +(match[10]) - tz_minute = +(match[11] || 0) + const tz_hour = +(match[10]) + const tz_minute = +(match[11] || 0) delta = (tz_hour * 60 + tz_minute) * 60000 // delta in mili-seconds if (match[9] === '-') delta = -delta } - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)) + const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)) if (delta) date.setTime(date.getTime() - delta) diff --git a/support/demo_template/index.mjs b/support/demo_template/index.mjs index e028a82e..f10d8a2a 100644 --- a/support/demo_template/index.mjs +++ b/support/demo_template/index.mjs @@ -8,7 +8,7 @@ import 'codemirror/mode/yaml/yaml.js' import 'codemirror/mode/javascript/javascript.js' import './demo.css' -var source, result, permalink, clear +let source, result, permalink, clear function encodeBase64 (str) { return btoa(String.fromCharCode(...new TextEncoder().encode(str))) @@ -20,19 +20,19 @@ function decodeBase64 (str) { })) } -var SexyYamlType = new jsyaml.Type('!sexy', { +const SexyYamlType = new jsyaml.Type('!sexy', { kind: 'sequence', // See node kinds in YAML spec: http://www.yaml.org/spec/1.2/spec.html#kind// construct: function (data) { return data.map(function (string) { return 'sexy ' + string }) } }) -var SEXY_SCHEMA = jsyaml.DEFAULT_SCHEMA.extend([SexyYamlType]) +const SEXY_SCHEMA = jsyaml.DEFAULT_SCHEMA.extend([SexyYamlType]) function parse () { - var str, obj + let obj - str = source.getValue() + const str = source.getValue() permalink.href = '#yaml=' + encodeBase64(str) try { @@ -47,7 +47,7 @@ function parse () { } function updateSource () { - var yaml + let yaml if (location.hash && location.hash.toString().slice(0, 6) === '#yaml=') { yaml = decodeBase64(location.hash.slice(6)) @@ -66,7 +66,7 @@ window.onload = function () { lineNumbers: true }) - var timer + let timer source.on('change', function () { clearTimeout(timer) diff --git a/test/core/00-units.test.js b/test/core/00-units.test.js index 3e8ec88f..6dd30aad 100644 --- a/test/core/00-units.test.js +++ b/test/core/00-units.test.js @@ -2,11 +2,11 @@ const { describe } = require('node:test') -var path = require('path') -var fs = require('fs') +const path = require('path') +const fs = require('fs') describe('Units', function () { - var directory = path.resolve(__dirname, 'units') + const directory = path.resolve(__dirname, 'units') fs.readdirSync(directory).forEach(function (file) { if (path.extname(file) === '.js') { diff --git a/test/core/10-loader.test.js b/test/core/10-loader.test.js index 83928d5e..3a11ea3d 100644 --- a/test/core/10-loader.test.js +++ b/test/core/10-loader.test.js @@ -2,24 +2,24 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var path = require('path') -var fs = require('fs') -var yaml = require('js-yaml') +const assert = require('assert') +const path = require('path') +const fs = require('fs') +const yaml = require('js-yaml') -var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA +const TEST_SCHEMA = require('./support/schema').TEST_SCHEMA describe('Loader', function () { - var samplesDir = path.resolve(__dirname, 'samples-common') + const samplesDir = path.resolve(__dirname, 'samples-common') fs.readdirSync(samplesDir).forEach(function (jsFile) { if (path.extname(jsFile) !== '.js') return // continue - var yamlFile = path.resolve(samplesDir, path.basename(jsFile, '.js') + '.yml') + const yamlFile = path.resolve(samplesDir, path.basename(jsFile, '.js') + '.yml') it(path.basename(jsFile, '.js'), function () { - var expected = require(path.resolve(samplesDir, jsFile)) - var actual = [] + const expected = require(path.resolve(samplesDir, jsFile)) + let actual = [] yaml.loadAll(fs.readFileSync(yamlFile, { encoding: 'utf8' }), function (doc) { actual.push(doc) }, { filename: yamlFile, diff --git a/test/core/11-load-errors.test.js b/test/core/11-load-errors.test.js index 7afb533f..8d7ebd70 100644 --- a/test/core/11-load-errors.test.js +++ b/test/core/11-load-errors.test.js @@ -2,21 +2,21 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var path = require('path') -var fs = require('fs') -var yaml = require('js-yaml') +const assert = require('assert') +const path = require('path') +const fs = require('fs') +const yaml = require('js-yaml') -var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA +const TEST_SCHEMA = require('./support/schema').TEST_SCHEMA describe('Load errors', function () { - var samplesDir = path.resolve(__dirname, 'samples-load-errors') + const samplesDir = path.resolve(__dirname, 'samples-load-errors') fs.readdirSync(samplesDir).forEach(function (sampleName) { - var yamlFile = path.resolve(samplesDir, sampleName) + const yamlFile = path.resolve(samplesDir, sampleName) it(path.basename(sampleName, '.yml'), function () { - var yamlSource = fs.readFileSync(yamlFile, { encoding: 'utf8' }) + const yamlSource = fs.readFileSync(yamlFile, { encoding: 'utf8' }) assert.throws(function () { yaml.loadAll( diff --git a/test/core/20-dumper.test.js b/test/core/20-dumper.test.js index 81a5ad63..75b7dd4d 100644 --- a/test/core/20-dumper.test.js +++ b/test/core/20-dumper.test.js @@ -2,24 +2,24 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var path = require('path') -var fs = require('fs') -var yaml = require('js-yaml') +const assert = require('assert') +const path = require('path') +const fs = require('fs') +const yaml = require('js-yaml') -var TEST_SCHEMA = require('./support/schema').TEST_SCHEMA +const TEST_SCHEMA = require('./support/schema').TEST_SCHEMA describe('Dumper', function () { - var samplesDir = path.resolve(__dirname, 'samples-common') + const samplesDir = path.resolve(__dirname, 'samples-common') fs.readdirSync(samplesDir).forEach(function (jsFile) { if (path.extname(jsFile) !== '.js') return // continue it(path.basename(jsFile, '.js'), function () { - var sample = require(path.resolve(samplesDir, jsFile)) - var data = typeof sample === 'function' ? sample.expected : sample - var serialized = yaml.dump(data, { schema: TEST_SCHEMA }) - var deserialized = yaml.load(serialized, { schema: TEST_SCHEMA }) + const sample = require(path.resolve(samplesDir, jsFile)) + const data = typeof sample === 'function' ? sample.expected : sample + const serialized = yaml.dump(data, { schema: TEST_SCHEMA }) + const deserialized = yaml.load(serialized, { schema: TEST_SCHEMA }) if (typeof sample === 'function') { sample.call(this, deserialized) diff --git a/test/core/25-dumper-fuzzy.test.js b/test/core/25-dumper-fuzzy.test.js index 0d22f6f7..1739b358 100644 --- a/test/core/25-dumper-fuzzy.test.js +++ b/test/core/25-dumper-fuzzy.test.js @@ -2,20 +2,20 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var fc = require('fast-check') -var yaml = require('js-yaml') +const assert = require('assert') +const fc = require('fast-check') +const yaml = require('js-yaml') // Generate valid YAML instances for yaml.safeDump -var key = fc.string({ unit: fc.nat({ max: 0xffff }).map(n => String.fromCharCode(n)) }) -var values = [ +const key = fc.string({ unit: fc.nat({ max: 0xffff }).map(n => String.fromCharCode(n)) }) +const values = [ key, fc.boolean(), fc.integer(), fc.double(), fc.constantFrom(null, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ] -var yamlArbitrary = fc.object({ key: key, values: values }) +const yamlArbitrary = fc.object({ key: key, values: values }) // Generate valid options for yaml.safeDump configuration -var dumpOptionsArbitrary = fc.record({ +const dumpOptionsArbitrary = fc.record({ skipInvalid: fc.boolean(), sortKeys: fc.boolean(), noRefs: fc.boolean(), @@ -41,7 +41,7 @@ describe('Properties', function () { yamlArbitrary, dumpOptionsArbitrary, function (obj, dumpOptions) { - var yamlContent = yaml.dump(obj, dumpOptions) + const yamlContent = yaml.dump(obj, dumpOptions) assert.ok(typeof yamlContent === 'string') assert.deepStrictEqual(yaml.load(yamlContent), obj) })) diff --git a/test/core/30-issues.test.js b/test/core/30-issues.test.js index 31d8ef86..4ff041d7 100644 --- a/test/core/30-issues.test.js +++ b/test/core/30-issues.test.js @@ -2,11 +2,11 @@ const { describe } = require('node:test') -var path = require('path') -var fs = require('fs') +const path = require('path') +const fs = require('fs') describe('Issues', function () { - var issues = path.resolve(__dirname, 'issues') + const issues = path.resolve(__dirname, 'issues') fs.readdirSync(issues).forEach(function (file) { if (path.extname(file) === '.js') { diff --git a/test/core/issues/0008.js b/test/core/issues/0008.js index 54f75901..ac4fb3ad 100644 --- a/test/core/issues/0008.js +++ b/test/core/issues/0008.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Parse failed when no document start present', function () { assert.doesNotThrow(function () { diff --git a/test/core/issues/0017.js b/test/core/issues/0017.js index 39b8230c..6f0c102f 100644 --- a/test/core/issues/0017.js +++ b/test/core/issues/0017.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Non-specific "!" tags should resolve to !!str', function () { - var data = yaml.load(` + const data = yaml.load(` ! 12 `) diff --git a/test/core/issues/0019.js b/test/core/issues/0019.js index 7cbc4a36..6a087ba6 100644 --- a/test/core/issues/0019.js +++ b/test/core/issues/0019.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Timestamp parsing is one month off', function () { - var data = yaml.load(` + const data = yaml.load(` --- xmas: 2011-12-24 ... diff --git a/test/core/issues/0026.js b/test/core/issues/0026.js index c3485007..01236d31 100644 --- a/test/core/issues/0026.js +++ b/test/core/issues/0026.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should convert new line into white space', function () { - var data = yaml.load(` + const data = yaml.load(` test: > a b diff --git a/test/core/issues/0027.js b/test/core/issues/0027.js index 50be946e..f4b29092 100644 --- a/test/core/issues/0027.js +++ b/test/core/issues/0027.js @@ -2,8 +2,8 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') describe('Should load numbers in YAML 1.2 format', function () { it('should not parse base60', function () { @@ -38,7 +38,7 @@ describe('Should dump numbers in YAML 1.2 format', function () { }) it('should quote all potential numbers', function () { - var tests = '1:23 1:23.45 01234 0999 -01234 01234e4 01234.56 -01234.56 0x123 0o123' + const tests = '1:23 1:23.45 01234 0999 -01234 01234e4 01234.56 -01234.56 0x123 0o123' tests.split(' ').forEach(function (sample) { assert.strictEqual(yaml.dump(sample, { noCompatMode: false }), "'" + sample + "'\n") @@ -46,7 +46,7 @@ describe('Should dump numbers in YAML 1.2 format', function () { }) it('should not quote base60 in noCompatMode', function () { - var tests = '1:23 1:23.45' + const tests = '1:23 1:23.45' tests.split(' ').forEach(function (sample) { assert.strictEqual(yaml.dump(sample, { noCompatMode: true }), sample + '\n') diff --git a/test/core/issues/0033.js b/test/core/issues/0033.js index 7a227af9..0744e26a 100644 --- a/test/core/issues/0033.js +++ b/test/core/issues/0033.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('refactor compact variant of MarkedYAMLError.toString', function () { - var source = ` + const source = ` foo: {bar} baz ` diff --git a/test/core/issues/0046.js b/test/core/issues/0046.js index 61200b8d..c8541e5e 100644 --- a/test/core/issues/0046.js +++ b/test/core/issues/0046.js @@ -2,19 +2,17 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Timestamps are incorrectly parsed in local time', function () { - var src = ` + const src = ` date1: 2010-10-20T20:45:00Z date2: 2010-10-20T20:45:00+01:00 ` - var data = yaml.load(src) - var date1 - var date2 + const data = yaml.load(src) - date1 = data.date1 // date1: 2010-10-20T20:45:00Z + const date1 = data.date1 // date1: 2010-10-20T20:45:00Z assert.strictEqual(date1.getUTCFullYear(), 2010, 'year') assert.strictEqual(date1.getUTCMonth(), 9, 'month') assert.strictEqual(date1.getUTCDate(), 20, 'date') @@ -22,7 +20,7 @@ date2: 2010-10-20T20:45:00+01:00 assert.strictEqual(date1.getUTCMinutes(), 45) assert.strictEqual(date1.getUTCSeconds(), 0) - date2 = data.date2 // date2: 2010-10-20T20:45:00+0100 + const date2 = data.date2 // date2: 2010-10-20T20:45:00+0100 assert.strictEqual(date2.getUTCFullYear(), 2010, 'year') assert.strictEqual(date2.getUTCMonth(), 9, 'month') assert.strictEqual(date2.getUTCDate(), 20, 'date') diff --git a/test/core/issues/0054.js b/test/core/issues/0054.js index 592a65a5..56dcf74e 100644 --- a/test/core/issues/0054.js +++ b/test/core/issues/0054.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it("Incorrect utf-8 handling on require('file.yaml')", function () { - var data = yaml.load(` + const data = yaml.load(` - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу @@ -49,8 +49,8 @@ it("Incorrect utf-8 handling on require('file.yaml')", function () { - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу `) - var expected = '' - var index + let expected = '' + let index // // document is an array of 40 elements diff --git a/test/core/issues/0063.js b/test/core/issues/0063.js index 731cedc9..69cdc6eb 100644 --- a/test/core/issues/0063.js +++ b/test/core/issues/0063.js @@ -2,16 +2,16 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Invalid errors/warnings of invalid indentation on flow scalars', function () { - var sources = [ + const sources = [ 'text:\n hello\n world', // plain style "text:\n 'hello\n world'", // single-quoted style 'text:\n "hello\n world"' // double-quoted style ] - var expected = { text: 'hello world' } + const expected = { text: 'hello world' } assert.doesNotThrow(function () { yaml.load(sources[0]) }, 'Throws on plain style') assert.doesNotThrow(function () { yaml.load(sources[1]) }, 'Throws on single-quoted style') diff --git a/test/core/issues/0064.js b/test/core/issues/0064.js index b4ee4814..729ed56a 100644 --- a/test/core/issues/0064.js +++ b/test/core/issues/0064.js @@ -2,9 +2,9 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') -var readFileSync = require('fs').readFileSync +const assert = require('assert') +const yaml = require('js-yaml') +const readFileSync = require('fs').readFileSync it('Wrong error message when yaml file contains tabs', function () { assert.doesNotThrow( diff --git a/test/core/issues/0068.js b/test/core/issues/0068.js index 480fa805..9b7b714a 100644 --- a/test/core/issues/0068.js +++ b/test/core/issues/0068.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Prevent adding unnecessary space character to end of a line within block collections', function () { assert.strictEqual(yaml.dump({ data: ['foo', 'bar', 'baz'] }), 'data:\n - foo\n - bar\n - baz\n') diff --git a/test/core/issues/0085.js b/test/core/issues/0085.js index d8299b79..1cb0a7c2 100644 --- a/test/core/issues/0085.js +++ b/test/core/issues/0085.js @@ -2,17 +2,17 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') -var DEPRECATED_BOOLEANS_SYNTAX = [ +const DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' ] it('Dumper should take into account booleans syntax from YAML 1.0/1.1', function () { DEPRECATED_BOOLEANS_SYNTAX.forEach(function (string) { - var dump = yaml.dump(string).trim() + const dump = yaml.dump(string).trim() assert( ((dump === "'" + string + "'") || (dump === '"' + string + '"')), diff --git a/test/core/issues/0092.js b/test/core/issues/0092.js index e0cc872a..662c5ebc 100644 --- a/test/core/issues/0092.js +++ b/test/core/issues/0092.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Invalid parse error on whitespace between quoted scalar keys and ":" symbol in mappings', function () { assert.doesNotThrow(function () { diff --git a/test/core/issues/0093.js b/test/core/issues/0093.js index 2e7cf5be..564a1429 100644 --- a/test/core/issues/0093.js +++ b/test/core/issues/0093.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Unwanted line breaks in folded scalars', function () { - var data = yaml.load(` + const data = yaml.load(` first: > a b diff --git a/test/core/issues/0095.js b/test/core/issues/0095.js index 15d8f8fc..61823650 100644 --- a/test/core/issues/0095.js +++ b/test/core/issues/0095.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Empty block scalars loaded wrong', function () { assert.deepStrictEqual(yaml.load('a: |\nb: .'), { a: '', b: '.' }) diff --git a/test/core/issues/0108.js b/test/core/issues/0108.js index 65476851..a8a399c5 100644 --- a/test/core/issues/0108.js +++ b/test/core/issues/0108.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Literal scalars have an unwanted leading line break', function () { assert.strictEqual(yaml.load('|\n foobar\n'), 'foobar\n') diff --git a/test/core/issues/0110.js b/test/core/issues/0110.js index f5d209ed..b6eb838e 100644 --- a/test/core/issues/0110.js +++ b/test/core/issues/0110.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Circular and cross references', function () { - var source = { + const source = { a: { a: 1 }, b: [1, 2], c: {}, @@ -18,7 +18,7 @@ it('Circular and cross references', function () { source.d.push(source.d) source.d.push(source) - var obtained = yaml.load(yaml.dump(source)) + const obtained = yaml.load(yaml.dump(source)) assert.strictEqual(obtained.crossObject, obtained.a) assert.strictEqual(obtained.crossArray, obtained.b) diff --git a/test/core/issues/0112.js b/test/core/issues/0112.js index 0d7e61f5..28c8b6e4 100644 --- a/test/core/issues/0112.js +++ b/test/core/issues/0112.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Plain scalar "constructor" parsed as `null`', function () { assert.strictEqual(yaml.load('constructor'), 'constructor') diff --git a/test/core/issues/0117.js b/test/core/issues/0117.js index d0c1a156..32b763e8 100644 --- a/test/core/issues/0117.js +++ b/test/core/issues/0117.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Negative zero loses the sign after dump', function () { assert.strictEqual(yaml.dump(-0), '-0.0\n') diff --git a/test/core/issues/0144.js b/test/core/issues/0144.js index 0ed82974..5d9b741d 100644 --- a/test/core/issues/0144.js +++ b/test/core/issues/0144.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Infinite loop when attempting to parse multi-line scalar document that is not indented', function () { assert.strictEqual(yaml.load('--- |\nfoo\n'), 'foo\n') diff --git a/test/core/issues/0154.js b/test/core/issues/0154.js index bba6eb77..1d34079a 100644 --- a/test/core/issues/0154.js +++ b/test/core/issues/0154.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Indentation warning on empty lines within quoted scalars and flow collections', function () { assert.doesNotThrow(function () { yaml.load("- 'hello\n\n world'") }) diff --git a/test/core/issues/0155.js b/test/core/issues/0155.js index 688cd805..91ac6553 100644 --- a/test/core/issues/0155.js +++ b/test/core/issues/0155.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Named null', function () { assert.deepStrictEqual(yaml.load('---\ntest: !!null \nfoo: bar'), { test: null, foo: 'bar' }) diff --git a/test/core/issues/0156.js b/test/core/issues/0156.js index b591cdbb..d10c8e17 100644 --- a/test/core/issues/0156.js +++ b/test/core/issues/0156.js @@ -2,17 +2,17 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') function SuccessSignal () {} -var TestClassYaml = new yaml.Type('!test', { +const TestClassYaml = new yaml.Type('!test', { kind: 'scalar', resolve: function () { throw new SuccessSignal() } }) -var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([TestClassYaml]) +const TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([TestClassYaml]) it('Resolving of empty nodes are skipped in some cases', function () { assert.throws(function () { yaml.load('- foo: !test\n- bar: baz', { schema: TEST_SCHEMA }) }, SuccessSignal) diff --git a/test/core/issues/0160.js b/test/core/issues/0160.js index ad47750b..33da714e 100644 --- a/test/core/issues/0160.js +++ b/test/core/issues/0160.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Correct encoding of UTF-16 surrogate pairs', function () { assert.strictEqual(yaml.load('"\\U0001F431"'), '🐱') diff --git a/test/core/issues/0164.js b/test/core/issues/0164.js index 017480d2..5307595f 100644 --- a/test/core/issues/0164.js +++ b/test/core/issues/0164.js @@ -6,7 +6,7 @@ const assert = require('assert') const yaml = require('js-yaml') it('should define __proto__ as a value (not invoke setter)', function () { - let object = yaml.load('{ __proto__: {polluted: bar} }') + const object = yaml.load('{ __proto__: {polluted: bar} }') assert.strictEqual(({}).hasOwnProperty.call(yaml.load('{}'), '__proto__'), false) assert.strictEqual(({}).hasOwnProperty.call(object, '__proto__'), true) @@ -14,7 +14,7 @@ it('should define __proto__ as a value (not invoke setter)', function () { }) it('should merge __proto__ as a value with << operator', function () { - let object = yaml.load(` + const object = yaml.load(` payload: &ref polluted: bar diff --git a/test/core/issues/0194.js b/test/core/issues/0194.js index 2fa00333..4e89929e 100644 --- a/test/core/issues/0194.js +++ b/test/core/issues/0194.js @@ -2,19 +2,18 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Don\'t throw on warning', function () { - var src = ` + const src = ` foo: { bar: true } ` - var warnings = [] - var data + const warnings = [] - data = yaml.load(src) + const data = yaml.load(src) assert.deepStrictEqual(data, { foo: { bar: true } }) diff --git a/test/core/issues/0203.js b/test/core/issues/0203.js index 281eb8d9..61fec6ab 100644 --- a/test/core/issues/0203.js +++ b/test/core/issues/0203.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Don\'t throw on warning', function () { - var src = ` + const src = ` test: |- diff --git a/test/core/issues/0205.js b/test/core/issues/0205.js index 5d5b4a10..01967012 100644 --- a/test/core/issues/0205.js +++ b/test/core/issues/0205.js @@ -2,24 +2,24 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Duplicated objects within array', function () { - var obj = { test: 'canary' } - var arrayWithRefs = [obj, obj] + const obj = { test: 'canary' } + const arrayWithRefs = [obj, obj] - var obtained = yaml.load(yaml.dump(arrayWithRefs)) + const obtained = yaml.load(yaml.dump(arrayWithRefs)) assert.strictEqual(obtained[0].test, 'canary') assert.strictEqual(obtained[0], obtained[1]) }) it('Duplicated arrays within array', function () { - var array = [0, 1] - var arrayWithRefs = [array, array] + const array = [0, 1] + const arrayWithRefs = [array, array] - var obtained = yaml.load(yaml.dump(arrayWithRefs)) + const obtained = yaml.load(yaml.dump(arrayWithRefs)) assert.strictEqual(obtained[0][0], 0) assert.strictEqual(obtained[0][1], 1) diff --git a/test/core/issues/0220.js b/test/core/issues/0220.js index f4bb2a17..0d203214 100644 --- a/test/core/issues/0220.js +++ b/test/core/issues/0220.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Float type dumper should not miss dot', function () { assert.strictEqual(5e-100.toString(10), '5e-100') diff --git a/test/core/issues/0221.js b/test/core/issues/0221.js index 6f994f52..c4316d37 100644 --- a/test/core/issues/0221.js +++ b/test/core/issues/0221.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it.skip('Block scalar chomping does not work on zero indent', function () { assert.throws(function () { yaml.load('|-\nfoo\nbar') }, yaml.YAMLException) diff --git a/test/core/issues/0235.js b/test/core/issues/0235.js index e0c7450b..034541fb 100644 --- a/test/core/issues/0235.js +++ b/test/core/issues/0235.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Flow style does not dump with block literals.', function () { assert.strictEqual(yaml.dump({ a: '\n' }, { flowLevel: 0 }), '{a: "\\n"}\n') diff --git a/test/core/issues/0243.js b/test/core/issues/0243.js index cef57a07..9597e351 100644 --- a/test/core/issues/0243.js +++ b/test/core/issues/0243.js @@ -2,14 +2,14 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') -var readFileSync = require('fs').readFileSync +const assert = require('assert') +const yaml = require('js-yaml') +const readFileSync = require('fs').readFileSync describe('Duplicated mapping key errors throw at beginning of key', function () { it('on top level', function () { - var src = readFileSync(require('path').join(__dirname, '/0243-basic.yml'), 'utf8') - var lines = src.split('\n') + const src = readFileSync(require('path').join(__dirname, '/0243-basic.yml'), 'utf8') + const lines = src.split('\n') try { yaml.load(src) @@ -21,8 +21,8 @@ describe('Duplicated mapping key errors throw at beginning of key', function () }) it('inside of mapping values', function () { - var src = readFileSync(require('path').join(__dirname, '/0243-nested.yml'), 'utf8') - var lines = src.split('\n') + const src = readFileSync(require('path').join(__dirname, '/0243-nested.yml'), 'utf8') + const lines = src.split('\n') try { yaml.load(src) diff --git a/test/core/issues/0248-listener.js b/test/core/issues/0248-listener.js index 53804b12..3ba28f6c 100644 --- a/test/core/issues/0248-listener.js +++ b/test/core/issues/0248-listener.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Listener informed on a very simple scalar.', function () { - var history = [] + const history = [] function l (eventType, state) { history.push([eventType, state.position]) } @@ -24,14 +24,14 @@ it('Listener informed on a very simple scalar.', function () { }) it('Listener informed on a map with a list.', function () { - var history = [] + const history = [] function l (eventType, state) { history.push([eventType, state.position, state.result]) } yaml.load('{ a: 1, b: [ 0, xyz ] }', { listener: l }) - var i = -1 + let i = -1 assert.strictEqual(history[++i][0], 'open') // doc assert.strictEqual(history[++i][0], 'open') // map diff --git a/test/core/issues/0258.js b/test/core/issues/0258.js index 603973c0..287cd13d 100644 --- a/test/core/issues/0258.js +++ b/test/core/issues/0258.js @@ -6,7 +6,7 @@ const assert = require('assert') const yaml = require('js-yaml') it('should shorthand tags with !! whenever possible', function () { - let regexp = new yaml.Type('tag:yaml.org,2002:js/regexp', { + const regexp = new yaml.Type('tag:yaml.org,2002:js/regexp', { kind: 'scalar', resolve: () => true, construct: str => new RegExp(str), @@ -14,13 +14,13 @@ it('should shorthand tags with !! whenever possible', function () { represent: object => object.source }) - let schema = yaml.DEFAULT_SCHEMA.extend(regexp) + const schema = yaml.DEFAULT_SCHEMA.extend(regexp) - let source = 're: !!js/regexp .*\n' + const source = 're: !!js/regexp .*\n' - let object = yaml.load(source, { schema }) + const object = yaml.load(source, { schema }) assert(object.re instanceof RegExp) - let str = yaml.dump(object, { schema }) + const str = yaml.dump(object, { schema }) assert.strictEqual(str, source) }) diff --git a/test/core/issues/0266.js b/test/core/issues/0266.js index 319de8ff..2a007bd4 100644 --- a/test/core/issues/0266.js +++ b/test/core/issues/0266.js @@ -2,17 +2,17 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') -var DEPRECATED_BOOLEANS_SYNTAX = [ +const DEPRECATED_BOOLEANS_SYNTAX = [ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' ] it('Dumper should not take into account booleans syntax from YAML 1.0/1.1 in noCompatMode', function () { DEPRECATED_BOOLEANS_SYNTAX.forEach(function (string) { - var dump = yaml.dump(string, { noCompatMode: true }).trim() + const dump = yaml.dump(string, { noCompatMode: true }).trim() assert( (dump === string), diff --git a/test/core/issues/0303.js b/test/core/issues/0303.js index 28823272..ef0ffaab 100644 --- a/test/core/issues/0303.js +++ b/test/core/issues/0303.js @@ -2,12 +2,12 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Loader should not strip quotes before newlines', function () { - var with_space = yaml.load("'''foo'' '") - var with_newline = yaml.load("'''foo''\n'") + const with_space = yaml.load("'''foo'' '") + const with_newline = yaml.load("'''foo''\n'") assert.strictEqual(with_space, "'foo' ") assert.strictEqual(with_newline, "'foo' ") }) diff --git a/test/core/issues/0333.js b/test/core/issues/0333.js index b9f7d75e..122578a5 100644 --- a/test/core/issues/0333.js +++ b/test/core/issues/0333.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should allow cast integers as !!float', function () { - var data = yaml.load(` + const data = yaml.load(` negative: !!float -1 zero: !!float 0 positive: !!float 2.3e4 diff --git a/test/core/issues/0335.js b/test/core/issues/0335.js index 4777210f..e0082f2a 100644 --- a/test/core/issues/0335.js +++ b/test/core/issues/0335.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Don\'t throw on warning', function () { - var src = ` + const src = ` not_num_1: -_123 not_num_2: _123 not_num_3: 123_ diff --git a/test/core/issues/0342.js b/test/core/issues/0342.js index e145526c..3cf2c69c 100644 --- a/test/core/issues/0342.js +++ b/test/core/issues/0342.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') -var simpleArray = ['a', 'b'] -var arrayOfSimpleObj = [{ a: 1 }, { b: 2 }] -var arrayOfObj = [{ a: 1, b: 'abc' }, { c: 'def', d: 2 }] +const assert = require('assert') +const yaml = require('js-yaml') +const simpleArray = ['a', 'b'] +const arrayOfSimpleObj = [{ a: 1 }, { b: 2 }] +const arrayOfObj = [{ a: 1, b: 'abc' }, { c: 'def', d: 2 }] it('space should be added for array, regardless of indent', function () { assert.deepStrictEqual( diff --git a/test/core/issues/0346.js b/test/core/issues/0346.js index e447f5f2..5a0958f5 100644 --- a/test/core/issues/0346.js +++ b/test/core/issues/0346.js @@ -2,12 +2,12 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should not emit spaces in arrays in flow mode between entries using condenseFlow: true', function () { - var array = ['a', 'b'] - var dumpedArray = yaml.dump(array, { flowLevel: 0, indent: 0, condenseFlow: true }) + const array = ['a', 'b'] + const dumpedArray = yaml.dump(array, { flowLevel: 0, indent: 0, condenseFlow: true }) assert.strictEqual( dumpedArray, '[a,b]\n' @@ -16,8 +16,8 @@ it('should not emit spaces in arrays in flow mode between entries using condense }) it('should not emit spaces between key: value and quote keys using condenseFlow: true', function () { - var object = { a: { b: 'c', d: 'e' } } - var objectDump = yaml.dump(object, { flowLevel: 0, indent: 0, condenseFlow: true }) + const object = { a: { b: 'c', d: 'e' } } + const objectDump = yaml.dump(object, { flowLevel: 0, indent: 0, condenseFlow: true }) assert.strictEqual( objectDump, '{"a":{"b":c, "d":e}}\n' diff --git a/test/core/issues/0350.js b/test/core/issues/0350.js index c1c3a7c0..92457e2c 100644 --- a/test/core/issues/0350.js +++ b/test/core/issues/0350.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should return parse docs from loadAll', function () { - var data = yaml.loadAll(` + const data = yaml.loadAll(` --- a: 1 --- diff --git a/test/core/issues/0351.js b/test/core/issues/0351.js index eb954ab5..5ad7bad0 100644 --- a/test/core/issues/0351.js +++ b/test/core/issues/0351.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should include the error message in the error stack', function () { try { diff --git a/test/core/issues/0385.js b/test/core/issues/0385.js index 027e50bc..1ae22ddf 100644 --- a/test/core/issues/0385.js +++ b/test/core/issues/0385.js @@ -7,7 +7,7 @@ const yaml = require('js-yaml') describe('Multi tag', function () { it('should process multi tags', function () { - let tags = ['scalar', 'mapping', 'sequence'].map(kind => + const tags = ['scalar', 'mapping', 'sequence'].map(kind => new yaml.Type('!', { kind, multi: true, @@ -20,9 +20,9 @@ describe('Multi tag', function () { }) ) - let schema = yaml.DEFAULT_SCHEMA.extend(tags) + const schema = yaml.DEFAULT_SCHEMA.extend(tags) - let expected = [ + const expected = [ { kind: 'scalar', tag: '!t1', @@ -50,7 +50,7 @@ describe('Multi tag', function () { }) it('should process tags depending on prefix', function () { - let tags = ['!foo', '!bar', '!'].map(prefix => + const tags = ['!foo', '!bar', '!'].map(prefix => new yaml.Type(prefix, { kind: 'scalar', multi: true, @@ -75,9 +75,9 @@ describe('Multi tag', function () { }) ) - let schema = yaml.DEFAULT_SCHEMA.extend(tags) + const schema = yaml.DEFAULT_SCHEMA.extend(tags) - let expected = [ + const expected = [ { prefix: '!foo', tag: '!foo', value: '1' }, { prefix: '!foo', tag: '!foo2', value: '2' }, { single: true, value: '3' }, @@ -97,7 +97,7 @@ describe('Multi tag', function () { }) it('should dump multi types with custom tag', function () { - let tags = [ + const tags = [ new yaml.Type('!', { kind: 'scalar', multi: true, @@ -113,7 +113,7 @@ describe('Multi tag', function () { }) ] - let schema = yaml.DEFAULT_SCHEMA.extend(tags) + const schema = yaml.DEFAULT_SCHEMA.extend(tags) assert.strictEqual(yaml.dump({ test: { tag: 'foo', value: 'bar' } }, { schema: schema diff --git a/test/core/issues/0399.js b/test/core/issues/0399.js index f6295330..95566d43 100644 --- a/test/core/issues/0399.js +++ b/test/core/issues/0399.js @@ -2,12 +2,12 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should properly dump negative ints in different styles', function () { - var dump - var src = { integer: -100 } + let dump + const src = { integer: -100 } dump = yaml.dump(src, { styles: { '!!int': 'binary' } }) assert.deepStrictEqual(yaml.load(dump), src) diff --git a/test/core/issues/0403.js b/test/core/issues/0403.js index 1143c84f..dc88d05f 100644 --- a/test/core/issues/0403.js +++ b/test/core/issues/0403.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should properly dump leading newlines and spaces', function () { - var dump, src + let dump, src src = { str: '\n a\nb' } dump = yaml.dump(src) diff --git a/test/core/issues/0432.js b/test/core/issues/0432.js index 4904c88e..42d1b276 100644 --- a/test/core/issues/0432.js +++ b/test/core/issues/0432.js @@ -2,23 +2,23 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should indent arrays an extra level by default', function () { - var output = yaml.dump({ array: ['a', 'b'] }) - var expected = 'array:\n - a\n - b\n' + const output = yaml.dump({ array: ['a', 'b'] }) + const expected = 'array:\n - a\n - b\n' assert.strictEqual(output, expected) }) it('should not indent arrays an extra level when disabled', function () { - var output = yaml.dump({ array: ['a', 'b'] }, { noArrayIndent: true }) - var expected = 'array:\n- a\n- b\n' + const output = yaml.dump({ array: ['a', 'b'] }, { noArrayIndent: true }) + const expected = 'array:\n- a\n- b\n' assert.strictEqual(output, expected) }) it('should always indent nested arrays', function () { - var output = yaml.dump({ array: ['a', ['b', 'c'], 'd'] }, { noArrayIndent: true }) - var expected = 'array:\n- a\n- - b\n - c\n- d\n' + const output = yaml.dump({ array: ['a', ['b', 'c'], 'd'] }, { noArrayIndent: true }) + const expected = 'array:\n- a\n- - b\n - c\n- d\n' assert.strictEqual(output, expected) }) diff --git a/test/core/issues/0468.js b/test/core/issues/0468.js index 953f5122..7a397c93 100644 --- a/test/core/issues/0468.js +++ b/test/core/issues/0468.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('should not indent arrays an extra level when disabled', function () { - var output = yaml.dump( + const output = yaml.dump( [ { a: 'a_val', @@ -24,6 +24,6 @@ it('should not indent arrays an extra level when disabled', function () { ], { noArrayIndent: true } ) - var expected = '- a: a_val\n b: b_val\n- a: a2_val\n items:\n - a: a_a_val\n b: a_b_val\n' + const expected = '- a: a_val\n b: b_val\n- a: a2_val\n items:\n - a: a_a_val\n b: a_b_val\n' assert.strictEqual(output, expected) }) diff --git a/test/core/issues/0470.js b/test/core/issues/0470.js index 11af9542..97531768 100644 --- a/test/core/issues/0470.js +++ b/test/core/issues/0470.js @@ -2,11 +2,11 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Don\'t quote strings with : without need', function () { - var data = { + const data = { // no quotes needed 'http://example.com': 'http://example.com', // quotes required @@ -14,7 +14,7 @@ it('Don\'t quote strings with : without need', function () { 'foo:': 'foo:' } - var expected = ` + const expected = ` http://example.com: http://example.com 'foo: bar': 'foo: bar' 'foo:': 'foo:' diff --git a/test/core/issues/0475.js b/test/core/issues/0475.js index b48505f8..5794ce61 100644 --- a/test/core/issues/0475.js +++ b/test/core/issues/0475.js @@ -2,9 +2,9 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') -var readFileSync = require('fs').readFileSync +const assert = require('assert') +const yaml = require('js-yaml') +const readFileSync = require('fs').readFileSync it('Should not allow nested arrays in map keys (explicit syntax)', function () { try { diff --git a/test/core/issues/0519.js b/test/core/issues/0519.js index a2992d47..c16c89fb 100644 --- a/test/core/issues/0519.js +++ b/test/core/issues/0519.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Dumper should add quotes around equals sign', function () { // pyyaml fails with unquoted `=` diff --git a/test/core/issues/0521.js b/test/core/issues/0521.js index aeb1bf55..b3af669b 100644 --- a/test/core/issues/0521.js +++ b/test/core/issues/0521.js @@ -2,18 +2,18 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Don\'t quote strings with # without need', function () { - var required = ` + const required = ` http://example.com/page#anchor: no:quotes#required parameter#fallback: 'quotes #required' 'quotes: required': Visit [link](http://example.com/foo#bar) 'foo #bar': key is quoted `.replace(/^\n/, '') - var sample = { + const sample = { 'http://example.com/page#anchor': 'no:quotes#required', 'parameter#fallback': 'quotes #required', 'quotes: required': 'Visit [link](http://example.com/foo#bar)', @@ -27,7 +27,7 @@ parameter#fallback: 'quotes #required' }) it('Quote []{} in block-level scalars, but not in flow', function () { - var required = ` + const required = ` key1: a[]b key2: a{}b nested: @@ -36,7 +36,7 @@ nested: nested: {key1: 'a[]b', key2: 'a{}b', nested: {key1: 'a[]b', key2: 'a{}b'}} `.replace(/^\n/, '') - var sample = { + const sample = { key1: 'a[]b', key2: 'a{}b', nested: { diff --git a/test/core/issues/0525-1.js b/test/core/issues/0525-1.js index f0448984..c6ddac53 100644 --- a/test/core/issues/0525-1.js +++ b/test/core/issues/0525-1.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Should throw if there is a null-byte in input', function () { try { diff --git a/test/core/issues/0525-2.js b/test/core/issues/0525-2.js index a2fe906c..8950fd7b 100644 --- a/test/core/issues/0525-2.js +++ b/test/core/issues/0525-2.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Should check kind type when resolving ! tag', function () { try { diff --git a/test/core/issues/0570.js b/test/core/issues/0570.js index b01dcbcc..17c1bf07 100644 --- a/test/core/issues/0570.js +++ b/test/core/issues/0570.js @@ -7,9 +7,9 @@ const yaml = require('js-yaml') it('should dump null in different styles', function () { let dump - let src = { foo: null, bar: 1 } + const src = { foo: null, bar: 1 } - let tests = { + const tests = { lowercase: 'null', uppercase: 'NULL', camelcase: 'Null', @@ -17,7 +17,7 @@ it('should dump null in different styles', function () { empty: '' } - for (let [name, value] of Object.entries(tests)) { + for (const [name, value] of Object.entries(tests)) { dump = yaml.dump(src, { styles: { '!!null': name } }) assert.strictEqual(dump, 'foo: ' + value + '\nbar: 1\n') assert.deepStrictEqual(yaml.load(dump), src) diff --git a/test/core/issues/0571.js b/test/core/issues/0571.js index ad81a2a7..bbd06e58 100644 --- a/test/core/issues/0571.js +++ b/test/core/issues/0571.js @@ -6,7 +6,7 @@ const assert = require('assert') const yaml = require('js-yaml') describe('Undefined', function () { - let undef = new yaml.Type('!undefined', { + const undef = new yaml.Type('!undefined', { kind: 'scalar', resolve: () => true, construct: () => {}, @@ -14,7 +14,7 @@ describe('Undefined', function () { represent: () => '' }) - let undef_schema = yaml.DEFAULT_SCHEMA.extend(undef) + const undef_schema = yaml.DEFAULT_SCHEMA.extend(undef) it('Should replace undefined with null in collections', function () { let str diff --git a/test/core/issues/0576.js b/test/core/issues/0576.js index 2299f1b9..3137f4fb 100644 --- a/test/core/issues/0576.js +++ b/test/core/issues/0576.js @@ -6,11 +6,11 @@ const assert = require('assert') const yaml = require('js-yaml') describe('Custom tags', function () { - let tag_names = ['tag', '!tag', '!!tag', '!', 'tag*-!< >{\n}', '!tagαβγ'] - let encoded = ['!', '!tag', '!%21tag', '!%3C%21tag%3E', + const tag_names = ['tag', '!tag', '!!tag', '!', 'tag*-!< >{\n}', '!tagαβγ'] + const encoded = ['!', '!tag', '!%21tag', '!%3C%21tag%3E', '!', '!tag%CE%B1%CE%B2%CE%B3'] - let tags = tag_names.map(tag => + const tags = tag_names.map(tag => new yaml.Type(tag, { kind: 'scalar', resolve: () => true, @@ -20,7 +20,7 @@ describe('Custom tags', function () { }) ) - let schema = yaml.DEFAULT_SCHEMA.extend(tags) + const schema = yaml.DEFAULT_SCHEMA.extend(tags) it('Should dump tags with proper encoding', function () { tag_names.forEach(function (tag, idx) { diff --git a/test/core/issues/0586.js b/test/core/issues/0586.js index 44fd9723..12fb3ca4 100644 --- a/test/core/issues/0586.js +++ b/test/core/issues/0586.js @@ -19,14 +19,14 @@ it('Should allow custom formatting through implicit custom tags', function () { return result } - let CustomDumpType = new yaml.Type('!format', { + const CustomDumpType = new yaml.Type('!format', { kind: 'scalar', resolve: () => false, instanceOf: CustomDump, represent: d => d.represent() }) - let schema = yaml.DEFAULT_SCHEMA.extend({ implicit: [CustomDumpType] }) + const schema = yaml.DEFAULT_SCHEMA.extend({ implicit: [CustomDumpType] }) function replacer (key, value) { if (key === '') return value // top-level, don't change this @@ -35,7 +35,7 @@ it('Should allow custom formatting through implicit custom tags', function () { return value // default } - let result = CustomDump({ flow_choices : [1, 2], block_choices: [4, 5] }).represent().trim() + const result = CustomDump({ flow_choices : [1, 2], block_choices: [4, 5] }).represent().trim() assert.strictEqual(result, ` flow_choices: [1, 2] diff --git a/test/core/issues/0587.js b/test/core/issues/0587.js index 70939a1b..5ffa9134 100644 --- a/test/core/issues/0587.js +++ b/test/core/issues/0587.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Should not encode astral characters', function () { assert.strictEqual(yaml.dump('😃😊'), '😃😊\n') diff --git a/test/core/issues/0614.js b/test/core/issues/0614.js index c8f49f77..10915c52 100644 --- a/test/core/issues/0614.js +++ b/test/core/issues/0614.js @@ -8,7 +8,7 @@ const assert = require('assert') const yaml = require('js-yaml') it('Should allow int override', function () { - let options = Object.assign({}, yaml.types.int.options) + const options = Object.assign({}, yaml.types.int.options) options.construct = data => { let value = data @@ -30,7 +30,7 @@ it('Should allow int override', function () { return sign * BigInt(value) } - let BigIntType = new yaml.Type('tag:yaml.org,2002:int', options) + const BigIntType = new yaml.Type('tag:yaml.org,2002:int', options) const SCHEMA = yaml.DEFAULT_SCHEMA.extend({ implicit: [BigIntType] }) diff --git a/test/core/samples-common/construct-custom.js b/test/core/samples-common/construct-custom.js index 239a96c6..438392a9 100644 --- a/test/core/samples-common/construct-custom.js +++ b/test/core/samples-common/construct-custom.js @@ -1,9 +1,9 @@ 'use strict' -var assert = require('assert') -var schema = require('../support/schema') +const assert = require('assert') +const schema = require('../support/schema') -var expected = [ +const expected = [ new schema.Tag1({ x: 1 }), new schema.Tag1({ x: 1, y: 2, z: 3 }), new schema.Tag2({ x: 10 }), diff --git a/test/core/samples-common/construct-float.js b/test/core/samples-common/construct-float.js index 6e4773df..78caf28f 100644 --- a/test/core/samples-common/construct-float.js +++ b/test/core/samples-common/construct-float.js @@ -1,8 +1,8 @@ 'use strict' -var assert = require('assert') +const assert = require('assert') -var expected = { +const expected = { canonical: 685230.15, exponential: 685230.15, fixed: 685230.15, diff --git a/test/core/samples-common/construct-string-types.js b/test/core/samples-common/construct-string-types.js index 081d8992..a842572f 100644 --- a/test/core/samples-common/construct-string-types.js +++ b/test/core/samples-common/construct-string-types.js @@ -1,6 +1,6 @@ 'use strict' -var essay = 'a\n' + +const essay = 'a\n' + 'b\n' + '1sdf 2ar 3sdf 4sdf 5sdf 6sdf 7sdf 8sdf 9sdf 10asdf 11asdf ' + '12asdf 13asdf 14asdf 15df 16df long 17df 1890 1900 2000 ' + @@ -69,8 +69,8 @@ module.exports = { } // now indent the long multi really far -var obj = module.exports -var i +let obj = module.exports +let i for (i = 0; i < 5; i++) { obj.indent = {} diff --git a/test/core/samples-common/more-floats.js b/test/core/samples-common/more-floats.js index 6fa3d1b0..c85750ce 100644 --- a/test/core/samples-common/more-floats.js +++ b/test/core/samples-common/more-floats.js @@ -1,8 +1,8 @@ 'use strict' -var assert = require('assert') +const assert = require('assert') -var expected = [ +const expected = [ 0.0, 1.0, -1.0, diff --git a/test/core/support/schema.js b/test/core/support/schema.js index 21841fd0..f4bcf84f 100644 --- a/test/core/support/schema.js +++ b/test/core/support/schema.js @@ -1,7 +1,7 @@ 'use strict' -var util = require('util') -var yaml = require('js-yaml') +const util = require('util') +const yaml = require('js-yaml') function Tag1 (parameters) { this.x = parameters.x @@ -24,7 +24,7 @@ function Foo (parameters) { this.myAnotherParameter = parameters.myAnotherParameter } -var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ +const TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([ // NOTE: Type order matters! // Inherited classes must precede their parents because the dumper // doesn't inspect class inheritance and just picks first suitable diff --git a/test/core/units/alias-nodes.js b/test/core/units/alias-nodes.js index b3e49694..30150446 100644 --- a/test/core/units/alias-nodes.js +++ b/test/core/units/alias-nodes.js @@ -2,20 +2,20 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') function TestClass (data) { - var self = this + const self = this Object.keys(data).forEach(function (key) { self[key] = data[key] }) } -var TestClassYaml = new yaml.Type('!test', { +const TestClassYaml = new yaml.Type('!test', { kind: 'mapping', construct: function (data) { return new TestClass(data) } }) -var TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([TestClassYaml]) +const TEST_SCHEMA = yaml.DEFAULT_SCHEMA.extend([TestClassYaml]) describe('Alias nodes', function () { describe('Resolving of an alias node should result the resolved and contructed value of the anchored node', function () { @@ -32,14 +32,14 @@ describe('Alias nodes', function () { }) it('Recursive built-in objects', function () { - var actual = yaml.load('[&1 {self: *1}, *1]')[1] + const actual = yaml.load('[&1 {self: *1}, *1]')[1] assert(actual === actual.self) }) it('Simple custom objects', function () { - var expected = new TestClass({ a: 'b', c: 'd' }) - var actual = yaml.load('[&1 !test {a: b, c: d}, *1]', { schema: TEST_SCHEMA })[1] + const expected = new TestClass({ a: 'b', c: 'd' }) + const actual = yaml.load('[&1 !test {a: b, c: d}, *1]', { schema: TEST_SCHEMA })[1] assert(actual instanceof TestClass) assert.deepStrictEqual(actual, expected) @@ -47,7 +47,7 @@ describe('Alias nodes', function () { // TODO: Not implemented yet (see issue #141) it.skip('Recursive custom objects', function () { - var actual = yaml.load('[&1 !test {self: *1}, *1]', { schema: TEST_SCHEMA })[1] + const actual = yaml.load('[&1 !test {self: *1}, *1]', { schema: TEST_SCHEMA })[1] assert(actual instanceof TestClass) assert(actual.self instanceof TestClass) diff --git a/test/core/units/bom-strip.js b/test/core/units/bom-strip.js index 944d8731..79ce4f34 100644 --- a/test/core/units/bom-strip.js +++ b/test/core/units/bom-strip.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('BOM strip', function () { assert.deepStrictEqual(yaml.load('\uFEFFfoo: bar\n'), { foo: 'bar' }) diff --git a/test/core/units/character-set.js b/test/core/units/character-set.js index 8a118ab5..180063ca 100644 --- a/test/core/units/character-set.js +++ b/test/core/units/character-set.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Allow astral characters', function () { assert.deepStrictEqual(yaml.load('𝑘𝑒𝑦: 𝑣𝑎𝑙𝑢𝑒'), { '𝑘𝑒𝑦': '𝑣𝑎𝑙𝑢𝑒' }) diff --git a/test/core/units/dump-scalar-styles.js b/test/core/units/dump-scalar-styles.js index cb70259a..b0fc654a 100644 --- a/test/core/units/dump-scalar-styles.js +++ b/test/core/units/dump-scalar-styles.js @@ -2,8 +2,8 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') // Indents lines by 2 spaces. Empty lines (\n only) are not indented. function indent (string) { @@ -76,8 +76,8 @@ describe('Scalar style dump:', function () { }) describe('Literal style', function () { - var content = 'a\nb \n\n c\n d' - var indented = indent(content) + const content = 'a\nb \n\n c\n d' + const indented = indent(content) it('preserves trailing newlines using chomping', function () { assert.strictEqual(yaml.dump({ a: '\n', b: '\n\n', c: 'c\n', d: 'd\nd' }), @@ -111,17 +111,17 @@ describe('Scalar style dump:', function () { describe('Folded style', function () { (function () { - var content = (function () { - var result = '' - var i = 1000 - for (var para = 1; para <= 7; para++) { + const content = (function () { + let result = '' + let i = 1000 + for (let para = 1; para <= 7; para++) { result += '\n' // indent paragraphs 3 and 4 if (para === 3 || para === 4) { result += repeat(' ', para) } // vary the number of words on the last line - for (var count = 2 * (30 / 5) + para - 1; count > 0; count--) { + for (let count = 2 * (30 / 5) + para - 1; count > 0; count--) { result += i + ' ' if (i % 17 === 0) result += ' ' i++ @@ -129,7 +129,7 @@ describe('Scalar style dump:', function () { } return result }()) - var wrapped = '\n' + + const wrapped = '\n' + '1000 1001 1002 1003 1004 1005\n' + '1006 1007 1008 1009 1010 1011 \n' + '\n' + @@ -149,7 +149,7 @@ describe('Scalar style dump:', function () { '1087 1088 1089 1090 1091 1092\n' + '1093 1094 1095 1096 1097 1098\n' + '1099 1100 1101 1102 1103 1104 ' - var indented = indent(wrapped) + const indented = indent(wrapped) function dumpNarrow (s) { return yaml.dump(s, { lineWidth: 30 + 2 }) @@ -168,7 +168,7 @@ describe('Scalar style dump:', function () { // Dump and check that dump-then-load preserves content (is the identity function). function dump (input, opts) { - var output = yaml.dump(input, opts) + const output = yaml.dump(input, opts) assert.strictEqual(yaml.load(output), input, 'Dump then load should preserve content') return output } @@ -185,7 +185,7 @@ describe('Scalar style dump:', function () { }) it('preserves consecutive spaces', function () { - var alphabet = 'a bc def ghi' + repeat(' ', 70) + 'jk lmn o\n' + + const alphabet = 'a bc def ghi' + repeat(' ', 70) + 'jk lmn o\n' + ' p qrstu v' + repeat(' ', 80) + '\nw x\n' + 'yz ' assert.strictEqual(dump(alphabet), '>-\n' + indent( @@ -197,7 +197,7 @@ describe('Scalar style dump:', function () { '\n' + 'yz \n')) - var indeed = repeat('word. ', 31) + '\n' + + const indeed = repeat('word. ', 31) + '\n' + [2, 3, 5, 7, 11, 13, 17] .map(function (n) { return repeat(' ', n) }) .join('\n') @@ -211,35 +211,35 @@ describe('Scalar style dump:', function () { .join('\n') + '\n')) }) - var story = 'Call me Ishmael. Some years ago—never mind how long precisely—' + + const story = 'Call me Ishmael. Some years ago—never mind how long precisely—' + 'having little or no money in my purse, ' + 'and nothing particular to interest me on shore, ' + 'I thought I would sail about a little and see the watery part of the world...' - var prefix = 'var short_story = "",' - var line = 'longer_story = "' + story + '";' + const prefix = 'var short_story = "",' + const line = 'longer_story = "' + story + '";' it('should fold a long last line missing an ending newline', function () { - var content = [prefix, line].join('\n') + const content = [prefix, line].join('\n') - var lengths = dump(content).split('\n').map(getLength) + const lengths = dump(content).split('\n').map(getLength) assert.deepStrictEqual(lengths, [2, 23, 0, 69, 76, 80, 24, 0]) }) it('should not fold a more-indented last line', function functionName () { - var content = [prefix, line, ' ' + line].join('\n') + const content = [prefix, line, ' ' + line].join('\n') - var lengths = dump(content).split('\n').map(getLength) + const lengths = dump(content).split('\n').map(getLength) assert.deepStrictEqual(lengths, [2, 23, 0, 69, 76, 80, 24, 250, 0]) }) it('should not fold when lineWidth === -1', function () { - var content = [prefix, line, line + line, line].join('\n') + const content = [prefix, line, line + line, line].join('\n') assert.strictEqual(dump(content, { lineWidth: -1 }), '|-\n' + indent(content) + '\n') }) it('falls back to literal style when no lines are foldable', function () { - var content = [prefix, ' ' + line, ' ' + line].join('\n') + const content = [prefix, ' ' + line, ' ' + line].join('\n') assert.strictEqual(dump(content), '|-\n' + indent(content) + '\n') }) diff --git a/test/core/units/empty-node-resolving.js b/test/core/units/empty-node-resolving.js index 8f187d4c..b3e0fa64 100644 --- a/test/core/units/empty-node-resolving.js +++ b/test/core/units/empty-node-resolving.js @@ -2,8 +2,8 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') describe('Resolving explicit tags on empty nodes', function () { it('!!binary', function () { diff --git a/test/core/units/is-negative-zero.js b/test/core/units/is-negative-zero.js index 286ee7d6..64e588b7 100644 --- a/test/core/units/is-negative-zero.js +++ b/test/core/units/is-negative-zero.js @@ -2,9 +2,9 @@ const { it } = require('node:test') -var assert = require('assert') +const assert = require('assert') -var isNegativeZero = require('../../../lib/common').isNegativeZero +const isNegativeZero = require('../../../lib/common').isNegativeZero it('isNegativeZero', function () { assert(!isNegativeZero(0)) diff --git a/test/core/units/loader-parameters.js b/test/core/units/loader-parameters.js index f506fea8..ab4afdcd 100644 --- a/test/core/units/loader-parameters.js +++ b/test/core/units/loader-parameters.js @@ -2,13 +2,13 @@ const { describe, it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') describe('loader parameters', function () { - var testStr = 'test: 1 \ntest: 2' - var expected = [{ test: 2 }] - var result + const testStr = 'test: 1 \ntest: 2' + const expected = [{ test: 2 }] + let result it('loadAll(input, options)', function () { result = yaml.loadAll(testStr, { json: true }) diff --git a/test/core/units/replacer.js b/test/core/units/replacer.js index c4f83e88..e123ef9b 100644 --- a/test/core/units/replacer.js +++ b/test/core/units/replacer.js @@ -6,7 +6,7 @@ const assert = require('assert') const yaml = require('js-yaml') describe('replacer', function () { - let undef = new yaml.Type('!undefined', { + const undef = new yaml.Type('!undefined', { kind: 'scalar', resolve: () => true, construct: () => {}, @@ -14,12 +14,12 @@ describe('replacer', function () { represent: () => '' }) - let undef_schema = yaml.DEFAULT_SCHEMA.extend(undef) + const undef_schema = yaml.DEFAULT_SCHEMA.extend(undef) it('should be called on the root of the document', function () { let called = 0 - let result = yaml.dump(42, { + const result = yaml.dump(42, { replacer (key, value) { called++ assert.deepStrictEqual(this, { '': 42 }) @@ -43,7 +43,7 @@ describe('replacer', function () { it('should be called in collections (block)', function () { let called = 0 - let result = yaml.dump([42], { + const result = yaml.dump([42], { replacer (key, value) { called++ if (key === '' && called === 1) return value @@ -61,7 +61,7 @@ describe('replacer', function () { it('should be called in collections (flow)', function () { let called = 0 - let result = yaml.dump([42], { + const result = yaml.dump([42], { replacer (key, value) { called++ if (key === '' && called === 1) return value @@ -79,7 +79,7 @@ describe('replacer', function () { it('should be called in mappings (block)', function () { let called = 0 - let result = yaml.dump({ a: 42 }, { + const result = yaml.dump({ a: 42 }, { replacer (key, value) { called++ if (key === '' && called === 1) return value @@ -97,7 +97,7 @@ describe('replacer', function () { it('should be called in mappings (flow)', function () { let called = 0 - let result = yaml.dump({ a: 42 }, { + const result = yaml.dump({ a: 42 }, { replacer (key, value) { called++ if (key === '' && called === 1) return value @@ -161,7 +161,7 @@ describe('replacer', function () { it('should recursively call replacer', function () { let count = 0 - let result = yaml.dump(42, { + const result = yaml.dump(42, { replacer (key, value) { return count++ > 3 ? value : { ['lvl' + count]: value } } diff --git a/test/core/units/single-document-error.js b/test/core/units/single-document-error.js index 02f608b3..2480bcdb 100644 --- a/test/core/units/single-document-error.js +++ b/test/core/units/single-document-error.js @@ -2,8 +2,8 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') it('Loading multidocument source using `load` should cause an error', function () { assert.throws(function () { diff --git a/test/core/units/skip-invalid.js b/test/core/units/skip-invalid.js index 58d450b5..2bb05ac2 100644 --- a/test/core/units/skip-invalid.js +++ b/test/core/units/skip-invalid.js @@ -2,10 +2,10 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') -var sample = { +const sample = { number: 42, string: 'hello', func: function (a, b) { return a + b }, @@ -13,7 +13,7 @@ var sample = { array: [1, 2, 3] } -var expected = { +const expected = { number: 42, string: 'hello', array: [1, 2, 3] diff --git a/test/core/units/snippet.js b/test/core/units/snippet.js index 25df6f92..7982a0df 100644 --- a/test/core/units/snippet.js +++ b/test/core/units/snippet.js @@ -2,25 +2,23 @@ const { it } = require('node:test') -var assert = require('assert') -var path = require('path') -var fs = require('fs') -var snippet = require('../../../lib/snippet') +const assert = require('assert') +const path = require('path') +const fs = require('fs') +const snippet = require('../../../lib/snippet') it('Snippet', function () { - let filepath = path.join(__dirname, 'snippet.txt') - let filedata = fs.readFileSync(filepath, 'utf8') + const filepath = path.join(__dirname, 'snippet.txt') + const filedata = fs.readFileSync(filepath, 'utf8') - let data = filedata.split(/(---[ \d]*\n)/).slice(1) + const data = filedata.split(/(---[ \d]*\n)/).slice(1) for (let i = 0; i < data.length; i += 4) { let index = 0 let line = 0 let column = 0 - let input = data[i + 1] - let expected = data[i + 3].replace(/\n$/, '') - let mark - let code + const input = data[i + 1] + const expected = data[i + 3].replace(/\n$/, '') assert(input.indexOf('*') >= 0) @@ -34,7 +32,7 @@ it('Snippet', function () { index += 1 } - mark = { + const mark = { name: filepath, buffer: input, position: index, @@ -42,7 +40,7 @@ it('Snippet', function () { column: column } - code = snippet(mark, { + const code = snippet(mark, { indent: 1, maxLength: 78, linesBefore: 3, diff --git a/test/core/units/sort-keys.js b/test/core/units/sort-keys.js index c1d32ff0..285a43f6 100644 --- a/test/core/units/sort-keys.js +++ b/test/core/units/sort-keys.js @@ -2,13 +2,13 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') -var sample = { b: 1, a: 2, c: 3 } -var unsortedExpected = 'b: 1\na: 2\nc: 3\n' -var simpleExpected = 'a: 2\nb: 1\nc: 3\n' -var reverseExpected = 'c: 3\nb: 1\na: 2\n' +const sample = { b: 1, a: 2, c: 3 } +const unsortedExpected = 'b: 1\na: 2\nc: 3\n' +const simpleExpected = 'a: 2\nb: 1\nc: 3\n' +const reverseExpected = 'c: 3\nb: 1\na: 2\n' it('Dumper should sort preserve key insertion order', function () { assert.deepStrictEqual(yaml.dump(sample, { sortKeys: false }), unsortedExpected) diff --git a/test/core/units/tagmultikind.js b/test/core/units/tagmultikind.js index 4ddabfbc..fe6edf30 100644 --- a/test/core/units/tagmultikind.js +++ b/test/core/units/tagmultikind.js @@ -2,10 +2,10 @@ const { it } = require('node:test') -var assert = require('assert') -var yaml = require('js-yaml') +const assert = require('assert') +const yaml = require('js-yaml') -var tags = [{ +const tags = [{ tag: 'Include', type: 'scalar' }, { @@ -23,7 +23,7 @@ var tags = [{ }) }) -var schema = yaml.DEFAULT_SCHEMA.extend(tags) +const schema = yaml.DEFAULT_SCHEMA.extend(tags) it('Process tag with kind: scalar', function () { assert.deepStrictEqual(yaml.load('!Include foobar', { From 484e20a1ea09be8121d1c0d0533e791898090428 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 29 May 2026 20:21:09 +0300 Subject: [PATCH 23/23] Move vars declaration to usage scopes --- bin/js-yaml.js | 3 +- lib/common.js | 11 +- lib/dumper.js | 103 ++++++----------- lib/loader.js | 109 ++++++------------ lib/schema.js | 5 +- lib/snippet.js | 12 +- lib/type/binary.js | 12 +- lib/type/float.js | 4 +- lib/type/int.js | 6 +- lib/type/omap.js | 11 +- lib/type/pairs.js | 20 +--- lib/type/set.js | 3 +- lib/type/timestamp.js | 3 +- support/demo_template/index.mjs | 5 +- test/core/issues/0054.js | 5 +- test/core/issues/0403.js | 6 +- .../samples-common/construct-string-types.js | 13 +-- test/core/units/replacer.js | 12 +- 18 files changed, 122 insertions(+), 221 deletions(-) diff --git a/bin/js-yaml.js b/bin/js-yaml.js index 4adc9322..583e2999 100755 --- a/bin/js-yaml.js +++ b/bin/js-yaml.js @@ -67,7 +67,8 @@ function readFile (filename, encoding, callback) { } readFile(options.file, 'utf8', function (error, input) { - let output, isYaml + let output + let isYaml if (error) { if (error.code === 'ENOENT') { diff --git a/lib/common.js b/lib/common.js index a362694e..d1fd4dc2 100644 --- a/lib/common.js +++ b/lib/common.js @@ -16,13 +16,11 @@ function toArray (sequence) { } function extend (target, source) { - let index, length, key, sourceKeys - if (source) { - sourceKeys = Object.keys(source) + const sourceKeys = Object.keys(source) - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index] + for (let index = 0, length = sourceKeys.length; index < length; index += 1) { + const key = sourceKeys[index] target[key] = source[key] } } @@ -32,9 +30,8 @@ function extend (target, source) { function repeat (string, count) { let result = '' - let cycle - for (cycle = 0; cycle < count; cycle += 1) { + for (let cycle = 0; cycle < count; cycle += 1) { result += string } diff --git a/lib/dumper.js b/lib/dumper.js index 80887fd2..a5b6acd6 100644 --- a/lib/dumper.js +++ b/lib/dumper.js @@ -59,21 +59,19 @@ const DEPRECATED_BOOLEANS_SYNTAX = [ const DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/ function compileStyleMap (schema, map) { - let index, length, tag, style, type - if (map === null) return {} const result = {} const keys = Object.keys(map) - for (index = 0, length = keys.length; index < length; index += 1) { - tag = keys[index] - style = String(map[tag]) + for (let index = 0, length = keys.length; index < length; index += 1) { + let tag = keys[index] + let style = String(map[tag]) if (tag.slice(0, 2) === '!!') { tag = 'tag:yaml.org,2002:' + tag.slice(2) } - type = schema.compiledTypeMap['fallback'][tag] + const type = schema.compiledTypeMap['fallback'][tag] if (type && _hasOwnProperty.call(type.styleAliases, style)) { style = type.styleAliases[style] @@ -86,7 +84,8 @@ function compileStyleMap (schema, map) { } function encodeHex (character) { - let handle, length + let handle + let length const string = character.toString(16).toUpperCase() @@ -139,13 +138,12 @@ function State (options) { function indentString (string, spaces) { const ind = common.repeat(' ', spaces) let position = 0 - let next = -1 let result = '' - let line const length = string.length while (position < length) { - next = string.indexOf('\n', position) + let line + const next = string.indexOf('\n', position) if (next === -1) { line = string.slice(position) position = length @@ -167,10 +165,8 @@ function generateNextLine (state, level) { } function testImplicitResolving (state, str) { - let index, length, type - - for (index = 0, length = state.implicitTypes.length; index < length; index += 1) { - type = state.implicitTypes[index] + for (let index = 0, length = state.implicitTypes.length; index < length; index += 1) { + const type = state.implicitTypes[index] if (type.resolve(str)) { return true @@ -547,11 +543,10 @@ function foldLine (line, width) { function escapeString (string) { let result = '' let char = 0 - let escapeSeq for (let i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) { char = codePointAt(string, i) - escapeSeq = ESCAPE_SEQUENCES[char] + const escapeSeq = ESCAPE_SEQUENCES[char] if (!escapeSeq && isPrintable(char)) { result += string[i] @@ -567,12 +562,9 @@ function escapeString (string) { function writeFlowSequence (state, level, object) { let _result = '' const _tag = state.tag - let index - let length - let value - for (index = 0, length = object.length; index < length; index += 1) { - value = object[index] + for (let index = 0, length = object.length; index < length; index += 1) { + let value = object[index] if (state.replacer) { value = state.replacer.call(object, String(index), value) @@ -594,12 +586,9 @@ function writeFlowSequence (state, level, object) { function writeBlockSequence (state, level, object, compact) { let _result = '' const _tag = state.tag - let index - let length - let value - for (index = 0, length = object.length; index < length; index += 1) { - value = object[index] + for (let index = 0, length = object.length; index < length; index += 1) { + let value = object[index] if (state.replacer) { value = state.replacer.call(object, String(index), value) @@ -631,20 +620,15 @@ function writeFlowMapping (state, level, object) { let _result = '' const _tag = state.tag const objectKeyList = Object.keys(object) - let index - let length - let objectKey - let objectValue - let pairBuffer - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = '' + for (let index = 0, length = objectKeyList.length; index < length; index += 1) { + let pairBuffer = '' if (_result !== '') pairBuffer += ', ' if (state.condenseFlow) pairBuffer += '"' - objectKey = objectKeyList[index] - objectValue = object[objectKey] + const objectKey = objectKeyList[index] + let objectValue = object[objectKey] if (state.replacer) { objectValue = state.replacer.call(object, objectKey, objectValue) @@ -676,12 +660,6 @@ function writeBlockMapping (state, level, object, compact) { let _result = '' const _tag = state.tag const objectKeyList = Object.keys(object) - let index - let length - let objectKey - let objectValue - let explicitPair - let pairBuffer // Allow sorting keys so that the output file is deterministic if (state.sortKeys === true) { @@ -695,15 +673,15 @@ function writeBlockMapping (state, level, object, compact) { throw new YAMLException('sortKeys must be a boolean or a function') } - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - pairBuffer = '' + for (let index = 0, length = objectKeyList.length; index < length; index += 1) { + let pairBuffer = '' if (!compact || _result !== '') { pairBuffer += generateNextLine(state, level) } - objectKey = objectKeyList[index] - objectValue = object[objectKey] + const objectKey = objectKeyList[index] + let objectValue = object[objectKey] if (state.replacer) { objectValue = state.replacer.call(object, objectKey, objectValue) @@ -713,7 +691,7 @@ function writeBlockMapping (state, level, object, compact) { continue // Skip this pair because of invalid key. } - explicitPair = (state.tag !== null && state.tag !== '?') || + const explicitPair = (state.tag !== null && state.tag !== '?') || (state.dump && state.dump.length > 1024) if (explicitPair) { @@ -751,12 +729,10 @@ function writeBlockMapping (state, level, object, compact) { } function detectType (state, object, explicit) { - let _result, index, length, type, style - const typeList = explicit ? state.explicitTypes : state.implicitTypes - for (index = 0, length = typeList.length; index < length; index += 1) { - type = typeList[index] + for (let index = 0, length = typeList.length; index < length; index += 1) { + const type = typeList[index] if ((type.instanceOf || type.predicate) && (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) && @@ -772,8 +748,9 @@ function detectType (state, object, explicit) { } if (type.represent) { - style = state.styleMap[type.tag] || type.defaultStyle + const style = state.styleMap[type.tag] || type.defaultStyle + let _result if (_toString.call(type.represent) === '[object Function]') { _result = type.represent(object, style) } else if (_hasOwnProperty.call(type.represent, style)) { @@ -805,7 +782,6 @@ function writeNode (state, level, object, block, compact, iskey, isblockseq) { const type = _toString.call(state.dump) const inblock = block - let tagStr if (block) { block = (state.flowLevel < 0 || state.flowLevel > level) @@ -883,7 +859,7 @@ function writeNode (state, level, object, block, compact, iskey, isblockseq) { // // Also need to encode '!' because it has special meaning (end of tag prefix). // - tagStr = encodeURI( + let tagStr = encodeURI( state.tag[0] === '!' ? state.tag.slice(1) : state.tag ).replace(/!/g, '%21') @@ -905,24 +881,19 @@ function writeNode (state, level, object, block, compact, iskey, isblockseq) { function getDuplicateReferences (object, state) { const objects = [] const duplicatesIndexes = [] - let index - let length inspectNode(object, objects, duplicatesIndexes) - for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) { + const length = duplicatesIndexes.length + for (let index = 0; index < length; index += 1) { state.duplicates.push(objects[duplicatesIndexes[index]]) } state.usedDuplicates = new Array(length) } function inspectNode (object, objects, duplicatesIndexes) { - let objectKeyList - let index - let length - if (object !== null && typeof object === 'object') { - index = objects.indexOf(object) + const index = objects.indexOf(object) if (index !== -1) { if (duplicatesIndexes.indexOf(index) === -1) { duplicatesIndexes.push(index) @@ -931,14 +902,14 @@ function inspectNode (object, objects, duplicatesIndexes) { objects.push(object) if (Array.isArray(object)) { - for (index = 0, length = object.length; index < length; index += 1) { - inspectNode(object[index], objects, duplicatesIndexes) + for (let i = 0, length = object.length; i < length; i += 1) { + inspectNode(object[i], objects, duplicatesIndexes) } } else { - objectKeyList = Object.keys(object) + const objectKeyList = Object.keys(object) - for (index = 0, length = objectKeyList.length; index < length; index += 1) { - inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes) + for (let i = 0, length = objectKeyList.length; i < length; i += 1) { + inspectNode(object[objectKeyList[i]], objects, duplicatesIndexes) } } } diff --git a/lib/loader.js b/lib/loader.js index ccd0d41c..8256c2d4 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -264,14 +264,12 @@ const directiveHandlers = { } function captureSegment (state, start, end, checkJson) { - let _position, _length, _character, _result - if (start < end) { - _result = state.input.slice(start, end) + const _result = state.input.slice(start, end) if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position) + for (let _position = 0, _length = _result.length; _position < _length; _position += 1) { + const _character = _result.charCodeAt(_position) if (!(_character === 0x09 || (_character >= 0x20 && _character <= 0x10FFFF))) { throwError(state, 'expected valid JSON character') @@ -286,16 +284,14 @@ function captureSegment (state, start, end, checkJson) { } function mergeMappings (state, destination, source, overridableKeys) { - let key, index, quantity - if (!common.isObject(source)) { throwError(state, 'cannot merge mappings; the provided source object is unacceptable') } const sourceKeys = Object.keys(source) - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index] + for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { + const key = sourceKeys[index] if (!_hasOwnProperty.call(destination, key)) { setProperty(destination, key, source[key]) @@ -306,15 +302,13 @@ function mergeMappings (state, destination, source, overridableKeys) { function storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) { - let index, quantity - // The output is a plain object here, so keys can only be strings. // We need to convert keyNode to a string, but doing so can hang the process // (deeply nested arrays that explode exponentially using aliases). if (Array.isArray(keyNode)) { keyNode = Array.prototype.slice.call(keyNode) - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { + for (let index = 0, quantity = keyNode.length; index < quantity; index += 1) { if (Array.isArray(keyNode[index])) { throwError(state, 'nested arrays are not supported inside keys') } @@ -340,7 +334,7 @@ function storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, val if (keyTag === 'tag:yaml.org,2002:merge') { if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { + for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) { mergeMappings(state, _result, valueNode[index], overridableKeys) } } else { @@ -425,9 +419,7 @@ function skipSeparationSpace (state, allowComments, checkIndent) { function testDocumentSeparator (state) { let _position = state.position - let ch - - ch = state.input.charCodeAt(_position) + let ch = state.input.charCodeAt(_position) // Condition state.position === state.lineStart is tested // in parent on each call, for efficiency. No needs to test here again. @@ -455,8 +447,6 @@ function writeFoldedLines (state, count) { } function readPlainScalar (state, nodeIndent, withinFlowCollection) { - let preceding - let following let captureStart let captureEnd let hasPendingContent @@ -465,9 +455,8 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { let _lineIndent const _kind = state.kind const _result = state.result - let ch - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || @@ -486,7 +475,7 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { } if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) { - following = state.input.charCodeAt(state.position + 1) + const following = state.input.charCodeAt(state.position + 1) if (is_WS_OR_EOL(following) || (withinFlowCollection && is_FLOW_INDICATOR(following))) { @@ -501,14 +490,14 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { while (ch !== 0) { if (ch === 0x3A/* : */) { - following = state.input.charCodeAt(state.position + 1) + const following = state.input.charCodeAt(state.position + 1) if (is_WS_OR_EOL(following) || (withinFlowCollection && is_FLOW_INDICATOR(following))) { break } } else if (ch === 0x23/* # */) { - preceding = state.input.charCodeAt(state.position - 1) + const preceding = state.input.charCodeAt(state.position - 1) if (is_WS_OR_EOL(preceding)) { break @@ -561,11 +550,10 @@ function readPlainScalar (state, nodeIndent, withinFlowCollection) { } function readSingleQuotedScalar (state, nodeIndent) { - let ch let captureStart let captureEnd - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) if (ch !== 0x27/* ' */) { return false @@ -606,12 +594,9 @@ function readSingleQuotedScalar (state, nodeIndent) { function readDoubleQuotedScalar (state, nodeIndent) { let captureStart let captureEnd - let hexLength - let hexResult let tmp - let ch - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) if (ch !== 0x22/* " */) { return false @@ -639,8 +624,8 @@ function readDoubleQuotedScalar (state, nodeIndent) { state.result += simpleEscapeMap[ch] state.position++ } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp - hexResult = 0 + let hexLength = tmp + let hexResult = 0 for (; hexLength > 0; hexLength--) { ch = state.input.charCodeAt(++state.position) @@ -683,7 +668,6 @@ function readFlowCollection (state, nodeIndent) { const _tag = state.tag let _result const _anchor = state.anchor - let following let terminator let isPair let isExplicitPair @@ -692,9 +676,8 @@ function readFlowCollection (state, nodeIndent) { let keyNode let keyTag let valueNode - let ch - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) if (ch === 0x5B/* [ */) { terminator = 0x5D/* ] */ @@ -737,7 +720,7 @@ function readFlowCollection (state, nodeIndent) { isPair = isExplicitPair = false if (ch === 0x3F/* ? */) { - following = state.input.charCodeAt(state.position + 1) + const following = state.input.charCodeAt(state.position + 1) if (is_WS_OR_EOL(following)) { isPair = isExplicitPair = true @@ -788,7 +771,6 @@ function readFlowCollection (state, nodeIndent) { } function readBlockScalar (state, nodeIndent) { - let captureStart let folding let chomping = CHOMPING_CLIP let didReadContent = false @@ -797,9 +779,8 @@ function readBlockScalar (state, nodeIndent) { let emptyLines = 0 let atMoreIndented = false let tmp - let ch - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) if (ch === 0x7C/* | */) { folding = false @@ -915,7 +896,7 @@ function readBlockScalar (state, nodeIndent) { didReadContent = true detectedIndent = true emptyLines = 0 - captureStart = state.position + const captureStart = state.position while (!is_EOL(ch) && (ch !== 0)) { ch = state.input.charCodeAt(++state.position) @@ -928,13 +909,10 @@ function readBlockScalar (state, nodeIndent) { } function readBlockSequence (state, nodeIndent) { - let _line const _tag = state.tag const _anchor = state.anchor const _result = [] - let following let detected = false - let ch // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar @@ -944,7 +922,7 @@ function readBlockSequence (state, nodeIndent) { state.anchorMap[state.anchor] = _result } - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) while (ch !== 0) { if (state.firstTabInLine !== -1) { @@ -956,7 +934,7 @@ function readBlockSequence (state, nodeIndent) { break } - following = state.input.charCodeAt(state.position + 1) + const following = state.input.charCodeAt(state.position + 1) if (!is_WS_OR_EOL(following)) { break @@ -973,7 +951,7 @@ function readBlockSequence (state, nodeIndent) { } } - _line = state.line + const _line = state.line composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true) _result.push(state.result) skipSeparationSpace(state, true, -1) @@ -998,9 +976,7 @@ function readBlockSequence (state, nodeIndent) { } function readBlockMapping (state, nodeIndent, flowIndent) { - let following let allowCompact - let _line let _keyLine let _keyLineStart let _keyPos @@ -1013,7 +989,6 @@ function readBlockMapping (state, nodeIndent, flowIndent) { let valueNode = null let atExplicitKey = false let detected = false - let ch // there is a leading tab before this token, so it can't be a block sequence/mapping; // it can still be flow sequence/mapping or a scalar @@ -1023,7 +998,7 @@ function readBlockMapping (state, nodeIndent, flowIndent) { state.anchorMap[state.anchor] = _result } - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) while (ch !== 0) { if (!atExplicitKey && state.firstTabInLine !== -1) { @@ -1031,8 +1006,8 @@ function readBlockMapping (state, nodeIndent, flowIndent) { throwError(state, 'tab characters must not be used in indentation') } - following = state.input.charCodeAt(state.position + 1) - _line = state.line // Save the current line. + const following = state.input.charCodeAt(state.position + 1) + const _line = state.line // Save the current line. // // Explicit notation case. There are two separate blocks: @@ -1168,14 +1143,12 @@ function readBlockMapping (state, nodeIndent, flowIndent) { } function readTagProperty (state) { - let _position let isVerbatim = false let isNamed = false let tagHandle let tagName - let ch - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) if (ch !== 0x21/* ! */) return false @@ -1196,7 +1169,7 @@ function readTagProperty (state) { tagHandle = '!' } - _position = state.position + let _position = state.position if (isVerbatim) { do { ch = state.input.charCodeAt(++state.position) } @@ -1261,9 +1234,7 @@ function readTagProperty (state) { } function readAnchorProperty (state) { - let ch - - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) if (ch !== 0x26/* & */) return false @@ -1287,9 +1258,7 @@ function readAnchorProperty (state) { } function readAlias (state) { - let ch - - ch = state.input.charCodeAt(state.position) + let ch = state.input.charCodeAt(state.position) if (ch !== 0x2A/* * */) return false @@ -1321,9 +1290,6 @@ function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompac let indentStatus = 1 // 1: this>parent, 0: this=parent, -1: this tag; it should be "scalar", not "' + state.kind + '"') } - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { + for (let typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { type = state.implicitTypes[typeIndex] if (type.resolve(state.result)) { // `state.result` updated in resolver if matched @@ -1455,9 +1421,9 @@ function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompac } else { // looking for multi type type = null - typeList = state.typeMap.multi[state.kind || 'fallback'] + const typeList = state.typeMap.multi[state.kind || 'fallback'] - for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { + for (let typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) { if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) { type = typeList[typeIndex] break @@ -1491,9 +1457,6 @@ function composeNode (state, parentIndent, nodeContext, allowToSeek, allowCompac function readDocument (state) { const documentStart = state.position - let _position - let directiveName - let directiveArgs let hasDirectives = false let ch @@ -1513,14 +1476,14 @@ function readDocument (state) { hasDirectives = true ch = state.input.charCodeAt(++state.position) - _position = state.position + let _position = state.position while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state.input.charCodeAt(++state.position) } - directiveName = state.input.slice(_position, state.position) - directiveArgs = [] + const directiveName = state.input.slice(_position, state.position) + const directiveArgs = [] if (directiveName.length < 1) { throwError(state, 'directive name must not be less than one character in length') diff --git a/lib/schema.js b/lib/schema.js index 70bd4e9b..52e8f41e 100644 --- a/lib/schema.js +++ b/lib/schema.js @@ -36,9 +36,6 @@ function compileMap (/* lists... */) { fallback: [] } } - let index - let length - function collectType (type) { if (type.multi) { result.multi[type.kind].push(type) @@ -48,7 +45,7 @@ function compileMap (/* lists... */) { } } - for (index = 0, length = arguments.length; index < length; index += 1) { + for (let index = 0, length = arguments.length; index < length; index += 1) { arguments[index].forEach(collectType) } return result diff --git a/lib/snippet.js b/lib/snippet.js index 74f55ddb..71004a4d 100644 --- a/lib/snippet.js +++ b/lib/snippet.js @@ -56,14 +56,12 @@ function makeSnippet (mark, options) { if (foundLineNo < 0) foundLineNo = lineStarts.length - 1 let result = '' - let i - let line const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3) - for (i = 1; i <= options.linesBefore; i++) { + for (let i = 1; i <= options.linesBefore; i++) { if (foundLineNo - i < 0) break - line = getLine( + const line = getLine( mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], @@ -74,14 +72,14 @@ function makeSnippet (mark, options) { ' | ' + line.str + '\n' + result } - line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength) + const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength) result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + ' | ' + line.str + '\n' result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\n' - for (i = 1; i <= options.linesAfter; i++) { + for (let i = 1; i <= options.linesAfter; i++) { if (foundLineNo + i >= lineEnds.length) break - line = getLine( + const line = getLine( mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], diff --git a/lib/type/binary.js b/lib/type/binary.js index cd59c09e..dbe23004 100644 --- a/lib/type/binary.js +++ b/lib/type/binary.js @@ -8,15 +8,13 @@ const BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567 function resolveYamlBinary (data) { if (data === null) return false - let code - let idx let bitlen = 0 const max = data.length const map = BASE64_MAP // Convert one by one. - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)) + for (let idx = 0; idx < max; idx++) { + const code = map.indexOf(data.charAt(idx)) // Skip CR/LF if (code > 64) continue @@ -32,7 +30,6 @@ function resolveYamlBinary (data) { } function constructYamlBinary (data) { - let idx const input = data.replace(/[\r\n=]/g, '') // remove CR/LF & padding to simplify scan const max = input.length const map = BASE64_MAP @@ -41,7 +38,7 @@ function constructYamlBinary (data) { // Collect by 6*4 bits (3 bytes) - for (idx = 0; idx < max; idx++) { + for (let idx = 0; idx < max; idx++) { if ((idx % 4 === 0) && idx) { result.push((bits >> 16) & 0xFF) result.push((bits >> 8) & 0xFF) @@ -72,13 +69,12 @@ function constructYamlBinary (data) { function representYamlBinary (object /*, style */) { let result = '' let bits = 0 - let idx const max = object.length const map = BASE64_MAP // Convert every three bytes to 4 ASCII characters. - for (idx = 0; idx < max; idx++) { + for (let idx = 0; idx < max; idx++) { if ((idx % 3 === 0) && idx) { result += map[(bits >> 18) & 0x3F] result += map[(bits >> 12) & 0x3F] diff --git a/lib/type/float.js b/lib/type/float.js index 66e11f53..6aae1b42 100644 --- a/lib/type/float.js +++ b/lib/type/float.js @@ -28,9 +28,7 @@ function resolveYamlFloat (data) { } function constructYamlFloat (data) { - let value - - value = data.replace(/_/g, '').toLowerCase() + let value = data.replace(/_/g, '').toLowerCase() const sign = value[0] === '-' ? -1 : 1 if ('+-'.indexOf(value[0]) >= 0) { diff --git a/lib/type/int.js b/lib/type/int.js index 48575d19..c4670b0f 100644 --- a/lib/type/int.js +++ b/lib/type/int.js @@ -23,11 +23,10 @@ function resolveYamlInteger (data) { const max = data.length let index = 0 let hasDigits = false - let ch if (!max) return false - ch = data[index] + let ch = data[index] // sign if (ch === '-' || ch === '+') { @@ -104,13 +103,12 @@ function resolveYamlInteger (data) { function constructYamlInteger (data) { let value = data let sign = 1 - let ch if (value.indexOf('_') !== -1) { value = value.replace(/_/g, '') } - ch = value[0] + let ch = value[0] if (ch === '-' || ch === '+') { if (ch === '-') sign = -1 diff --git a/lib/type/omap.js b/lib/type/omap.js index 1dc946d2..b27786e7 100644 --- a/lib/type/omap.js +++ b/lib/type/omap.js @@ -9,18 +9,15 @@ function resolveYamlOmap (data) { if (data === null) return true const objectKeys = [] - let index; let length - let pair - let pairKey - let pairHasKey const object = data - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index] - pairHasKey = false + for (let index = 0, length = object.length; index < length; index += 1) { + const pair = object[index] + let pairHasKey = false if (_toString.call(pair) !== '[object Object]') return false + let pairKey for (pairKey in pair) { if (_hasOwnProperty.call(pair, pairKey)) { if (!pairHasKey) pairHasKey = true diff --git a/lib/type/pairs.js b/lib/type/pairs.js index 11a2faba..4b902220 100644 --- a/lib/type/pairs.js +++ b/lib/type/pairs.js @@ -7,20 +7,16 @@ const _toString = Object.prototype.toString function resolveYamlPairs (data) { if (data === null) return true - let index - let length - let pair - let keys const object = data const result = new Array(object.length) - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index] + for (let index = 0, length = object.length; index < length; index += 1) { + const pair = object[index] if (_toString.call(pair) !== '[object Object]') return false - keys = Object.keys(pair) + const keys = Object.keys(pair) if (keys.length !== 1) return false @@ -33,17 +29,13 @@ function resolveYamlPairs (data) { function constructYamlPairs (data) { if (data === null) return [] - let index - let length - let pair - let keys const object = data const result = new Array(object.length) - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index] + for (let index = 0, length = object.length; index < length; index += 1) { + const pair = object[index] - keys = Object.keys(pair) + const keys = Object.keys(pair) result[index] = [keys[0], pair[keys[0]]] } diff --git a/lib/type/set.js b/lib/type/set.js index 7a7c4d88..8e8a1190 100644 --- a/lib/type/set.js +++ b/lib/type/set.js @@ -7,10 +7,9 @@ const _hasOwnProperty = Object.prototype.hasOwnProperty function resolveYamlSet (data) { if (data === null) return true - let key const object = data - for (key in object) { + for (const key in object) { if (_hasOwnProperty.call(object, key)) { if (object[key] !== null) return false } diff --git a/lib/type/timestamp.js b/lib/type/timestamp.js index 611c048d..771474ea 100644 --- a/lib/type/timestamp.js +++ b/lib/type/timestamp.js @@ -27,11 +27,10 @@ function resolveYamlTimestamp (data) { } function constructYamlTimestamp (data) { - let match let fraction = 0 let delta = null - match = YAML_DATE_REGEXP.exec(data) + let match = YAML_DATE_REGEXP.exec(data) if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data) if (match === null) throw new Error('Date resolve error') diff --git a/support/demo_template/index.mjs b/support/demo_template/index.mjs index f10d8a2a..7ccb5a90 100644 --- a/support/demo_template/index.mjs +++ b/support/demo_template/index.mjs @@ -8,7 +8,10 @@ import 'codemirror/mode/yaml/yaml.js' import 'codemirror/mode/javascript/javascript.js' import './demo.css' -let source, result, permalink, clear +let source +let result +let permalink +let clear function encodeBase64 (str) { return btoa(String.fromCharCode(...new TextEncoder().encode(str))) diff --git a/test/core/issues/0054.js b/test/core/issues/0054.js index 56dcf74e..5c94abed 100644 --- a/test/core/issues/0054.js +++ b/test/core/issues/0054.js @@ -50,20 +50,19 @@ it("Incorrect utf-8 handling on require('file.yaml')", function () { - ууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууууу `) let expected = '' - let index // // document is an array of 40 elements // each element is a string of 100 `у` (Russian letter) chars // - for (index = 0; index <= 100; index += 1) { + for (let index = 0; index <= 100; index += 1) { expected += 'у' } // // make sure none of the strings were corrupted. // - for (index = 0; index < 40; index += 1) { + for (let index = 0; index < 40; index += 1) { assert.strictEqual(data[index], expected, ('Line ' + index + ' is corrupted')) } }) diff --git a/test/core/issues/0403.js b/test/core/issues/0403.js index dc88d05f..4d608b3c 100644 --- a/test/core/issues/0403.js +++ b/test/core/issues/0403.js @@ -6,10 +6,8 @@ const assert = require('assert') const yaml = require('js-yaml') it('should properly dump leading newlines and spaces', function () { - let dump, src - - src = { str: '\n a\nb' } - dump = yaml.dump(src) + let src = { str: '\n a\nb' } + let dump = yaml.dump(src) assert.deepStrictEqual(yaml.load(dump), src) src = { str: '\n\n a\nb' } diff --git a/test/core/samples-common/construct-string-types.js b/test/core/samples-common/construct-string-types.js index a842572f..b2687daa 100644 --- a/test/core/samples-common/construct-string-types.js +++ b/test/core/samples-common/construct-string-types.js @@ -70,44 +70,43 @@ module.exports = { // now indent the long multi really far let obj = module.exports -let i -for (i = 0; i < 5; i++) { +for (let i = 0; i < 5; i++) { obj.indent = {} obj = obj.indent } obj.ind = module.exports.longMulti -for (i = 0; i < 5; i++) { +for (let i = 0; i < 5; i++) { obj.indent = {} obj = obj.indent } obj.ind = module.exports.longMulti -for (i = 0; i < 5; i++) { +for (let i = 0; i < 5; i++) { obj.indent = {} obj = obj.indent } obj.ind = module.exports.longMulti -for (i = 0; i < 5; i++) { +for (let i = 0; i < 5; i++) { obj.indent = {} obj = obj.indent } obj.ind = module.exports.longMulti -for (i = 0; i < 5; i++) { +for (let i = 0; i < 5; i++) { obj.indent = {} obj = obj.indent } obj.ind = module.exports.longMulti -for (i = 0; i < 5; i++) { +for (let i = 0; i < 5; i++) { obj.indent = {} obj = obj.indent } diff --git a/test/core/units/replacer.js b/test/core/units/replacer.js index e123ef9b..9298ace8 100644 --- a/test/core/units/replacer.js +++ b/test/core/units/replacer.js @@ -113,15 +113,13 @@ describe('replacer', function () { }) it('undefined removes element from a mapping', function () { - let str, result - - str = yaml.dump({ a: 1, b: 2, c: 3 }, { + let str = yaml.dump({ a: 1, b: 2, c: 3 }, { replacer (key, value) { if (key === 'b') return undefined return value } }) - result = yaml.load(str) + let result = yaml.load(str) assert.deepStrictEqual(result, { a: 1, c: 3 }) str = yaml.dump({ a: 1, b: 2, c: 3 }, { @@ -136,15 +134,13 @@ describe('replacer', function () { }) it('undefined replaces element in an array with null', function () { - let str, result - - str = yaml.dump([1, 2, 3], { + let str = yaml.dump([1, 2, 3], { replacer (key, value) { if (key === '1') return undefined return value } }) - result = yaml.load(str) + let result = yaml.load(str) assert.deepStrictEqual(result, [1, null, 3]) str = yaml.dump([1, 2, 3], {