I Built an npm Package to Scrape and Slim Down YAML Files
I Built a Library That Scrapes and Slims Down YAML Files I created an npm module that strips YAML files down to size. It can delete specific elements or replace them with empty values. Published he...

Source: DEV Community
I Built a Library That Scrapes and Slims Down YAML Files I created an npm module that strips YAML files down to size. It can delete specific elements or replace them with empty values. Published here: npm / yaml-scraper GitHub / yaml-scraper The word "scraper" means something like "to scrape off." It even has a Travis CI badge! What Can It Do? Given a YAML file like this: sample: hoge: I want to delete this fuga: I want to empty this hogehoge: hoge: I want to delete this too fuga: I want to empty this too hogera: Leave this as-is piyopiyo: piyo: I want to delete the parent of this The library can: Delete elements whose key is hoge Keep elements whose key is fuga, but replace the value with an empty string Delete the parent element of the element whose key is piyo The resulting output is: sample: fuga: '' hogehoge: fuga: '' hogera: Leave this as-is Unnecessary elements are stripped away, making the YAML file much lighter. It works at any nesting depth! Why I Built It I use Swagger to ge