Home

Awesome

<h1>gar-yaml: <i>read or write yaml interpolating env variables</i> </h1>

deno.land/x/garn-yaml

Test

<h2>Usage</h2>
# read.yml
DENO_ENV: ${{DENO_ENV}}
// read.ts
import { readYaml } from 'https://deno.land/x/garn_yaml@0.2.1/mod.ts';
import { assertEquals } from 'https://deno.land/std@0.90.0/testing/asserts.ts';

const yamlObject = await readYaml('./read.yml');
assertEquals(typeof yamlObject, 'object');
assertEquals(yamlObject.DENO_ENV, 'development');
DENO_ENV=development deno run read.ts --allow-read --allow-env
// write.ts
import { writeYaml } from 'https://deno.land/x/garn_yaml@0.2.1/mod.ts';

const yamlText = await writeYaml('./write.yml', { a: 1 }); // a: 1
# write.yml
a: 1