Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khezen/mergeyaml
Recursively merge yaml documents in a new one.
https://github.com/khezen/mergeyaml
client npm yaml
Last synced: 17 days ago
JSON representation
Recursively merge yaml documents in a new one.
- Host: GitHub
- URL: https://github.com/khezen/mergeyaml
- Owner: khezen
- License: mit
- Created: 2016-10-23T22:01:37.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-05-07T13:51:12.000Z (over 3 years ago)
- Last Synced: 2024-12-16T07:20:28.624Z (26 days ago)
- Topics: client, npm, yaml
- Language: JavaScript
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![NPM Version](http://img.shields.io/npm/v/mergeyaml.svg?style=flat)](https://www.npmjs.org/package/mergeyaml)
Recursively merge yaml documents in a new one
# Node.js Usage
install
```
npm install mergeyaml --save
```one.yml
```
1: hello
4:
4.1: jhon
4.2: doe
```two.yml
```
2: world
4:
4.1: jhon
4.2: lenon
4.3: from two```
three.yml
```
3: '!'
4:
4.1: jhon
4.2: lennon
4.3: from three```
example.js
```javascript
'use strict';
var fs = require('fs');
var mergeyaml = require('mergeyaml');var one = fs.readFileSync(__dirname + '/one.yml', 'utf8');
var two = fs.readFileSync(__dirname + '/two.yml', 'utf8');
var three = fs.readFileSync(__dirname + '/three.yml', 'utf8');console.log(mergeyaml(one, two, three));
// or
console.log(mergeyaml([one, two, three]));
// ->
/*
1: hello
2: world
3: '!'
4:
4.1: jhon
4.2: doe
4.3: from two
*/
```# Terminal Usage
```
npm install -g mergeyaml
```
```
mergeyaml $(cat one.yml) $(cat two.yml) $(cat three.yml)
# ->
#
# 1: hello
# 2: world
# 3: '!'
# 4:
# 4.1: jhon
# 4.2: doe
# 4.3: from two
```