2020-01-21 10:01:55 -05:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2019-11-18 09:39:32 -05:00
|
|
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
|
|
|
|
|
|
import { parse } from "../../yaml.ts";
|
|
|
|
|
2020-03-20 09:38:34 -04:00
|
|
|
(() => {
|
2020-06-12 15:23:38 -04:00
|
|
|
const yml = Deno.readFileSync(`${Deno.cwd()}/example/sample_document.yml`);
|
2019-11-18 09:39:32 -05:00
|
|
|
|
|
|
|
const document = new TextDecoder().decode(yml);
|
2020-08-24 19:43:54 -04:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
const obj = parse(document) as Record<string, any>;
|
2019-11-18 09:39:32 -05:00
|
|
|
console.log(obj);
|
|
|
|
|
|
|
|
let i = 0;
|
|
|
|
for (const o of Object.values(obj)) {
|
|
|
|
console.log(`======${i}`);
|
|
|
|
for (const [key, value] of Object.entries(o)) {
|
|
|
|
console.log(key, value);
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
})();
|