js-yaml-import
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -38,8 +38,6 @@ 'use strict'; | ||
read(fileName) { | ||
var _json$AtImport; | ||
const json = yaml__default['default'].load(fs__default['default'].readFileSync(fileName, 'utf8')); | ||
const paths = this.searchPaths.filter(fs__default['default'].existsSync); | ||
if ((_json$AtImport = json[AtImport]) !== null && _json$AtImport !== void 0 && _json$AtImport.length) { | ||
if (json[AtImport]?.length) { | ||
let result = {}; | ||
@@ -55,3 +53,3 @@ | ||
if (fs__default['default'].existsSync(input)) { | ||
const data = yaml__default['default'].load(fs__default['default'].readFileSync(input, 'utf8')); | ||
const data = this.read(input); | ||
result = ___default['default'].merge(result, data); | ||
@@ -58,0 +56,0 @@ } |
@@ -18,8 +18,6 @@ import _merge from "lodash/merge"; | ||
read(fileName) { | ||
var _json$AtImport; | ||
const json = yaml.load(fs.readFileSync(fileName, 'utf8')); | ||
const paths = this.searchPaths.filter(fs.existsSync); | ||
if ((_json$AtImport = json[AtImport]) !== null && _json$AtImport !== void 0 && _json$AtImport.length) { | ||
if (json[AtImport]?.length) { | ||
let result = {}; | ||
@@ -35,3 +33,3 @@ | ||
if (fs.existsSync(input)) { | ||
const data = yaml.load(fs.readFileSync(input, 'utf8')); | ||
const data = this.read(input); | ||
result = _merge(result, data); | ||
@@ -38,0 +36,0 @@ } |
{ | ||
"name": "js-yaml-import", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Allows import files in YAML.", | ||
@@ -5,0 +5,0 @@ "main": "dist/js-yaml-import.cjs.js", |
@@ -7,3 +7,3 @@ # js-yaml-import [![Build Status](https://travis-ci.org/Vanilla-IceCream/js-yaml-import.svg?branch=master)](https://travis-ci.org/Vanilla-IceCream/js-yaml-import) [![Coverage Status](https://coveralls.io/repos/github/Vanilla-IceCream/js-yaml-import/badge.svg?branch=master)](https://coveralls.io/github/Vanilla-IceCream/js-yaml-import?branch=master) | ||
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+). | ||
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v10.0.0+). | ||
@@ -29,4 +29,4 @@ ## Install | ||
media: | ||
video_games: foo | ||
Media: | ||
Anime: foo | ||
``` | ||
@@ -37,7 +37,17 @@ | ||
media: | ||
film_adaptation: bar | ||
'@import': | ||
- baz.yaml | ||
Media: | ||
VideoGames: bar | ||
``` | ||
```yaml | ||
# ./src/baz.yaml | ||
Media: | ||
FilmAdaptation: baz | ||
``` | ||
```yaml | ||
# ./src/data.yaml | ||
@@ -49,6 +59,5 @@ | ||
media: | ||
webcomic: aaa | ||
manga: bbb | ||
anime: ccc | ||
Media: | ||
Webcomic: aaa | ||
Manga: bbb | ||
``` | ||
@@ -65,8 +74,8 @@ | ||
// data = { | ||
// media: { | ||
// video_games: 'foo', | ||
// film_adaptation: 'bar', | ||
// webcomic: 'aaa', | ||
// manga: 'bbb', | ||
// anime: 'ccc' | ||
// Media: { | ||
// Anime: 'foo', | ||
// FilmAdaptation: 'baz', | ||
// VideoGames: 'bar', | ||
// Webcomic: 'aaa', | ||
// Manga: 'bbb' | ||
// } | ||
@@ -73,0 +82,0 @@ // } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87
5357
90