Skip to content

Mechanism for sanitizing options

Jonathan Neuhauser requested to merge github/fork/Ede123/default_options into master

Created by: Ede123

This PR adds an easy way to sanitize an options object that should be passed to scourString/scourXmlFile. By generating a set of default options and "merging in" know attributes from the options passed to the function it is ensured that all attributes are correctly set (default values are used for unspecified attributes) while also removing unknown attributes.

Firstly this makes it easier to use Scour from another script (Instead of requiring explicit calling of generateDefaultOptions to get a copy of the latest options which have to be modified and fed back into Scour it's enough to generate an object that contains just the attributes that one wants to change). Secondly it will avoid compatibility issues that may arise in case any options are added/removed/renamed in the future.

Merge request reports

Loading