Delete or empty specified items to lighten your YAML document.
The purpose of this module is to avoid capacity limit errors that occur when importing a swagger file into Amazon API Gateway.
This module require npm. If npm has already been installed, you can install the library with the following command.
npm install yaml-scraper
Please call the module as following.
// import package
const fs = require('fs');
const scraper = require('yaml-scraper');
// read yaml file
const input = fs.readFileSync('./sample.yaml', 'utf8');
// delete example and empty description and delete parent of deprecated
const output = scraper(input)
.delete('example')
.empty('description')
.deleteParent('deprecated')
.toString();
// display result
console.log(output);
Parses input
as YAML format. Please call this function first, and then connect method chains below.
Delete the item whose key is target
. It can be used for method chain.
Replace the value of target
with ''
. It can be used for method chain.
Delete the element whose child has target
. It can be used for method chain.
Generate a YAML format string based on the current data and return it.
If you edit this project, you can clone it from the repository and build the development environment with the following command.
# Install required packages
npm install
# Run the test
npm test