main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
599 bytes
|
Line | |
---|
1 | import { mergeDeepRight, lens, path, assocPath, over } from 'ramda';
|
---|
2 | import { isEmptyString } from 'ramda-adjunct';
|
---|
3 | import { cwd } from "../util/url.mjs";
|
---|
4 | /**
|
---|
5 | * Algorithm for deep merging options.
|
---|
6 | */
|
---|
7 | const baseURILens = lens(path(['resolve', 'baseURI']), assocPath(['resolve', 'baseURI']));
|
---|
8 | const baseURIDefault = baseURI => isEmptyString(baseURI) ? cwd() : baseURI;
|
---|
9 |
|
---|
10 | // eslint-disable-next-line import/prefer-default-export
|
---|
11 | export const merge = (lObj, rObj) => {
|
---|
12 | const withoutDefaults = mergeDeepRight(lObj, rObj);
|
---|
13 | // @ts-ignore
|
---|
14 | return over(baseURILens, baseURIDefault, withoutDefaults);
|
---|
15 | }; |
---|
Note:
See
TracBrowser
for help on using the repository browser.