https://github.com/sno2/yaml_loader
A yaml file loader & parser module for Deno
https://github.com/sno2/yaml_loader
deno deno-module module yaml yaml-files yaml-parser yaml-processor
Last synced: 6 months ago
JSON representation
A yaml file loader & parser module for Deno
- Host: GitHub
- URL: https://github.com/sno2/yaml_loader
- Owner: sno2
- License: mit
- Created: 2020-08-22T20:08:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-25T12:55:02.000Z (about 5 years ago)
- Last Synced: 2025-02-15T09:35:31.679Z (8 months ago)
- Topics: deno, deno-module, module, yaml, yaml-files, yaml-parser, yaml-processor
- Language: TypeScript
- Homepage: https://deno.land/x/yaml_loader
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yaml_loader
Yaml Loader is a [Deno module](https://deno.land/x/yaml_loader) that allows you to load yaml files and parse their contents as json.
## Features
Yaml Loader will parse your json files using the deno standard library, therefore, there aren't any third-party modules used.
## Usage
Before using yaml_loader, you must first have Deno installed. If you don't, go to the [Deno Installation page](https://deno.land/#installation) and follow those simple steps :)
All right, nown that we got that stuff over, you can just use the yaml_loader module in your project by add this simple line of code:
```ts
import { YamlLoader } from "https://deno.land/x/yaml_loader/mod.ts";
```After that, we can start utilizing the `YamlLoader` class! The only method inside of the class that you need is `parseFile`. It is an asynchronous method, though, so remember to always await for it to be done ;) Here is an example of using the `YamlLoader`:
> There is a breaking change when updating from v0.0.0 to v0.1.0 The `parseYamlFile` method on `YamlLoader` is now named `parseFile`
```ts
import { YamlLoader } from "https://deno.land/x/yaml_loader/mod.ts";const yamlLoader = new YamlLoader();
const parsedYamlFile = await yamlLoader.parseFile("./foo.yaml");
console.log(parsedYamlFile);
```The above code would parse the `foo.yaml` file and set its json-ified contents to the `parsedYamlFile` constant. After that, we are just logging out the data as an object from `foo.yaml` after it is parsed.