
package.es.options.util.mjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apidom-reference Show documentation
Show all versions of apidom-reference Show documentation
Advanced algorithms for semantic ApiDOM manipulations like dereferencing or resolution.
import { mergeDeepRight, lens, path, assocPath, over } from 'ramda';
import { isEmptyString } from 'ramda-adjunct';
import { cwd } from "../util/url.mjs";
/**
* Algorithm for deep merging options.
*/
const baseURILens = lens(path(['resolve', 'baseURI']), assocPath(['resolve', 'baseURI']));
const baseURIDefault = baseURI => isEmptyString(baseURI) ? cwd() : baseURI;
// eslint-disable-next-line import/prefer-default-export
export const merge = (lObj, rObj) => {
const withoutDefaults = mergeDeepRight(lObj, rObj);
// @ts-ignore
return over(baseURILens, baseURIDefault, withoutDefaults);
};
© 2015 - 2025 Weber Informatics LLC | Privacy Policy