@delucis/reading-data-yaml-loader

0.1.2 • Public • Published

@delucis/reading-data-yaml-loader

Build Status Coverage Status npm (scoped)

A plugin for @delucis/reading-data that loads YAML files over the network or from the local file system.

Installation

npm install --save @delucis/reading-data-yaml-loader

Usage

const RD = require('@delucis/reading-data')
const YAML_LOADER = require('@delucis/reading-data-yaml-loader')

RD.use(YAML_LOADER, {
  scope: 'myYAMLFile',
  path: 'https://unpkg.com/@delucis/reading-data/.travis.yml'
})

RD.run().then((res) => {
  console.log(res.data.myYAMLFile)
})

Using reading-data-yaml-loader to load multiple files:

RD.use(YAML_LOADER, {
  scope: [local, github, unpkg]
  path: {
    local: 'config.yml',
    github: 'https://raw.githubusercontent.com/delucis/reading-data/master/.travis.yml',
    unpkg: 'https://unpkg.com/@delucis/reading-data/.travis.yml'
  }
})

RD.run().then((res) => {
  for (var key in res.data) {
    console.log(key) // 'local', 'github', 'unpkg'
  }
})

Options

name type default required? description
hooks String, Object The reading-data hook that should load the YAML file. Can be scoped by passing an object with scopes as keys, hooks as values.
path String, Object ✔︎ The path or URL of the YAML file to load. Can be an object, where the keys match the scope(s) set in the scope option.
scope String, Array 'yaml-loader' The scope under which reading-data will store this plugin’s data. Can be an array to return multiple filepaths/URLs, to multiple scopes.

Readme

Keywords

none

Package Sidebar

Install

npm i @delucis/reading-data-yaml-loader

Weekly Downloads

1

Version

0.1.2

License

GPL-3.0

Unpacked Size

6.05 kB

Total Files

3

Last publish

Collaborators

  • delucis