@io-arc/yaml2json
YAML to JSON conversion.
Using RxJS (library included).
Usage#
Methods#
Instance parameters#
| params | type | default | description |
|---|---|---|---|
target | string[] | - | Target directory name array |
output | string[] | - | Output directory name array |
directory name array is /src/yaml => ['src', 'yaml'].
convertAll(isMinify)#
Return: RxJS.Observable<string>
Converts all YAMLs in a directory.
Except for files that begin with an underscore.
Parameters
| params | type | default | description |
|---|---|---|---|
isMinify | boolean | - | Minify during conversion |
Example
convert(filepath, isMinify)#
Return: RxJS.Observable<string>
Convert the specified file.
The filepath does not have to be the directory specified in the constructor.
However, the output destination will be the directory specified in the constructor.
Parameters
| params | type | default | description |
|---|---|---|---|
filepath | string | - | The file path to which you want to convert |
Example
removeAll(target)#
Return: RxJS.Observable<string>
If target is not specified, the output directory specified by a constructor.
If you want to specify a location different from the destination, use the Glob pattern.
(e.g. foo/bar/**/*.json)
If target is undefined, all JSON in the output directory specified in the constructor will be deleted.
Parameters
| params | type | default | description |
|---|---|---|---|
target (optional) | Glob | undefined | Specify by file path or Glob pattern |
Example
remove(filepath)#
Return: RxJS.Observable<string>
Remove the specified file.
The filepath does not have to be the directory specified in the constructor.
However, the output destination will be the directory specified in the constructor.
Parameters
| params | type | default | description |
|---|---|---|---|
filepath | string | - | The file path to which you want to convert |
Example