markdownlint-cli2
Version:
A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the `markdownlint` library
26 lines (23 loc) • 589 B
JavaScript
// @ts-check
/**
* Merges two options objects by combining config and replacing properties.
* @param {object} first First options object.
* @param {object} second Second options object.
* @returns {object} Merged options object.
*/
const mergeOptions = (first, second) => {
const merged = {
...first,
...second
};
const firstConfig = first && first.config;
const secondConfig = second && second.config;
if (firstConfig || secondConfig) {
merged.config = {
...firstConfig,
...secondConfig
};
}
return merged;
};
export default mergeOptions;