1.0.3 • Published 3 years ago

js-yaml-import v1.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

js-yaml-import Build Status Coverage Status

Allows import files in YAML.

Requirements

This plugin requires an LTS Node version (v10.0.0+).

Install

Using npm:

$ npm i js-yaml js-yaml-import -D

Using yarn:

$ yarn add js-yaml js-yaml-import -D

Usage

# ./src/foo.yaml

Media:
  Anime: foo
# ./src/bar.yaml

'@import':
  - baz.yaml

Media:
  VideoGames: bar
# ./src/baz.yaml

Media:
  FilmAdaptation: baz
# ./src/data.yaml

'@import':
  - foo.yaml
  - bar.yaml

Media:
  Webcomic: aaa
  Manga: bbb
const path = require('path');
const Yaml = require('js-yaml-import');

const yaml = new Yaml(path.join(__dirname, 'src'));
const yamlFile = yaml.read(path.join(__dirname, './src/data.yaml'));

console.log('data =', yamlFile);
// data = {
//   Media: {
//     Anime: 'foo',
//     FilmAdaptation: 'baz',
//     VideoGames: 'bar',
//     Webcomic: 'aaa',
//     Manga: 'bbb'
//   }
// }

Options

searchPaths

Type: string | string[]

Example

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago